diff --git a/ChangeLog b/ChangeLog index 3c17691e8..c70da7b1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +* 14.0.0 +- New required configuration value to specify protobuf message types, see: + https://developers.google.com/google-ads/api/docs/client-libs/python/protobuf-messages +- Google Ads API v8_1 release. +- Remove support for Google Ads API v6. + * 13.0.0 - Bump the minimum Python version requirement to 3.7+ - Fix package name in base transport files diff --git a/README.rst b/README.rst index 84dbd80fa..bad82108d 100644 --- a/README.rst +++ b/README.rst @@ -40,6 +40,13 @@ Users who cannot upgrade can continue to safely use version `12.0.0`_ until `Google Ads Developer Blog`_ for announcements of the specific deprecation dates for the above API versions. +Protobuf Messages +----------------- +Version `14.0.0_` of this library introduced the **required** `use_proto_plus` +configuration option that specifies which type of protobuf message to use. For +information on why this flag is important and what the differences are between +the two message types, see the `Protobuf Messages`_ guide. + Miscellaneous ------------- @@ -67,8 +74,10 @@ Authors .. _Andrew Burke: https://github.com/AndrewMBurke .. _Laura Chevalier: https://github.com/laurachevalier4 .. _12.0.0: https://pypi.org/project/google-ads/12.0.0/ +.. _14.0.0: https://pypi.org/project/google-ads/14.0.0/ .. _v6: https://developers.google.com/google-ads/api/reference/rpc/v6/overview .. _v7: https://developers.google.com/google-ads/api/reference/rpc/v7/overview .. _v8: https://developers.google.com/google-ads/api/reference/rpc/v8/overview .. _EOL: https://endoflife.date/python .. _Google Ads Developer Blog: https://ads-developers.googleblog.com/ +.. _Protobuf Messages: https://developers.google.com/google-ads/api/docs/client-libs/python/protobuf-messages diff --git a/examples/advanced_operations/add_gmail_ad.py b/examples/advanced_operations/add_gmail_ad.py deleted file mode 100755 index 07e8de270..000000000 --- a/examples/advanced_operations/add_gmail_ad.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python -# Copyright 2019 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. -"""This example adds a gmail ad to a given ad group. - -The ad group's campaign needs to have an AdvertisingChannelSubtype of -DISPLAY_GMAIL_AD. To get ad groups, run basic_operations/get_ad_groups.py -""" - - -import argparse -import sys -from uuid import uuid4 -import requests - -from google.ads.googleads.client import GoogleAdsClient -from google.ads.googleads.errors import GoogleAdsException - -LOGO_URL = "https://goo.gl/mtt54n" -MARKETING_IMG_URL = "http://goo.gl/3b9Wfh" - - -def main(client, customer_id, ad_group_id): - logo_img_bytes, logo_img_content_type = _get_image(LOGO_URL) - marketing_img_bytes, marketing_img_content_type = _get_image( - MARKETING_IMG_URL - ) - - if logo_img_content_type != "image/png": - raise ValueError("Logo image has invalid content-type.") - - if marketing_img_content_type != "image/jpeg": - raise ValueError("Marketing image has invalid content-type.") - - media_file_service = client.get_service("MediaFileService") - media_file_logo_op = client.get_type("MediaFileOperation") - media_file_logo = media_file_logo_op.create - media_file_logo.type_ = client.enums.MediaTypeEnum.IMAGE - media_file_logo.image.data = logo_img_bytes - media_file_logo.mime_type = client.enums.MimeTypeEnum.IMAGE_PNG - - media_file_marketing_op = client.get_type("MediaFileOperation") - media_file_marketing = media_file_marketing_op.create - media_file_marketing.type_ = client.enums.MediaTypeEnum.IMAGE - media_file_marketing.image.data = marketing_img_bytes - media_file_marketing.mime_type = client.enums.MimeTypeEnum.IMAGE_JPEG - - image_response = media_file_service.mutate_media_files( - customer_id=customer_id, - operations=[media_file_logo_op, media_file_marketing_op], - ) - - image_resource_names = list( - map(lambda response: response.resource_name, image_response.results) - ) - - ad_group_ad_service = client.get_service("AdGroupAdService") - ad_group_service = client.get_service("AdGroupService") - ad_group_ad_op = client.get_type("AdGroupAdOperation") - ad_group_ad = ad_group_ad_op.create - gmail_ad = ad_group_ad.ad.gmail_ad - gmail_ad.teaser.headline = "Dream" - gmail_ad.teaser.description = "Create your own adventure." - gmail_ad.teaser.business_name = "Interplanetary Ships" - gmail_ad.teaser.logo_image = image_resource_names[0] - gmail_ad.marketing_image = image_resource_names[1] - gmail_ad.marketing_image_headline = "Travel" - gmail_ad.marketing_image_description = "Take to the skies!" - - ad_group_ad.ad.final_urls.append("http://www.example.com") - ad_group_ad.ad.name = f"Gmail Ad #{uuid4()}" - - ad_group_ad.status = client.enums.AdGroupAdStatusEnum.PAUSED - ad_group_ad.ad_group = ad_group_service.ad_group_path( - customer_id, ad_group_id - ) - - add_gmail_ad_response = ad_group_ad_service.mutate_ad_group_ads( - customer_id=customer_id, operations=[ad_group_ad_op] - ) - - print(f"Created gmail ad {add_gmail_ad_response.results[0].resource_name}.") - - -def _get_image(url): - """Loads image data from a URL. - - Args: - url: a URL str. - - Returns: - Images bytes loaded from the given URL and content-type as a str. - """ - response = requests.get(url) - headers = response.headers - return response.content, headers["content-type"] - - -if __name__ == "__main__": - # GoogleAdsClient will read the google-ads.yaml configuration file in the - # home directory if none is specified. - googleads_client = GoogleAdsClient.load_from_storage(version="v8") - - parser = argparse.ArgumentParser( - description=( - "Adds a gmail ad to the specified ad group ID, " - "for the given customer ID." - ) - ) - # The following argument(s) should be provided to run the example. - parser.add_argument( - "-c", - "--customer_id", - type=str, - required=True, - help="The Google Ads customer ID.", - ) - parser.add_argument( - "-a", "--ad_group_id", type=str, required=True, help="The ad group ID." - ) - args = parser.parse_args() - - try: - main(googleads_client, args.customer_id, args.ad_group_id) - except GoogleAdsException as ex: - print( - f'Request with ID "{ex.request_id}" failed with status ' - f'"{ex.error.code().name}" and includes the following errors:' - ) - for error in ex.failure.errors: - print(f'\tError with message "{error.message}".') - if error.location: - for field_path_element in error.location.field_path_elements: - print(f"\t\tOn field: {field_path_element.field_name}") - sys.exit(1) diff --git a/examples/advanced_operations/add_local_campaign.py b/examples/advanced_operations/add_local_campaign.py index ebba5bd00..64994aefb 100755 --- a/examples/advanced_operations/add_local_campaign.py +++ b/examples/advanced_operations/add_local_campaign.py @@ -33,7 +33,7 @@ _MARKETING_IMAGE_URL = "https://goo.gl/3b9Wfh" _LOGO_IMAGE_URL = "https://goo.gl/mtt54n" -_YOUTUBE_VIDEO_ID = "t1fDo0VyeEo" +_YOUTUBE_VIDEO_ID = "ECpDzH9gXh8" def main(client, customer_id): diff --git a/examples/advanced_operations/add_smart_campaign.py b/examples/advanced_operations/add_smart_campaign.py index c4284c7c4..3ec5a8751 100755 --- a/examples/advanced_operations/add_smart_campaign.py +++ b/examples/advanced_operations/add_smart_campaign.py @@ -61,12 +61,14 @@ def main( keyword_theme_infos = _map_keyword_theme_constants_to_infos( client, keyword_theme_constants ) + suggestion_info = _get_smart_campaign_suggestion_info( + client, business_location_id, business_name, keyword_theme_infos + ) suggested_budget_amount = _get_budget_suggestion( - client, - customer_id, - business_location_id, - keyword_theme_infos, + client, customer_id, suggestion_info ) + ad_suggestions = _get_ad_suggestions(client, customer_id, suggestion_info) + # [START add_smart_campaign_7] # The below methods create and return MutateOperations that we later # provide to the GoogleAdsService.Mutate method in order to create the @@ -88,7 +90,9 @@ def main( client, customer_id, keyword_theme_infos ) ad_group_operation = _create_ad_group_operation(client, customer_id) - ad_group_ad_operation = _create_ad_group_ad_operation(client, customer_id) + ad_group_ad_operation = _create_ad_group_ad_operation( + client, customer_id, ad_suggestions + ) googleads_service = client.get_service("GoogleAdsService") @@ -146,43 +150,55 @@ def _get_keyword_theme_constants(client, keyword_text): # [END add_smart_campaign] -# [START add_smart_campaign_1] -def _get_budget_suggestion( - client, - customer_id, - business_location_id, - keyword_theme_infos, +def _map_keyword_theme_constants_to_infos(client, keyword_theme_constants): + """Maps a list of KeywordThemeConstants to KeywordThemeInfos. + + Args: + client: an initialized GoogleAdsClient instance. + keyword_theme_constants: a list of KeywordThemeConstants. + + Returns: + a list of KeywordThemeInfos. + """ + infos = [] + for constant in keyword_theme_constants: + info = client.get_type("KeywordThemeInfo") + info.keyword_theme_constant = constant.resource_name + infos.append(info) + + return infos + + +# [START add_smart_campaign_9] +def _get_smart_campaign_suggestion_info( + client, business_location_id, business_name, keyword_theme_infos ): - """Retrieves a suggested budget amount for a new budget. + """Builds a SmartCampaignSuggestionInfo object with business details. - Using the SmartCampaignSuggestService to determine a daily budget for new - and existing Smart campaigns is highly recommended because it helps the - campaigns achieve optimal performance. + The details are used by the SmartCampaignSuggestService to suggest a + budget amount as well as creatives for the ad. + + Note that when retrieving ad creative suggestions it's required that the + "final_url", "language_code" and "keyword_themes" fields are set on the + SmartCampaignSuggestionInfo instance. Args: client: an initialized GoogleAdsClient instance. - customer_id: a client customer ID. business_location_id: the ID of a Google My Business location. + business_name: the name of a Google My Business. keyword_theme_infos: a list of KeywordThemeInfos. Returns: - a daily budget amount in micros. + A SmartCampaignSuggestionInfo instance. """ - sc_suggest_service = client.get_service("SmartCampaignSuggestService") - request = client.get_type("SuggestSmartCampaignBudgetOptionsRequest") - request.customer_id = customer_id - # You can retrieve suggestions for an existing campaign by setting the - # "campaign" field of the request equal to the resource name of a campaign - # and leaving the rest of the request fields below unset: - # request.campaign = INSERT_CAMPAIGN_RESOURCE_NAME_HERE - - # Since these suggestions are for a new campaign, we're going to - # use the suggestion_info field instead. - suggestion_info = request.suggestion_info + suggestion_info = client.get_type("SmartCampaignSuggestionInfo") # Add the URL of the campaign's landing page. suggestion_info.final_url = _LANDING_PAGE_URL + # Add the language code for the campaign. + suggestion_info.language_code = _LANGUAGE_CODE + # Construct location information using the given geo target constant. It's # also possible to provide a geographic proximity using the "proximity" # field on suggestion_info, for example: @@ -212,9 +228,12 @@ def _get_budget_suggestion( # Add the KeywordThemeInfo objects to the SuggestionInfo object. suggestion_info.keyword_themes.extend(keyword_theme_infos) - # If provided, add the GMB location ID. + # Set either of the business_location_id or business_name, depending on + # whichever is provided. if business_location_id: suggestion_info.business_location_id = business_location_id + else: + suggestion_info.business_context.business_name = business_name # Add a schedule detailing which days of the week the business is open. # This schedule describes a schedule in which the business is open on @@ -232,6 +251,39 @@ def _get_budget_suggestion( ad_schedule_info.end_minute = zero_minute_of_hour suggestion_info.ad_schedules.append(ad_schedule_info) + return suggestion_info + # [END add_smart_campaign_9] + + +# [START add_smart_campaign_1] +def _get_budget_suggestion(client, customer_id, suggestion_info): + """Retrieves a suggested budget amount for a new budget. + + Using the SmartCampaignSuggestService to determine a daily budget for new + and existing Smart campaigns is highly recommended because it helps the + campaigns achieve optimal performance. + + Args: + client: an initialized GoogleAdsClient instance. + customer_id: a client customer ID. + suggestion_info: a SmartCampaignSuggestionInfo instance with details + about the business being advertised. + + Returns: + a daily budget amount in micros. + """ + sc_suggest_service = client.get_service("SmartCampaignSuggestService") + request = client.get_type("SuggestSmartCampaignBudgetOptionsRequest") + request.customer_id = customer_id + # You can retrieve suggestions for an existing campaign by setting the + # "campaign" field of the request equal to the resource name of a campaign + # and leaving the rest of the request fields below unset: + # request.campaign = INSERT_CAMPAIGN_RESOURCE_NAME_HERE + + # Since these suggestions are for a new campaign, we're going to + # use the suggestion_info field instead. + request.suggestion_info = suggestion_info + # Issue a request to retrieve a budget suggestion. response = sc_suggest_service.suggest_smart_campaign_budget_options( request=request @@ -252,23 +304,51 @@ def _get_budget_suggestion( # [END add_smart_campaign_1] -def _map_keyword_theme_constants_to_infos(client, keyword_theme_constants): - """Maps a list of KeywordThemeConstants to KeywordThemeInfos. +# [START add_smart_campaign_10] +def _get_ad_suggestions(client, customer_id, suggestion_info): + """Retrieves creative suggestions for a Smart campaign ad. + + Using the SmartCampaignSuggestService to suggest creatives for new and + existing Smart campaigns is highly recommended because it helps the + campaigns achieve optimal performance. Args: client: an initialized GoogleAdsClient instance. - keyword_theme_constants: a list of KeywordThemeConstants. + customer_id: a client customer ID. + suggestion_info: a SmartCampaignSuggestionInfo instance with details + about the business being advertised. Returns: - a list of KeywordThemeInfos. + a SmartCampaignAdInfo instance with suggested headlines and + descriptions. """ - infos = [] - for constant in keyword_theme_constants: - info = client.get_type("KeywordThemeInfo") - info.keyword_theme_constant = constant.resource_name - infos.append(info) + sc_suggest_service = client.get_service("SmartCampaignSuggestService") + request = client.get_type("SuggestSmartCampaignAdRequest") + request.customer_id = customer_id - return infos + # Unlike the SuggestSmartCampaignBudgetOptions method, it's only possible + # to use suggestion_info to retrieve ad creative suggestions. + request.suggestion_info = suggestion_info + + # Issue a request to retrieve ad creative suggestions. + response = sc_suggest_service.suggest_smart_campaign_ad(request=request) + + # The SmartCampaignAdInfo object in the response contains a list of up to + # three headlines and two descriptions. Note that some of the suggestions + # may have empty strings as text. Before setting these on the ad you should + # review them and filter out any empty values. + ad_suggestions = response.ad_info + + print("The following headlines were suggested:") + for headline in ad_suggestions.headlines: + print(f"\t{headline.text or ''}") + + print("And the following descriptions were suggested:") + for description in ad_suggestions.descriptions: + print(f"\t{description.text or ''}") + + return ad_suggestions + # [END add_smart_campaign_10] # [START add_smart_campaign_2] @@ -483,7 +563,7 @@ def _create_ad_group_operation(client, customer_id): # [START add_smart_campaign_6] -def _create_ad_group_ad_operation(client, customer_id): +def _create_ad_group_ad_operation(client, customer_id, ad_suggestions): """Creates a MutateOperation that creates a new ad group ad. A temporary ID will be used in the ad group resource name for this @@ -492,6 +572,8 @@ def _create_ad_group_ad_operation(client, customer_id): Args: client: an initialized GoogleAdsClient instance. customer_id: a client customer ID. + ad_suggestions: a SmartCampaignAdInfo object with ad creative + suggestions. Returns: a MutateOperation that creates a new ad group ad. @@ -505,20 +587,19 @@ def _create_ad_group_ad_operation(client, customer_id): # Set the type to SMART_CAMPAIGN_AD. ad_group_ad.ad.type_ = client.enums.AdTypeEnum.SMART_CAMPAIGN_AD ad = ad_group_ad.ad.smart_campaign_ad - # At most, three headlines can be specified for a Smart campaign ad. - headline_1 = client.get_type("AdTextAsset") - headline_1.text = "Headline number one" - headline_2 = client.get_type("AdTextAsset") - headline_2.text = "Headline number two" - headline_3 = client.get_type("AdTextAsset") - headline_3.text = "Headline number three" - ad.headlines.extend([headline_1, headline_2, headline_3]) - # At most, two descriptions can be specified for a Smart campaign ad. - description_1 = client.get_type("AdTextAsset") - description_1.text = "Description number one" - description_2 = client.get_type("AdTextAsset") - description_2.text = "Description number two" - ad.descriptions.extend([description_1, description_2]) + + # The SmartCampaignAdInfo object includes headlines and descriptions + # retrieved from the SmartCampaignSuggestService.SuggestSmartCampaignAd + # method. It's recommended that users review and approve or update these + # creatives before they're set on the ad. It's possible that some or all of + # these assets may contain empty texts, which should not be set on the ad + # and instead should be replaced with meaninful texts from the user. Below + # we just accept the creatives that were suggested while filtering out empty + # assets, but individual workflows will vary here. + ad.headlines = [asset for asset in ad_suggestions.headlines if asset.text] + ad.descriptions = [ + asset for asset in ad_suggestions.descriptions if asset.text + ] return mutate_operation # [END add_smart_campaign_6] diff --git a/examples/billing/get_invoices.py b/examples/billing/get_invoices.py index 2ed69a7c2..74566d7a0 100755 --- a/examples/billing/get_invoices.py +++ b/examples/billing/get_invoices.py @@ -107,7 +107,7 @@ def _micros_to_currency(micros): if __name__ == "__main__": # GoogleAdsClient will read the google-ads.yaml configuration file in the # home directory if none is specified. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") parser = argparse.ArgumentParser( description="Retrieves the invoices issued last month for a given billing setup." diff --git a/examples/extensions/add_affiliate_location_extensions.py b/examples/extensions/add_affiliate_location_extensions.py index 62f303759..312d4e2f3 100644 --- a/examples/extensions/add_affiliate_location_extensions.py +++ b/examples/extensions/add_affiliate_location_extensions.py @@ -366,7 +366,7 @@ def _create_campaign_feed( """ # Get the CampaignFeedService. campaign_feed_service = client.get_service("CampaignFeedService") - feed_service = client.get_service("FeedService", versions="v6") + feed_service = client.get_service("FeedService") attribute_id_for_chain_id = _get_attribute_id_for_chain_id( client, feed_mapping @@ -390,10 +390,8 @@ def _create_campaign_feed( "CampaignService" ).campaign_path(customer_id, campaign_id) - mutate_campaign_feeds_response = ( - campaign_feed_service.mutate_campaign_feeds( - customer_id=customer_id, operations=[campaign_feed_operation] - ) + mutate_campaign_feeds_response = campaign_feed_service.mutate_campaign_feeds( + customer_id=customer_id, operations=[campaign_feed_operation] ) # Display the result. @@ -468,10 +466,7 @@ def _get_attribute_id_for_chain_id(client, feed_mapping): try: main( - googleads_client, - args.customer_id, - args.chain_id, - args.campaign_id, + googleads_client, args.customer_id, args.chain_id, args.campaign_id, ) except GoogleAdsException as ex: print( diff --git a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_1.py b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_1.py index ec60d5c66..2625d1874 100755 --- a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_1.py +++ b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_1.py @@ -127,9 +127,7 @@ def _create_campaign(client, budget_id): # the ads from immediately serving. Set to ENABLED once you've added # targeting and the ads are ready to serve. "status": "PAUSED", - "biddingStrategyConfiguration": { - "biddingStrategyType": "MANUAL_CPC", - }, + "biddingStrategyConfiguration": {"biddingStrategyType": "MANUAL_CPC",}, "startDate": (datetime.datetime.now() + datetime.timedelta(1)).strftime( "%Y%m%d" ), @@ -289,7 +287,7 @@ def _handle_googleads_exception(exception): if __name__ == "__main__": # Initialize client object. # It will read the config file. The default file path is the Home Directory. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") adwords_client = adwords.AdWordsClient.LoadFromStorage() parser = argparse.ArgumentParser( diff --git a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_2.py b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_2.py index e8fdd43d5..0dcdf8092 100755 --- a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_2.py +++ b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_2.py @@ -327,7 +327,7 @@ def _handle_googleads_exception(exception): if __name__ == "__main__": # Initialize client object. # It will read the config file. The default file path is the Home Directory. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") adwords_client = adwords.AdWordsClient.LoadFromStorage() parser = argparse.ArgumentParser( diff --git a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_3.py b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_3.py index 4e7701905..e7952985b 100755 --- a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_3.py +++ b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_3.py @@ -355,7 +355,7 @@ def _handle_googleads_exception(exception): if __name__ == "__main__": # Initialize client object. # It will read the config file. The default file path is the Home Directory. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") adwords_client = adwords.AdWordsClient.LoadFromStorage() parser = argparse.ArgumentParser( diff --git a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_4.py b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_4.py index aeaf724cf..48f566e96 100755 --- a/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_4.py +++ b/examples/migration/campaign_management/create_complete_campaign_both_apis_phase_4.py @@ -417,7 +417,7 @@ def _handle_googleads_exception(exception): if __name__ == "__main__": # Initialize client object. # It will read the config file. The default file path is the Home Directory. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") adwords_client = adwords.AdWordsClient.LoadFromStorage() parser = argparse.ArgumentParser( diff --git a/examples/migration/campaign_management/create_complete_campaign_googleads_api_only.py b/examples/migration/campaign_management/create_complete_campaign_googleads_api_only.py index 38c01e0b4..3ca77fd02 100755 --- a/examples/migration/campaign_management/create_complete_campaign_googleads_api_only.py +++ b/examples/migration/campaign_management/create_complete_campaign_googleads_api_only.py @@ -384,11 +384,8 @@ def _create_keywords(client, customer_id, ad_group, keywords_to_add): ad_group_criterion_operations.append(operation) try: - ad_group_criterion_response = ( - ad_group_criterion_service.mutate_ad_group_criteria( - customer_id=customer_id, - operations=ad_group_criterion_operations, - ) + ad_group_criterion_response = ad_group_criterion_service.mutate_ad_group_criteria( + customer_id=customer_id, operations=ad_group_criterion_operations, ) new_ad_resource_names = [ row.resource_name for row in ad_group_criterion_response.results @@ -474,7 +471,7 @@ def _handle_googleads_exception(exception): if __name__ == "__main__": # Initialize client object. # It will read the config file. The default file path is the Home Directory. - googleads_client = GoogleAdsClient.load_from_storage(version="v6") + googleads_client = GoogleAdsClient.load_from_storage(version="v8") parser = argparse.ArgumentParser( description="Lists all campaigns for specified customer." diff --git a/examples/migration/campaign_report_to_csv.py b/examples/migration/campaign_report_to_csv.py index 58cabfffb..4d9a35037 100644 --- a/examples/migration/campaign_report_to_csv.py +++ b/examples/migration/campaign_report_to_csv.py @@ -30,11 +30,15 @@ import argparse import csv import sys +import os from google.ads.googleads.client import GoogleAdsClient from google.ads.googleads.errors import GoogleAdsException +_DEFAULT_FILE_NAME = "campaign_report_to_csv_results.csv" + + def main(client, customer_id, output_file, write_headers): """Writes rows returned from a search_stream request to a CSV file. Args: @@ -43,6 +47,8 @@ def main(client, customer_id, output_file, write_headers): output_file (str): Filename of the file to write the report data to. write_headers (bool): From argparse, True if arg is provided. """ + file_dir = os.path.dirname(os.path.abspath(__file__)) + file_path = os.path.join(file_dir, output_file) ga_service = client.get_service("GoogleAdsService") query = """ @@ -65,7 +71,7 @@ def main(client, customer_id, output_file, write_headers): search_request.query = query response = ga_service.search_stream(search_request) try: - with open(output_file, "w", newline="") as f: + with open(file_path, "w", newline="") as f: writer = csv.writer(f) # Define a list of headers for the first row. @@ -133,7 +139,8 @@ def main(client, customer_id, output_file, write_headers): "-o", "--output_file", type=str, - required=True, + required=False, + default=_DEFAULT_FILE_NAME, help="Name of the local CSV file to save the report to. File will be " "saved in the same directory as the script.", ) diff --git a/examples/remarketing/add_flights_feed.py b/examples/remarketing/add_flights_feed.py index 039f55567..804b5d052 100755 --- a/examples/remarketing/add_flights_feed.py +++ b/examples/remarketing/add_flights_feed.py @@ -177,35 +177,35 @@ def _create_feed_mapping( # Maps the feed attribute IDs to the field ID constants. placeholder_field_enum = client.enums.FlightPlaceholderFieldEnum flight_desc_enum_value = placeholder_field_enum.FLIGHT_DESCRIPTION - desc_mapping = client.get_type("AttributeFieldMapping", "v6") + desc_mapping = client.get_type("AttributeFieldMapping") desc_mapping.feed_attribute_id = placeholders_to_feed_attribute_map[ flight_desc_enum_value ].id desc_mapping.flight_field = flight_desc_enum_value flight_dest_id_enum_value = placeholder_field_enum.DESTINATION_ID - dest_id_mapping = client.get_type("AttributeFieldMapping", "v6") + dest_id_mapping = client.get_type("AttributeFieldMapping") dest_id_mapping.feed_attribute_id = placeholders_to_feed_attribute_map[ flight_dest_id_enum_value ].id dest_id_mapping.flight_field = flight_dest_id_enum_value flight_price_enum_value = placeholder_field_enum.FLIGHT_PRICE - price_mapping = client.get_type("AttributeFieldMapping", "v6") + price_mapping = client.get_type("AttributeFieldMapping") price_mapping.feed_attribute_id = placeholders_to_feed_attribute_map[ flight_price_enum_value ].id price_mapping.flight_field = flight_price_enum_value flight_sale_price_enum_value = placeholder_field_enum.FLIGHT_SALE_PRICE - sale_price_mapping = client.get_type("AttributeFieldMapping", "v6") + sale_price_mapping = client.get_type("AttributeFieldMapping") sale_price_mapping.feed_attribute_id = placeholders_to_feed_attribute_map[ flight_sale_price_enum_value ].id sale_price_mapping.flight_field = flight_sale_price_enum_value flight_final_urls_enum_value = placeholder_field_enum.FINAL_URLS - final_urls_mapping = client.get_type("AttributeFieldMapping", "v6") + final_urls_mapping = client.get_type("AttributeFieldMapping") final_urls_mapping.feed_attribute_id = placeholders_to_feed_attribute_map[ flight_final_urls_enum_value ].id diff --git a/google/ads/googleads/__init__.py b/google/ads/googleads/__init__.py index 40876bc82..4f350f09a 100644 --- a/google/ads/googleads/__init__.py +++ b/google/ads/googleads/__init__.py @@ -18,4 +18,4 @@ import google.ads.googleads.util -VERSION = "13.0.0" +VERSION = "14.0.0" diff --git a/google/ads/googleads/client.py b/google/ads/googleads/client.py index cfaebad3b..9d66d6505 100644 --- a/google/ads/googleads/client.py +++ b/google/ads/googleads/client.py @@ -16,7 +16,6 @@ from importlib import import_module import logging.config -from google.protobuf.message import Message as NativeMessageType import grpc.experimental import proto from proto.enums import ProtoEnumMeta @@ -33,7 +32,7 @@ _SERVICE_CLIENT_TEMPLATE = "{}Client" -_VALID_API_VERSIONS = ["v8", "v7", "v6"] +_VALID_API_VERSIONS = ["v8", "v7"] _DEFAULT_VERSION = _VALID_API_VERSIONS[0] # See options at grpc.github.io/grpc/core/group__grpc__arg__keys.html @@ -68,6 +67,7 @@ def __init__(self, client): self._client = client self._version = client.version or _DEFAULT_VERSION self._enums = None + self._use_proto_plus = client.use_proto_plus def __dir__(self): """Overrides behavior when dir() is called on instances of this class. @@ -98,10 +98,14 @@ def __getattr__(self, name): ) try: enum_class = self._client.get_type(name) - for attr in dir(enum_class): - attr_val = getattr(enum_class, attr) - if isinstance(attr_val, ProtoEnumMeta): - return attr_val + + if self._use_proto_plus == True: + for attr in dir(enum_class): + attr_val = getattr(enum_class, attr) + if isinstance(attr_val, ProtoEnumMeta): + return attr_val + else: + return enum_class except ValueError: raise AttributeError( f"'{type(self).__name__}' object has no attribute '{name}'" @@ -137,33 +141,17 @@ class GoogleAdsClient: @classmethod def copy_from(cls, destination, origin): - """A convenience method that wraps native CopyFrom methods. + """Copies protobuf and proto-plus messages into one-another. - This method consolidates the CopyFrom logic of native and proto-plus - wrapped protobuf messages into a single helper method. + This method consolidates the CopyFrom logic of protobuf and proto-plus + messages into a single helper method. The destination message will be + updated with the exact state of the origin message. Args: - destination: The protobuf message where changes are being copied. - origin: The protobuf message where changes are being copied from. + destination: The message where changes are being copied. + origin: The message where changes are being copied from. """ - is_dest_wrapped = isinstance(destination, proto.Message) - is_orig_wrapped = isinstance(origin, proto.Message) - is_dest_native = isinstance(destination, NativeMessageType) - is_orig_native = isinstance(origin, NativeMessageType) - - if is_dest_wrapped and is_orig_wrapped: - proto.Message.copy_from(destination, origin) - elif is_dest_native and is_orig_native: - destination.CopyFrom(origin) - elif is_dest_wrapped and is_orig_native: - proto.Message.copy_from(destination, type(destination)(origin)) - elif is_dest_native and is_orig_wrapped: - destination.CopyFrom(type(origin).pb(origin)) - else: - raise ValueError( - "Only protobuf message instances can be used for copying. " - f"A {type(destination)} and a {type(origin)} were given." - ) + return util.proto_copy_from(destination, origin) @classmethod def _get_client_kwargs(cls, config_data): @@ -187,6 +175,7 @@ def _get_client_kwargs(cls, config_data): "logging_config": config_data.get("logging"), "linked_customer_id": config_data.get("linked_customer_id"), "http_proxy": config_data.get("http_proxy"), + "use_proto_plus": config_data.get("use_proto_plus"), } @classmethod @@ -300,6 +289,7 @@ def __init__( linked_customer_id=None, version=None, http_proxy=None, + use_proto_plus=False, ): """Initializer for the GoogleAdsClient. @@ -322,8 +312,9 @@ def __init__( self.login_customer_id = login_customer_id self.linked_customer_id = linked_customer_id self.version = version - self.enums = _EnumGetter(self) self.http_proxy = http_proxy + self.use_proto_plus = use_proto_plus + self.enums = _EnumGetter(self) # If given, write the http_proxy channel option for GRPC to use if http_proxy: @@ -385,7 +376,7 @@ def get_service(self, name, version=_DEFAULT_VERSION, interceptors=None): self.linked_customer_id, ), LoggingInterceptor(_logger, version, endpoint), - ExceptionInterceptor(version), + ExceptionInterceptor(version, use_proto_plus=self.use_proto_plus), ] channel = grpc.intercept_channel(channel, *interceptors) @@ -439,4 +430,7 @@ def get_type(self, name, version=_DEFAULT_VERSION): f"Google Ads API {version}" ) - return message_class() + if self.use_proto_plus == True: + return message_class() + else: + return util.convert_proto_plus_to_protobuf(message_class()) diff --git a/google/ads/googleads/config.py b/google/ads/googleads/config.py index 10bbb3b3e..409bb580c 100644 --- a/google/ads/googleads/config.py +++ b/google/ads/googleads/config.py @@ -13,6 +13,7 @@ # limitations under the License. """A set of functions to help load configuration from various locations.""" +from distutils.util import strtobool import functools import json import logging.config @@ -25,7 +26,7 @@ _ENV_PREFIX = "GOOGLE_ADS_" -_REQUIRED_KEYS = ("developer_token",) +_REQUIRED_KEYS = ("developer_token", "use_proto_plus") _OPTIONAL_KEYS = ( "login_customer_id", "endpoint", @@ -140,6 +141,16 @@ def parser_wrapper(*args, **kwargs): del parsed_config["delegated_account"] + if "use_proto_plus" in config_keys: + # When loaded from YAML, YAML string or a dict, this value is + # evaluated as a bool. If it's loaded from an environment variable + # it's evaluated as a string. If set to "False" as an environment + # variable we need to manually change it to the bool False because + # the string "False" is truthy and can easily be incorrectly + # converted to the boolean True. + value = parsed_config.get("use_proto_plus", False) + parsed_config["use_proto_plus"] = disambiguate_string_bool(value) + return parsed_config return parser_wrapper @@ -159,6 +170,15 @@ def validate_dict(config_data): Raises: ValueError: If the dict does not contain all required config keys. """ + if not "use_proto_plus" in config_data.keys(): + raise ValueError( + "The client library configuration is missing the required " + '"use_proto_plus" key. Please set this option to either "True" ' + 'or "False". For more information about this option see the ' + "Protobuf Messages guide: " + "https://developers.google.com/google-ads/api/docs/client-libs/python/protobuf-messages" + ) + if not all(key in config_data for key in _REQUIRED_KEYS): raise ValueError( "A required field in the configuration data was not " @@ -379,3 +399,33 @@ def convert_linked_customer_id_to_str(config_data): config_data["linked_customer_id"] = str(linked_customer_id) return config_data + + +def disambiguate_string_bool(value): + """Converts a stringified boolean to its bool representation. + + Args: + value: A boolean or a string representing a boolean. + + Returns: + A boolean. + + Raises: + TypeError: If the string is not a valid boolean representation. + """ + if isinstance(value, bool): + return value + elif isinstance(value, str): + try: + return bool(strtobool(value)) + except ValueError: + raise ValueError( + 'The "use_proto_plus" configuration key value should be' + f'explicitly set to "True" or "False" but "{value}" ' + "was given." + ) + else: + raise TypeError( + 'The "use_proto_plus" configuration key is invalid. Expected ' + f"Union[bool, str] but received {type(value)}" + ) diff --git a/google/ads/googleads/interceptors/exception_interceptor.py b/google/ads/googleads/interceptors/exception_interceptor.py index db8ef28ea..97e8b6426 100644 --- a/google/ads/googleads/interceptors/exception_interceptor.py +++ b/google/ads/googleads/interceptors/exception_interceptor.py @@ -24,80 +24,7 @@ from grpc import UnaryUnaryClientInterceptor, UnaryStreamClientInterceptor from .interceptor import Interceptor - - -class _UnaryStreamWrapper(grpc.Call, grpc.Future): - def __init__(self, underlay_call, failure_handler): - super().__init__() - self._underlay_call = underlay_call - self._failure_handler = failure_handler - self._exception = None - - def initial_metadata(self): - return self._underlay_call.initial_metadata() - - def trailing_metadata(self): - return self._underlay_call.initial_metadata() - - def code(self): - return self._underlay_call.code() - - def details(self): - return self._underlay_call.details() - - def debug_error_string(self): - return self._underlay_call.debug_error_string() - - def cancelled(self): - return self._underlay_call.cancelled() - - def running(self): - return self._underlay_call.running() - - def done(self): - return self._underlay_call.done() - - def result(self, timeout=None): - return self._underlay_call.result(timeout=timeout) - - def exception(self, timeout=None): - if self._exception: - return self._exception - else: - return self._underlay_call.exception(timeout=timeout) - - def traceback(self, timeout=None): - return self._underlay_call.traceback(timeout=timeout) - - def add_done_callback(self, fn): - return self._underlay_call.add_done_callback(fn) - - def add_callback(self, callback): - return self._underlay_call.add_callback(callback) - - def is_active(self): - return self._underlay_call.is_active() - - def time_remaining(self): - return self._underlay_call.time_remaining() - - def cancel(self): - return self._underlay_call.cancel() - - def __iter__(self): - return self - - def __next__(self): - try: - return next(self._underlay_call) - except StopIteration: - raise - except Exception: - try: - self._failure_handler(self._underlay_call) - except Exception as e: - self._exception = e - raise e +from .response_wrappers import _UnaryStreamWrapper, _UnaryUnaryWrapper class ExceptionInterceptor( @@ -105,14 +32,17 @@ class ExceptionInterceptor( ): """An interceptor that wraps rpc exceptions.""" - def __init__(self, api_version): + def __init__(self, api_version, use_proto_plus=False): """Initializes the ExceptionInterceptor. Args: api_version: a str of the API version of the request. + use_proto_plus: a boolean of whether returned messages should be + proto_plus or protobuf. """ super().__init__(api_version) self._api_version = api_version + self._use_proto_plus = use_proto_plus def _handle_grpc_failure(self, response): """Attempts to convert failed responses to a GoogleAdsException object. @@ -168,7 +98,9 @@ def intercept_unary_unary(self, continuation, client_call_details, request): if exception: self._handle_grpc_failure(response) else: - return response + return _UnaryUnaryWrapper( + response, use_proto_plus=self._use_proto_plus + ) def intercept_unary_stream( self, continuation, client_call_details, request @@ -195,4 +127,8 @@ def intercept_unary_stream( status code of INTERNAL or RESOURCE_EXHAUSTED. """ response = continuation(client_call_details, request) - return _UnaryStreamWrapper(response, self._handle_grpc_failure) + return _UnaryStreamWrapper( + response, + self._handle_grpc_failure, + use_proto_plus=self._use_proto_plus, + ) diff --git a/google/ads/googleads/interceptors/logging_interceptor.py b/google/ads/googleads/interceptors/logging_interceptor.py index 058bc2974..d57cfaeec 100644 --- a/google/ads/googleads/interceptors/logging_interceptor.py +++ b/google/ads/googleads/interceptors/logging_interceptor.py @@ -26,7 +26,12 @@ from grpc import UnaryUnaryClientInterceptor, UnaryStreamClientInterceptor from .interceptor import Interceptor -from ..util import set_nested_message_field, get_nested_attr +from ..util import ( + set_nested_message_field, + get_nested_attr, + convert_proto_plus_to_protobuf, + proto_copy_from, +) # The keys in this dict represent messages that have fields that may contain # sensitive information, such as PII like an email address, that shouldn't @@ -457,8 +462,14 @@ def _mask_google_ads_search_response(message, mask): for row in copy.results: # Each row is an instance of GoogleAdsRow. The ListFields method # returns a list of (FieldDescriptor, value) tuples for all fields in - # the message which are not empty - row_fields = row._pb.ListFields() + # the message which are not empty. If this message is a proto_plus proto + # then we need to access the natve proto to call ListFields. If it's + # not proto_plus we can assume it's protobuf and can access ListFields + # directly. + if hasattr(row, "_pb"): + row_fields = convert_proto_plus_to_protobuf(row).ListFields() + else: + row_fields = row.ListFields() for field in row_fields: field_descriptor = field[0] # field_name is the name of the field on the GoogleAdsRow instance, @@ -476,7 +487,7 @@ def _mask_google_ads_search_response(message, mask): ) # Overwrites the nested message with an exact copy of itself, # where sensitive fields have been masked. - setattr(row, field_name, masked_message) + proto_copy_from(getattr(row, field_name), masked_message) return copy diff --git a/google/ads/googleads/interceptors/response_wrappers.py b/google/ads/googleads/interceptors/response_wrappers.py new file mode 100644 index 000000000..e7909d523 --- /dev/null +++ b/google/ads/googleads/interceptors/response_wrappers.py @@ -0,0 +1,169 @@ +# Copyright 2021 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. +"""Wrapper classes used to modify the behavior of response objects.""" + +import grpc + +from google.ads.googleads import util + + +class _UnaryStreamWrapper(grpc.Call, grpc.Future): + def __init__(self, underlay_call, failure_handler, use_proto_plus=False): + super().__init__() + self._underlay_call = underlay_call + self._failure_handler = failure_handler + self._exception = None + self._use_proto_plus = use_proto_plus + + def initial_metadata(self): + return self._underlay_call.initial_metadata() + + def trailing_metadata(self): + return self._underlay_call.initial_metadata() + + def code(self): + return self._underlay_call.code() + + def details(self): + return self._underlay_call.details() + + def debug_error_string(self): + return self._underlay_call.debug_error_string() + + def cancelled(self): + return self._underlay_call.cancelled() + + def running(self): + return self._underlay_call.running() + + def done(self): + return self._underlay_call.done() + + def result(self, timeout=None): + return self._underlay_call.result(timeout=timeout) + + def exception(self, timeout=None): + if self._exception: + return self._exception + else: + return self._underlay_call.exception(timeout=timeout) + + def traceback(self, timeout=None): + return self._underlay_call.traceback(timeout=timeout) + + def add_done_callback(self, fn): + return self._underlay_call.add_done_callback(fn) + + def add_callback(self, callback): + return self._underlay_call.add_callback(callback) + + def is_active(self): + return self._underlay_call.is_active() + + def time_remaining(self): + return self._underlay_call.time_remaining() + + def cancel(self): + return self._underlay_call.cancel() + + def __iter__(self): + return self + + def __next__(self): + try: + message = next(self._underlay_call) + if self._use_proto_plus == True: + # By default this message is wrapped by proto-plus + return message + else: + return util.convert_proto_plus_to_protobuf(message) + except StopIteration: + raise + except Exception: + try: + self._failure_handler(self._underlay_call) + except Exception as e: + self._exception = e + raise e + + +class _UnaryUnaryWrapper(grpc.Call, grpc.Future): + def __init__(self, underlay_call, use_proto_plus=False): + super().__init__() + self._underlay_call = underlay_call + self._use_proto_plus = use_proto_plus + + def initial_metadata(self): + return self._underlay_call.initial_metadata() + + def trailing_metadata(self): + return self._underlay_call.initial_metadata() + + def code(self): + return self._underlay_call.code() + + def details(self): + return self._underlay_call.details() + + def debug_error_string(self): + return self._underlay_call.debug_error_string() + + def cancelled(self): + return self._underlay_call.cancelled() + + def running(self): + return self._underlay_call.running() + + def done(self): + return self._underlay_call.done() + + def result(self, timeout=None): + message = self._underlay_call.result() + if self._use_proto_plus == True: + return message + else: + return util.convert_proto_plus_to_protobuf(message) + + def exception(self, timeout=None): + if self._exception: + return self._exception + else: + return self._underlay_call.exception(timeout=timeout) + + def traceback(self, timeout=None): + return self._underlay_call.traceback(timeout=timeout) + + def add_done_callback(self, fn): + return self._underlay_call.add_done_callback(fn) + + def add_callback(self, callback): + return self._underlay_call.add_callback(callback) + + def is_active(self): + return self._underlay_call.is_active() + + def time_remaining(self): + return self._underlay_call.time_remaining() + + def cancel(self): + return self._underlay_call.cancel() + + def __iter__(self): + if self._use_proto_plus == True: + return self + else: + return util.convert_proto_plus_to_protobuf(self) + + def __next__(self): + return next(self._underlay_call) diff --git a/google/ads/googleads/util.py b/google/ads/googleads/util.py index c3bfd2398..32008153f 100644 --- a/google/ads/googleads/util.py +++ b/google/ads/googleads/util.py @@ -16,6 +16,9 @@ import functools import re +from google.protobuf.message import Message as ProtobufMessageType +import proto + # This regex matches characters preceded by start of line or an underscore. _RE_FIND_CHARS_TO_UPPERCASE = re.compile(r"(?:_|^)([a-z])") @@ -122,3 +125,72 @@ def converter(match): return match.group().replace("_", "").upper() return _RE_FIND_CHARS_TO_UPPERCASE.sub(converter, string) + + +def convert_proto_plus_to_protobuf(message): + """Converts a proto-plus message to its protobuf counterpart. + + Args: + message: an instance of proto.Message + + Returns: + The protobuf version of the proto_plus proto. + """ + if isinstance(message, proto.Message): + return type(message).pb(message) + elif isinstance(message, ProtobufMessageType): + return message + else: + raise TypeError( + f"Cannot convert type {type(message)} to protobuf protobuf." + ) + + +def convert_protobuf_to_proto_plus(message): + """Converts a protobuf message to a proto-plus message. + + Args: + message: an instance of google.protobuf.message.Message + + Returns: + A proto_plus version of the protobuf proto. + """ + if isinstance(message, ProtobufMessageType): + return proto.Message.wrap(message) + elif isinstance(message, proto.Message): + return message + else: + raise TypeError( + f"Cannot convert type {type(message)} to a proto_plus protobuf." + ) + + +def proto_copy_from(destination, origin): + """Copies protobuf and proto-plus messages into one-another. + + This method consolidates the CopyFrom logic of protobuf and proto-plus + messages into a single helper method. The destination message will be + updated with the exact state of the origin message. + + Args: + destination: The protobuf message where changes are being copied. + origin: The protobuf message where changes are being copied from. + """ + is_dest_proto_plus = isinstance(destination, proto.Message) + is_orig_proto_plus = isinstance(origin, proto.Message) + is_dest_protobuf = isinstance(destination, ProtobufMessageType) + is_orig_protobuf = isinstance(origin, ProtobufMessageType) + + if is_dest_proto_plus and is_orig_proto_plus: + proto.Message.copy_from(destination, origin) + elif is_dest_protobuf and is_orig_protobuf: + destination.CopyFrom(origin) + elif is_dest_proto_plus and is_orig_protobuf: + proto.Message.copy_from(destination, type(destination)(origin)) + elif is_dest_protobuf and is_orig_proto_plus: + destination.CopyFrom(type(origin).pb(origin)) + else: + raise ValueError( + "Only protobuf message instances can be used for copying. " + f"A {type(destination)} and a {type(origin)} were given." + ) diff --git a/google/ads/googleads/v6/__init__.py b/google/ads/googleads/v6/__init__.py deleted file mode 100644 index b511d1a0a..000000000 --- a/google/ads/googleads/v6/__init__.py +++ /dev/null @@ -1,1588 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - - -import importlib -import sys - - -if sys.version_info < (3, 7): - raise ImportError("This module requires Python 3.7 or later.") - - -_lazy_type_to_package_map = { - # Message types - "AdAssetPolicySummary": "google.ads.googleads.v6.common.types.asset_policy", - "AddressInfo": "google.ads.googleads.v6.common.types.criteria", - "AdImageAsset": "google.ads.googleads.v6.common.types.ad_asset", - "AdMediaBundleAsset": "google.ads.googleads.v6.common.types.ad_asset", - "AdScheduleInfo": "google.ads.googleads.v6.common.types.criteria", - "AdTextAsset": "google.ads.googleads.v6.common.types.ad_asset", - "AdVideoAsset": "google.ads.googleads.v6.common.types.ad_asset", - "AffiliateLocationFeedItem": "google.ads.googleads.v6.common.types.extensions", - "AgeRangeInfo": "google.ads.googleads.v6.common.types.criteria", - "AppAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "AppEngagementAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "AppFeedItem": "google.ads.googleads.v6.common.types.extensions", - "AppPaymentModelInfo": "google.ads.googleads.v6.common.types.criteria", - "BasicUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "BidModifierSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "BidModifierSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "BookOnGoogleAsset": "google.ads.googleads.v6.common.types.asset_types", - "BudgetCampaignAssociationStatus": "google.ads.googleads.v6.common.types.segments", - "BusinessNameFilter": "google.ads.googleads.v6.common.types.feed_item_set_filter_type_infos", - "CallFeedItem": "google.ads.googleads.v6.common.types.extensions", - "CallOnlyAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "CalloutFeedItem": "google.ads.googleads.v6.common.types.extensions", - "CarrierInfo": "google.ads.googleads.v6.common.types.criteria", - "ClickLocation": "google.ads.googleads.v6.common.types.click_location", - "CombinedAudienceInfo": "google.ads.googleads.v6.common.types.criteria", - "CombinedRuleUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "Commission": "google.ads.googleads.v6.common.types.bidding", - "ContentLabelInfo": "google.ads.googleads.v6.common.types.criteria", - "CpcBidSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "CpcBidSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "CpvBidSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "CpvBidSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "CriterionCategoryAvailability": "google.ads.googleads.v6.common.types.criterion_category_availability", - "CriterionCategoryChannelAvailability": "google.ads.googleads.v6.common.types.criterion_category_availability", - "CriterionCategoryLocaleAvailability": "google.ads.googleads.v6.common.types.criterion_category_availability", - "CrmBasedUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "CustomAffinityInfo": "google.ads.googleads.v6.common.types.criteria", - "CustomAudienceInfo": "google.ads.googleads.v6.common.types.criteria", - "CustomerMatchUserListMetadata": "google.ads.googleads.v6.common.types.offline_user_data", - "CustomIntentInfo": "google.ads.googleads.v6.common.types.criteria", - "CustomParameter": "google.ads.googleads.v6.common.types.custom_parameter", - "DateRange": "google.ads.googleads.v6.common.types.dates", - "DateSpecificRuleUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "DeviceInfo": "google.ads.googleads.v6.common.types.criteria", - "DisplayCallToAction": "google.ads.googleads.v6.common.types.ad_type_infos", - "DisplayUploadAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "DynamicAffiliateLocationSetFilter": "google.ads.googleads.v6.common.types.feed_item_set_filter_type_infos", - "DynamicLocationSetFilter": "google.ads.googleads.v6.common.types.feed_item_set_filter_type_infos", - "EnhancedCpc": "google.ads.googleads.v6.common.types.bidding", - "ExpandedDynamicSearchAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ExpandedTextAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ExplorerAutoOptimizerSetting": "google.ads.googleads.v6.common.types.explorer_auto_optimizer_setting", - "ExpressionRuleUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "FinalAppUrl": "google.ads.googleads.v6.common.types.final_app_url", - "FrequencyCapEntry": "google.ads.googleads.v6.common.types.frequency_cap", - "FrequencyCapKey": "google.ads.googleads.v6.common.types.frequency_cap", - "GenderInfo": "google.ads.googleads.v6.common.types.criteria", - "GeoPointInfo": "google.ads.googleads.v6.common.types.criteria", - "GmailAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "GmailTeaser": "google.ads.googleads.v6.common.types.ad_type_infos", - "HotelAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "HotelAdvanceBookingWindowInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelCalloutFeedItem": "google.ads.googleads.v6.common.types.extensions", - "HotelCheckInDayInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelCityInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelClassInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelCountryRegionInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelDateSelectionTypeInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelIdInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelLengthOfStayInfo": "google.ads.googleads.v6.common.types.criteria", - "HotelStateInfo": "google.ads.googleads.v6.common.types.criteria", - "ImageAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ImageAsset": "google.ads.googleads.v6.common.types.asset_types", - "ImageDimension": "google.ads.googleads.v6.common.types.asset_types", - "ImageFeedItem": "google.ads.googleads.v6.common.types.extensions", - "IncomeRangeInfo": "google.ads.googleads.v6.common.types.criteria", - "InteractionTypeInfo": "google.ads.googleads.v6.common.types.criteria", - "IpBlockInfo": "google.ads.googleads.v6.common.types.criteria", - "Keyword": "google.ads.googleads.v6.common.types.segments", - "KeywordInfo": "google.ads.googleads.v6.common.types.criteria", - "KeywordPlanHistoricalMetrics": "google.ads.googleads.v6.common.types.keyword_plan_common", - "LanguageInfo": "google.ads.googleads.v6.common.types.criteria", - "LeadFormAsset": "google.ads.googleads.v6.common.types.asset_types", - "LeadFormDeliveryMethod": "google.ads.googleads.v6.common.types.asset_types", - "LeadFormField": "google.ads.googleads.v6.common.types.asset_types", - "LeadFormSingleChoiceAnswers": "google.ads.googleads.v6.common.types.asset_types", - "LegacyAppInstallAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "LegacyResponsiveDisplayAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ListingDimensionInfo": "google.ads.googleads.v6.common.types.criteria", - "ListingGroupInfo": "google.ads.googleads.v6.common.types.criteria", - "ListingScopeInfo": "google.ads.googleads.v6.common.types.criteria", - "LocalAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "LocationFeedItem": "google.ads.googleads.v6.common.types.extensions", - "LocationGroupInfo": "google.ads.googleads.v6.common.types.criteria", - "LocationInfo": "google.ads.googleads.v6.common.types.criteria", - "LogicalUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "LogicalUserListOperandInfo": "google.ads.googleads.v6.common.types.user_lists", - "ManualCpc": "google.ads.googleads.v6.common.types.bidding", - "ManualCpm": "google.ads.googleads.v6.common.types.bidding", - "ManualCpv": "google.ads.googleads.v6.common.types.bidding", - "MatchingFunction": "google.ads.googleads.v6.common.types.matching_function", - "MaximizeConversions": "google.ads.googleads.v6.common.types.bidding", - "MaximizeConversionValue": "google.ads.googleads.v6.common.types.bidding", - "MediaBundleAsset": "google.ads.googleads.v6.common.types.asset_types", - "Metrics": "google.ads.googleads.v6.common.types.metrics", - "MobileAppCategoryInfo": "google.ads.googleads.v6.common.types.criteria", - "MobileApplicationInfo": "google.ads.googleads.v6.common.types.criteria", - "MobileDeviceInfo": "google.ads.googleads.v6.common.types.criteria", - "Money": "google.ads.googleads.v6.common.types.feed_common", - "MonthlySearchVolume": "google.ads.googleads.v6.common.types.keyword_plan_common", - "OfflineUserAddressInfo": "google.ads.googleads.v6.common.types.offline_user_data", - "Operand": "google.ads.googleads.v6.common.types.matching_function", - "OperatingSystemVersionInfo": "google.ads.googleads.v6.common.types.criteria", - "ParentalStatusInfo": "google.ads.googleads.v6.common.types.criteria", - "PercentCpc": "google.ads.googleads.v6.common.types.bidding", - "PercentCpcBidSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "PercentCpcBidSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "PlacementInfo": "google.ads.googleads.v6.common.types.criteria", - "PolicyTopicConstraint": "google.ads.googleads.v6.common.types.policy", - "PolicyTopicEntry": "google.ads.googleads.v6.common.types.policy", - "PolicyTopicEvidence": "google.ads.googleads.v6.common.types.policy", - "PolicyValidationParameter": "google.ads.googleads.v6.common.types.policy", - "PolicyViolationKey": "google.ads.googleads.v6.common.types.policy", - "PreferredContentInfo": "google.ads.googleads.v6.common.types.criteria", - "PriceFeedItem": "google.ads.googleads.v6.common.types.extensions", - "PriceOffer": "google.ads.googleads.v6.common.types.extensions", - "ProductBiddingCategoryInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductBrandInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductChannelExclusivityInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductChannelInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductConditionInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductCustomAttributeInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductImage": "google.ads.googleads.v6.common.types.ad_type_infos", - "ProductItemIdInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductTypeInfo": "google.ads.googleads.v6.common.types.criteria", - "ProductVideo": "google.ads.googleads.v6.common.types.ad_type_infos", - "PromotionFeedItem": "google.ads.googleads.v6.common.types.extensions", - "ProximityInfo": "google.ads.googleads.v6.common.types.criteria", - "RealTimeBiddingSetting": "google.ads.googleads.v6.common.types.real_time_bidding_setting", - "ResponsiveDisplayAdControlSpec": "google.ads.googleads.v6.common.types.ad_type_infos", - "ResponsiveDisplayAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ResponsiveSearchAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "RuleBasedUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "Segments": "google.ads.googleads.v6.common.types.segments", - "ShoppingComparisonListingAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ShoppingProductAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "ShoppingSmartAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "SimilarUserListInfo": "google.ads.googleads.v6.common.types.user_lists", - "SitelinkFeedItem": "google.ads.googleads.v6.common.types.extensions", - "StoreAttribute": "google.ads.googleads.v6.common.types.offline_user_data", - "StoreSalesMetadata": "google.ads.googleads.v6.common.types.offline_user_data", - "StoreSalesThirdPartyMetadata": "google.ads.googleads.v6.common.types.offline_user_data", - "StructuredSnippetFeedItem": "google.ads.googleads.v6.common.types.extensions", - "TagSnippet": "google.ads.googleads.v6.common.types.tag_snippet", - "TargetCpa": "google.ads.googleads.v6.common.types.bidding", - "TargetCpaSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "TargetCpaSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "TargetCpm": "google.ads.googleads.v6.common.types.bidding", - "TargetImpressionShare": "google.ads.googleads.v6.common.types.bidding", - "TargetingSetting": "google.ads.googleads.v6.common.types.targeting_setting", - "TargetRestriction": "google.ads.googleads.v6.common.types.targeting_setting", - "TargetRestrictionOperation": "google.ads.googleads.v6.common.types.targeting_setting", - "TargetRoas": "google.ads.googleads.v6.common.types.bidding", - "TargetRoasSimulationPoint": "google.ads.googleads.v6.common.types.simulation", - "TargetRoasSimulationPointList": "google.ads.googleads.v6.common.types.simulation", - "TargetSpend": "google.ads.googleads.v6.common.types.bidding", - "TextAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "TextAsset": "google.ads.googleads.v6.common.types.asset_types", - "TextLabel": "google.ads.googleads.v6.common.types.text_label", - "TextMessageFeedItem": "google.ads.googleads.v6.common.types.extensions", - "TopicInfo": "google.ads.googleads.v6.common.types.criteria", - "TransactionAttribute": "google.ads.googleads.v6.common.types.offline_user_data", - "UnknownListingDimensionInfo": "google.ads.googleads.v6.common.types.criteria", - "UrlCollection": "google.ads.googleads.v6.common.types.url_collection", - "UserAttribute": "google.ads.googleads.v6.common.types.offline_user_data", - "UserData": "google.ads.googleads.v6.common.types.offline_user_data", - "UserIdentifier": "google.ads.googleads.v6.common.types.offline_user_data", - "UserInterestInfo": "google.ads.googleads.v6.common.types.criteria", - "UserListActionInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListDateRuleItemInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListInfo": "google.ads.googleads.v6.common.types.criteria", - "UserListLogicalRuleInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListNumberRuleItemInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListRuleInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListRuleItemGroupInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListRuleItemInfo": "google.ads.googleads.v6.common.types.user_lists", - "UserListStringRuleItemInfo": "google.ads.googleads.v6.common.types.user_lists", - "Value": "google.ads.googleads.v6.common.types.value", - "VideoAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoBumperInStreamAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoNonSkippableInStreamAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoOutstreamAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoResponsiveAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoTrueViewDiscoveryAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "VideoTrueViewInStreamAdInfo": "google.ads.googleads.v6.common.types.ad_type_infos", - "WebhookDelivery": "google.ads.googleads.v6.common.types.asset_types", - "WebpageConditionInfo": "google.ads.googleads.v6.common.types.criteria", - "WebpageInfo": "google.ads.googleads.v6.common.types.criteria", - "YouTubeChannelInfo": "google.ads.googleads.v6.common.types.criteria", - "YoutubeVideoAsset": "google.ads.googleads.v6.common.types.asset_types", - "YouTubeVideoInfo": "google.ads.googleads.v6.common.types.criteria", - "AccessInvitationStatusEnum": "google.ads.googleads.v6.enums.types.access_invitation_status", - "AccessReasonEnum": "google.ads.googleads.v6.enums.types.access_reason", - "AccessRoleEnum": "google.ads.googleads.v6.enums.types.access_role", - "AccountBudgetProposalStatusEnum": "google.ads.googleads.v6.enums.types.account_budget_proposal_status", - "AccountBudgetProposalTypeEnum": "google.ads.googleads.v6.enums.types.account_budget_proposal_type", - "AccountBudgetStatusEnum": "google.ads.googleads.v6.enums.types.account_budget_status", - "AccountLinkStatusEnum": "google.ads.googleads.v6.enums.types.account_link_status", - "AdCustomizerPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.ad_customizer_placeholder_field", - "AdDestinationTypeEnum": "google.ads.googleads.v6.enums.types.ad_destination_type", - "AdGroupAdRotationModeEnum": "google.ads.googleads.v6.enums.types.ad_group_ad_rotation_mode", - "AdGroupAdStatusEnum": "google.ads.googleads.v6.enums.types.ad_group_ad_status", - "AdGroupCriterionApprovalStatusEnum": "google.ads.googleads.v6.enums.types.ad_group_criterion_approval_status", - "AdGroupCriterionStatusEnum": "google.ads.googleads.v6.enums.types.ad_group_criterion_status", - "AdGroupStatusEnum": "google.ads.googleads.v6.enums.types.ad_group_status", - "AdGroupTypeEnum": "google.ads.googleads.v6.enums.types.ad_group_type", - "AdNetworkTypeEnum": "google.ads.googleads.v6.enums.types.ad_network_type", - "AdServingOptimizationStatusEnum": "google.ads.googleads.v6.enums.types.ad_serving_optimization_status", - "AdStrengthEnum": "google.ads.googleads.v6.enums.types.ad_strength", - "AdTypeEnum": "google.ads.googleads.v6.enums.types.ad_type", - "AdvertisingChannelSubTypeEnum": "google.ads.googleads.v6.enums.types.advertising_channel_sub_type", - "AdvertisingChannelTypeEnum": "google.ads.googleads.v6.enums.types.advertising_channel_type", - "AffiliateLocationFeedRelationshipTypeEnum": "google.ads.googleads.v6.enums.types.affiliate_location_feed_relationship_type", - "AffiliateLocationPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.affiliate_location_placeholder_field", - "AgeRangeTypeEnum": "google.ads.googleads.v6.enums.types.age_range_type", - "AppCampaignAppStoreEnum": "google.ads.googleads.v6.enums.types.app_campaign_app_store", - "AppCampaignBiddingStrategyGoalTypeEnum": "google.ads.googleads.v6.enums.types.app_campaign_bidding_strategy_goal_type", - "AppPaymentModelTypeEnum": "google.ads.googleads.v6.enums.types.app_payment_model_type", - "AppPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.app_placeholder_field", - "AppStoreEnum": "google.ads.googleads.v6.enums.types.app_store", - "AppUrlOperatingSystemTypeEnum": "google.ads.googleads.v6.enums.types.app_url_operating_system_type", - "AssetFieldTypeEnum": "google.ads.googleads.v6.enums.types.asset_field_type", - "AssetLinkStatusEnum": "google.ads.googleads.v6.enums.types.asset_link_status", - "AssetPerformanceLabelEnum": "google.ads.googleads.v6.enums.types.asset_performance_label", - "AssetTypeEnum": "google.ads.googleads.v6.enums.types.asset_type", - "AttributionModelEnum": "google.ads.googleads.v6.enums.types.attribution_model", - "BatchJobStatusEnum": "google.ads.googleads.v6.enums.types.batch_job_status", - "BiddingSourceEnum": "google.ads.googleads.v6.enums.types.bidding_source", - "BiddingStrategyStatusEnum": "google.ads.googleads.v6.enums.types.bidding_strategy_status", - "BiddingStrategyTypeEnum": "google.ads.googleads.v6.enums.types.bidding_strategy_type", - "BidModifierSourceEnum": "google.ads.googleads.v6.enums.types.bid_modifier_source", - "BillingSetupStatusEnum": "google.ads.googleads.v6.enums.types.billing_setup_status", - "BrandSafetySuitabilityEnum": "google.ads.googleads.v6.enums.types.brand_safety_suitability", - "BudgetCampaignAssociationStatusEnum": "google.ads.googleads.v6.enums.types.budget_campaign_association_status", - "BudgetDeliveryMethodEnum": "google.ads.googleads.v6.enums.types.budget_delivery_method", - "BudgetPeriodEnum": "google.ads.googleads.v6.enums.types.budget_period", - "BudgetStatusEnum": "google.ads.googleads.v6.enums.types.budget_status", - "BudgetTypeEnum": "google.ads.googleads.v6.enums.types.budget_type", - "CallConversionReportingStateEnum": "google.ads.googleads.v6.enums.types.call_conversion_reporting_state", - "CalloutPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.callout_placeholder_field", - "CallPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.call_placeholder_field", - "CallTrackingDisplayLocationEnum": "google.ads.googleads.v6.enums.types.call_tracking_display_location", - "CallTypeEnum": "google.ads.googleads.v6.enums.types.call_type", - "CampaignCriterionStatusEnum": "google.ads.googleads.v6.enums.types.campaign_criterion_status", - "CampaignDraftStatusEnum": "google.ads.googleads.v6.enums.types.campaign_draft_status", - "CampaignExperimentStatusEnum": "google.ads.googleads.v6.enums.types.campaign_experiment_status", - "CampaignExperimentTrafficSplitTypeEnum": "google.ads.googleads.v6.enums.types.campaign_experiment_traffic_split_type", - "CampaignExperimentTypeEnum": "google.ads.googleads.v6.enums.types.campaign_experiment_type", - "CampaignServingStatusEnum": "google.ads.googleads.v6.enums.types.campaign_serving_status", - "CampaignSharedSetStatusEnum": "google.ads.googleads.v6.enums.types.campaign_shared_set_status", - "CampaignStatusEnum": "google.ads.googleads.v6.enums.types.campaign_status", - "ChangeClientTypeEnum": "google.ads.googleads.v6.enums.types.change_client_type", - "ChangeEventResourceTypeEnum": "google.ads.googleads.v6.enums.types.change_event_resource_type", - "ChangeStatusOperationEnum": "google.ads.googleads.v6.enums.types.change_status_operation", - "ChangeStatusResourceTypeEnum": "google.ads.googleads.v6.enums.types.change_status_resource_type", - "ClickTypeEnum": "google.ads.googleads.v6.enums.types.click_type", - "CombinedAudienceStatusEnum": "google.ads.googleads.v6.enums.types.combined_audience_status", - "ContentLabelTypeEnum": "google.ads.googleads.v6.enums.types.content_label_type", - "ConversionActionCategoryEnum": "google.ads.googleads.v6.enums.types.conversion_action_category", - "ConversionActionCountingTypeEnum": "google.ads.googleads.v6.enums.types.conversion_action_counting_type", - "ConversionActionStatusEnum": "google.ads.googleads.v6.enums.types.conversion_action_status", - "ConversionActionTypeEnum": "google.ads.googleads.v6.enums.types.conversion_action_type", - "ConversionAdjustmentTypeEnum": "google.ads.googleads.v6.enums.types.conversion_adjustment_type", - "ConversionAttributionEventTypeEnum": "google.ads.googleads.v6.enums.types.conversion_attribution_event_type", - "ConversionLagBucketEnum": "google.ads.googleads.v6.enums.types.conversion_lag_bucket", - "ConversionOrAdjustmentLagBucketEnum": "google.ads.googleads.v6.enums.types.conversion_or_adjustment_lag_bucket", - "CriterionCategoryChannelAvailabilityModeEnum": "google.ads.googleads.v6.enums.types.criterion_category_channel_availability_mode", - "CriterionCategoryLocaleAvailabilityModeEnum": "google.ads.googleads.v6.enums.types.criterion_category_locale_availability_mode", - "CriterionSystemServingStatusEnum": "google.ads.googleads.v6.enums.types.criterion_system_serving_status", - "CriterionTypeEnum": "google.ads.googleads.v6.enums.types.criterion_type", - "CustomAudienceMemberTypeEnum": "google.ads.googleads.v6.enums.types.custom_audience_member_type", - "CustomAudienceStatusEnum": "google.ads.googleads.v6.enums.types.custom_audience_status", - "CustomAudienceTypeEnum": "google.ads.googleads.v6.enums.types.custom_audience_type", - "CustomerMatchUploadKeyTypeEnum": "google.ads.googleads.v6.enums.types.customer_match_upload_key_type", - "CustomerPayPerConversionEligibilityFailureReasonEnum": "google.ads.googleads.v6.enums.types.customer_pay_per_conversion_eligibility_failure_reason", - "CustomInterestMemberTypeEnum": "google.ads.googleads.v6.enums.types.custom_interest_member_type", - "CustomInterestStatusEnum": "google.ads.googleads.v6.enums.types.custom_interest_status", - "CustomInterestTypeEnum": "google.ads.googleads.v6.enums.types.custom_interest_type", - "CustomPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.custom_placeholder_field", - "DataDrivenModelStatusEnum": "google.ads.googleads.v6.enums.types.data_driven_model_status", - "DayOfWeekEnum": "google.ads.googleads.v6.enums.types.day_of_week", - "DeviceEnum": "google.ads.googleads.v6.enums.types.device", - "DisplayAdFormatSettingEnum": "google.ads.googleads.v6.enums.types.display_ad_format_setting", - "DisplayUploadProductTypeEnum": "google.ads.googleads.v6.enums.types.display_upload_product_type", - "DistanceBucketEnum": "google.ads.googleads.v6.enums.types.distance_bucket", - "DsaPageFeedCriterionFieldEnum": "google.ads.googleads.v6.enums.types.dsa_page_feed_criterion_field", - "EducationPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.education_placeholder_field", - "ExtensionSettingDeviceEnum": "google.ads.googleads.v6.enums.types.extension_setting_device", - "ExtensionTypeEnum": "google.ads.googleads.v6.enums.types.extension_type", - "ExternalConversionSourceEnum": "google.ads.googleads.v6.enums.types.external_conversion_source", - "FeedAttributeTypeEnum": "google.ads.googleads.v6.enums.types.feed_attribute_type", - "FeedItemQualityApprovalStatusEnum": "google.ads.googleads.v6.enums.types.feed_item_quality_approval_status", - "FeedItemQualityDisapprovalReasonEnum": "google.ads.googleads.v6.enums.types.feed_item_quality_disapproval_reason", - "FeedItemSetStatusEnum": "google.ads.googleads.v6.enums.types.feed_item_set_status", - "FeedItemSetStringFilterTypeEnum": "google.ads.googleads.v6.enums.types.feed_item_set_string_filter_type", - "FeedItemStatusEnum": "google.ads.googleads.v6.enums.types.feed_item_status", - "FeedItemTargetDeviceEnum": "google.ads.googleads.v6.enums.types.feed_item_target_device", - "FeedItemTargetStatusEnum": "google.ads.googleads.v6.enums.types.feed_item_target_status", - "FeedItemTargetTypeEnum": "google.ads.googleads.v6.enums.types.feed_item_target_type", - "FeedItemValidationStatusEnum": "google.ads.googleads.v6.enums.types.feed_item_validation_status", - "FeedLinkStatusEnum": "google.ads.googleads.v6.enums.types.feed_link_status", - "FeedMappingCriterionTypeEnum": "google.ads.googleads.v6.enums.types.feed_mapping_criterion_type", - "FeedMappingStatusEnum": "google.ads.googleads.v6.enums.types.feed_mapping_status", - "FeedOriginEnum": "google.ads.googleads.v6.enums.types.feed_origin", - "FeedStatusEnum": "google.ads.googleads.v6.enums.types.feed_status", - "FlightPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.flight_placeholder_field", - "FrequencyCapEventTypeEnum": "google.ads.googleads.v6.enums.types.frequency_cap_event_type", - "FrequencyCapLevelEnum": "google.ads.googleads.v6.enums.types.frequency_cap_level", - "FrequencyCapTimeUnitEnum": "google.ads.googleads.v6.enums.types.frequency_cap_time_unit", - "GenderTypeEnum": "google.ads.googleads.v6.enums.types.gender_type", - "GeoTargetConstantStatusEnum": "google.ads.googleads.v6.enums.types.geo_target_constant_status", - "GeoTargetingRestrictionEnum": "google.ads.googleads.v6.enums.types.geo_targeting_restriction", - "GeoTargetingTypeEnum": "google.ads.googleads.v6.enums.types.geo_targeting_type", - "GoogleAdsFieldCategoryEnum": "google.ads.googleads.v6.enums.types.google_ads_field_category", - "GoogleAdsFieldDataTypeEnum": "google.ads.googleads.v6.enums.types.google_ads_field_data_type", - "GoogleVoiceCallStatusEnum": "google.ads.googleads.v6.enums.types.google_voice_call_status", - "HotelDateSelectionTypeEnum": "google.ads.googleads.v6.enums.types.hotel_date_selection_type", - "HotelPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.hotel_placeholder_field", - "HotelPriceBucketEnum": "google.ads.googleads.v6.enums.types.hotel_price_bucket", - "HotelRateTypeEnum": "google.ads.googleads.v6.enums.types.hotel_rate_type", - "ImagePlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.image_placeholder_field", - "IncomeRangeTypeEnum": "google.ads.googleads.v6.enums.types.income_range_type", - "InteractionEventTypeEnum": "google.ads.googleads.v6.enums.types.interaction_event_type", - "InteractionTypeEnum": "google.ads.googleads.v6.enums.types.interaction_type", - "InvoiceTypeEnum": "google.ads.googleads.v6.enums.types.invoice_type", - "JobPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.job_placeholder_field", - "KeywordMatchTypeEnum": "google.ads.googleads.v6.enums.types.keyword_match_type", - "KeywordPlanCompetitionLevelEnum": "google.ads.googleads.v6.enums.types.keyword_plan_competition_level", - "KeywordPlanForecastIntervalEnum": "google.ads.googleads.v6.enums.types.keyword_plan_forecast_interval", - "KeywordPlanNetworkEnum": "google.ads.googleads.v6.enums.types.keyword_plan_network", - "LabelStatusEnum": "google.ads.googleads.v6.enums.types.label_status", - "LeadFormCallToActionTypeEnum": "google.ads.googleads.v6.enums.types.lead_form_call_to_action_type", - "LeadFormDesiredIntentEnum": "google.ads.googleads.v6.enums.types.lead_form_desired_intent", - "LeadFormFieldUserInputTypeEnum": "google.ads.googleads.v6.enums.types.lead_form_field_user_input_type", - "LeadFormPostSubmitCallToActionTypeEnum": "google.ads.googleads.v6.enums.types.lead_form_post_submit_call_to_action_type", - "LegacyAppInstallAdAppStoreEnum": "google.ads.googleads.v6.enums.types.legacy_app_install_ad_app_store", - "LinkedAccountTypeEnum": "google.ads.googleads.v6.enums.types.linked_account_type", - "ListingGroupTypeEnum": "google.ads.googleads.v6.enums.types.listing_group_type", - "LocalPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.local_placeholder_field", - "LocationExtensionTargetingCriterionFieldEnum": "google.ads.googleads.v6.enums.types.location_extension_targeting_criterion_field", - "LocationGroupRadiusUnitsEnum": "google.ads.googleads.v6.enums.types.location_group_radius_units", - "LocationPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.location_placeholder_field", - "LocationSourceTypeEnum": "google.ads.googleads.v6.enums.types.location_source_type", - "ManagerLinkStatusEnum": "google.ads.googleads.v6.enums.types.manager_link_status", - "MatchingFunctionContextTypeEnum": "google.ads.googleads.v6.enums.types.matching_function_context_type", - "MatchingFunctionOperatorEnum": "google.ads.googleads.v6.enums.types.matching_function_operator", - "MediaTypeEnum": "google.ads.googleads.v6.enums.types.media_type", - "MerchantCenterLinkStatusEnum": "google.ads.googleads.v6.enums.types.merchant_center_link_status", - "MessagePlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.message_placeholder_field", - "MimeTypeEnum": "google.ads.googleads.v6.enums.types.mime_type", - "MinuteOfHourEnum": "google.ads.googleads.v6.enums.types.minute_of_hour", - "MobileAppVendorEnum": "google.ads.googleads.v6.enums.types.mobile_app_vendor", - "MobileDeviceTypeEnum": "google.ads.googleads.v6.enums.types.mobile_device_type", - "MonthOfYearEnum": "google.ads.googleads.v6.enums.types.month_of_year", - "NegativeGeoTargetTypeEnum": "google.ads.googleads.v6.enums.types.negative_geo_target_type", - "OfflineUserDataJobFailureReasonEnum": "google.ads.googleads.v6.enums.types.offline_user_data_job_failure_reason", - "OfflineUserDataJobStatusEnum": "google.ads.googleads.v6.enums.types.offline_user_data_job_status", - "OfflineUserDataJobTypeEnum": "google.ads.googleads.v6.enums.types.offline_user_data_job_type", - "OperatingSystemVersionOperatorTypeEnum": "google.ads.googleads.v6.enums.types.operating_system_version_operator_type", - "OptimizationGoalTypeEnum": "google.ads.googleads.v6.enums.types.optimization_goal_type", - "ParentalStatusTypeEnum": "google.ads.googleads.v6.enums.types.parental_status_type", - "PaymentModeEnum": "google.ads.googleads.v6.enums.types.payment_mode", - "PlaceholderTypeEnum": "google.ads.googleads.v6.enums.types.placeholder_type", - "PlacementTypeEnum": "google.ads.googleads.v6.enums.types.placement_type", - "PolicyApprovalStatusEnum": "google.ads.googleads.v6.enums.types.policy_approval_status", - "PolicyReviewStatusEnum": "google.ads.googleads.v6.enums.types.policy_review_status", - "PolicyTopicEntryTypeEnum": "google.ads.googleads.v6.enums.types.policy_topic_entry_type", - "PolicyTopicEvidenceDestinationMismatchUrlTypeEnum": "google.ads.googleads.v6.enums.types.policy_topic_evidence_destination_mismatch_url_type", - "PolicyTopicEvidenceDestinationNotWorkingDeviceEnum": "google.ads.googleads.v6.enums.types.policy_topic_evidence_destination_not_working_device", - "PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum": "google.ads.googleads.v6.enums.types.policy_topic_evidence_destination_not_working_dns_error_type", - "PositiveGeoTargetTypeEnum": "google.ads.googleads.v6.enums.types.positive_geo_target_type", - "PreferredContentTypeEnum": "google.ads.googleads.v6.enums.types.preferred_content_type", - "PriceExtensionPriceQualifierEnum": "google.ads.googleads.v6.enums.types.price_extension_price_qualifier", - "PriceExtensionPriceUnitEnum": "google.ads.googleads.v6.enums.types.price_extension_price_unit", - "PriceExtensionTypeEnum": "google.ads.googleads.v6.enums.types.price_extension_type", - "PricePlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.price_placeholder_field", - "ProductBiddingCategoryLevelEnum": "google.ads.googleads.v6.enums.types.product_bidding_category_level", - "ProductBiddingCategoryStatusEnum": "google.ads.googleads.v6.enums.types.product_bidding_category_status", - "ProductChannelEnum": "google.ads.googleads.v6.enums.types.product_channel", - "ProductChannelExclusivityEnum": "google.ads.googleads.v6.enums.types.product_channel_exclusivity", - "ProductConditionEnum": "google.ads.googleads.v6.enums.types.product_condition", - "ProductCustomAttributeIndexEnum": "google.ads.googleads.v6.enums.types.product_custom_attribute_index", - "ProductTypeLevelEnum": "google.ads.googleads.v6.enums.types.product_type_level", - "PromotionExtensionDiscountModifierEnum": "google.ads.googleads.v6.enums.types.promotion_extension_discount_modifier", - "PromotionExtensionOccasionEnum": "google.ads.googleads.v6.enums.types.promotion_extension_occasion", - "PromotionPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.promotion_placeholder_field", - "ProximityRadiusUnitsEnum": "google.ads.googleads.v6.enums.types.proximity_radius_units", - "QualityScoreBucketEnum": "google.ads.googleads.v6.enums.types.quality_score_bucket", - "ReachPlanAdLengthEnum": "google.ads.googleads.v6.enums.types.reach_plan_ad_length", - "ReachPlanAgeRangeEnum": "google.ads.googleads.v6.enums.types.reach_plan_age_range", - "ReachPlanNetworkEnum": "google.ads.googleads.v6.enums.types.reach_plan_network", - "RealEstatePlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.real_estate_placeholder_field", - "RecommendationTypeEnum": "google.ads.googleads.v6.enums.types.recommendation_type", - "ResourceChangeOperationEnum": "google.ads.googleads.v6.enums.types.resource_change_operation", - "ResponseContentTypeEnum": "google.ads.googleads.v6.enums.types.response_content_type", - "SearchEngineResultsPageTypeEnum": "google.ads.googleads.v6.enums.types.search_engine_results_page_type", - "SearchTermMatchTypeEnum": "google.ads.googleads.v6.enums.types.search_term_match_type", - "SearchTermTargetingStatusEnum": "google.ads.googleads.v6.enums.types.search_term_targeting_status", - "ServedAssetFieldTypeEnum": "google.ads.googleads.v6.enums.types.served_asset_field_type", - "SharedSetStatusEnum": "google.ads.googleads.v6.enums.types.shared_set_status", - "SharedSetTypeEnum": "google.ads.googleads.v6.enums.types.shared_set_type", - "SimulationModificationMethodEnum": "google.ads.googleads.v6.enums.types.simulation_modification_method", - "SimulationTypeEnum": "google.ads.googleads.v6.enums.types.simulation_type", - "SitelinkPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.sitelink_placeholder_field", - "SlotEnum": "google.ads.googleads.v6.enums.types.slot", - "SpendingLimitTypeEnum": "google.ads.googleads.v6.enums.types.spending_limit_type", - "StructuredSnippetPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.structured_snippet_placeholder_field", - "SummaryRowSettingEnum": "google.ads.googleads.v6.enums.types.summary_row_setting", - "SystemManagedResourceSourceEnum": "google.ads.googleads.v6.enums.types.system_managed_entity_source", - "TargetCpaOptInRecommendationGoalEnum": "google.ads.googleads.v6.enums.types.target_cpa_opt_in_recommendation_goal", - "TargetImpressionShareLocationEnum": "google.ads.googleads.v6.enums.types.target_impression_share_location", - "TargetingDimensionEnum": "google.ads.googleads.v6.enums.types.targeting_dimension", - "TimeTypeEnum": "google.ads.googleads.v6.enums.types.time_type", - "TrackingCodePageFormatEnum": "google.ads.googleads.v6.enums.types.tracking_code_page_format", - "TrackingCodeTypeEnum": "google.ads.googleads.v6.enums.types.tracking_code_type", - "TravelPlaceholderFieldEnum": "google.ads.googleads.v6.enums.types.travel_placeholder_field", - "UserIdentifierSourceEnum": "google.ads.googleads.v6.enums.types.user_identifier_source", - "UserInterestTaxonomyTypeEnum": "google.ads.googleads.v6.enums.types.user_interest_taxonomy_type", - "UserListAccessStatusEnum": "google.ads.googleads.v6.enums.types.user_list_access_status", - "UserListClosingReasonEnum": "google.ads.googleads.v6.enums.types.user_list_closing_reason", - "UserListCombinedRuleOperatorEnum": "google.ads.googleads.v6.enums.types.user_list_combined_rule_operator", - "UserListCrmDataSourceTypeEnum": "google.ads.googleads.v6.enums.types.user_list_crm_data_source_type", - "UserListDateRuleItemOperatorEnum": "google.ads.googleads.v6.enums.types.user_list_date_rule_item_operator", - "UserListLogicalRuleOperatorEnum": "google.ads.googleads.v6.enums.types.user_list_logical_rule_operator", - "UserListMembershipStatusEnum": "google.ads.googleads.v6.enums.types.user_list_membership_status", - "UserListNumberRuleItemOperatorEnum": "google.ads.googleads.v6.enums.types.user_list_number_rule_item_operator", - "UserListPrepopulationStatusEnum": "google.ads.googleads.v6.enums.types.user_list_prepopulation_status", - "UserListRuleTypeEnum": "google.ads.googleads.v6.enums.types.user_list_rule_type", - "UserListSizeRangeEnum": "google.ads.googleads.v6.enums.types.user_list_size_range", - "UserListStringRuleItemOperatorEnum": "google.ads.googleads.v6.enums.types.user_list_string_rule_item_operator", - "UserListTypeEnum": "google.ads.googleads.v6.enums.types.user_list_type", - "VanityPharmaDisplayUrlModeEnum": "google.ads.googleads.v6.enums.types.vanity_pharma_display_url_mode", - "VanityPharmaTextEnum": "google.ads.googleads.v6.enums.types.vanity_pharma_text", - "WebpageConditionOperandEnum": "google.ads.googleads.v6.enums.types.webpage_condition_operand", - "WebpageConditionOperatorEnum": "google.ads.googleads.v6.enums.types.webpage_condition_operator", - "AccessInvitationErrorEnum": "google.ads.googleads.v6.errors.types.access_invitation_error", - "AccountBudgetProposalErrorEnum": "google.ads.googleads.v6.errors.types.account_budget_proposal_error", - "AccountLinkErrorEnum": "google.ads.googleads.v6.errors.types.account_link_error", - "AdCustomizerErrorEnum": "google.ads.googleads.v6.errors.types.ad_customizer_error", - "AdErrorEnum": "google.ads.googleads.v6.errors.types.ad_error", - "AdGroupAdErrorEnum": "google.ads.googleads.v6.errors.types.ad_group_ad_error", - "AdGroupBidModifierErrorEnum": "google.ads.googleads.v6.errors.types.ad_group_bid_modifier_error", - "AdGroupCriterionErrorEnum": "google.ads.googleads.v6.errors.types.ad_group_criterion_error", - "AdGroupErrorEnum": "google.ads.googleads.v6.errors.types.ad_group_error", - "AdGroupFeedErrorEnum": "google.ads.googleads.v6.errors.types.ad_group_feed_error", - "AdParameterErrorEnum": "google.ads.googleads.v6.errors.types.ad_parameter_error", - "AdSharingErrorEnum": "google.ads.googleads.v6.errors.types.ad_sharing_error", - "AdxErrorEnum": "google.ads.googleads.v6.errors.types.adx_error", - "AssetErrorEnum": "google.ads.googleads.v6.errors.types.asset_error", - "AssetLinkErrorEnum": "google.ads.googleads.v6.errors.types.asset_link_error", - "AuthenticationErrorEnum": "google.ads.googleads.v6.errors.types.authentication_error", - "AuthorizationErrorEnum": "google.ads.googleads.v6.errors.types.authorization_error", - "BatchJobErrorEnum": "google.ads.googleads.v6.errors.types.batch_job_error", - "BiddingErrorEnum": "google.ads.googleads.v6.errors.types.bidding_error", - "BiddingStrategyErrorEnum": "google.ads.googleads.v6.errors.types.bidding_strategy_error", - "BillingSetupErrorEnum": "google.ads.googleads.v6.errors.types.billing_setup_error", - "CampaignBudgetErrorEnum": "google.ads.googleads.v6.errors.types.campaign_budget_error", - "CampaignCriterionErrorEnum": "google.ads.googleads.v6.errors.types.campaign_criterion_error", - "CampaignDraftErrorEnum": "google.ads.googleads.v6.errors.types.campaign_draft_error", - "CampaignErrorEnum": "google.ads.googleads.v6.errors.types.campaign_error", - "CampaignExperimentErrorEnum": "google.ads.googleads.v6.errors.types.campaign_experiment_error", - "CampaignFeedErrorEnum": "google.ads.googleads.v6.errors.types.campaign_feed_error", - "CampaignSharedSetErrorEnum": "google.ads.googleads.v6.errors.types.campaign_shared_set_error", - "ChangeEventErrorEnum": "google.ads.googleads.v6.errors.types.change_event_error", - "ChangeStatusErrorEnum": "google.ads.googleads.v6.errors.types.change_status_error", - "CollectionSizeErrorEnum": "google.ads.googleads.v6.errors.types.collection_size_error", - "ContextErrorEnum": "google.ads.googleads.v6.errors.types.context_error", - "ConversionActionErrorEnum": "google.ads.googleads.v6.errors.types.conversion_action_error", - "ConversionAdjustmentUploadErrorEnum": "google.ads.googleads.v6.errors.types.conversion_adjustment_upload_error", - "ConversionUploadErrorEnum": "google.ads.googleads.v6.errors.types.conversion_upload_error", - "CountryCodeErrorEnum": "google.ads.googleads.v6.errors.types.country_code_error", - "CriterionErrorEnum": "google.ads.googleads.v6.errors.types.criterion_error", - "CurrencyCodeErrorEnum": "google.ads.googleads.v6.errors.types.currency_code_error", - "CustomAudienceErrorEnum": "google.ads.googleads.v6.errors.types.custom_audience_error", - "CustomerClientLinkErrorEnum": "google.ads.googleads.v6.errors.types.customer_client_link_error", - "CustomerErrorEnum": "google.ads.googleads.v6.errors.types.customer_error", - "CustomerFeedErrorEnum": "google.ads.googleads.v6.errors.types.customer_feed_error", - "CustomerManagerLinkErrorEnum": "google.ads.googleads.v6.errors.types.customer_manager_link_error", - "CustomerUserAccessErrorEnum": "google.ads.googleads.v6.errors.types.customer_user_access_error", - "CustomInterestErrorEnum": "google.ads.googleads.v6.errors.types.custom_interest_error", - "DatabaseErrorEnum": "google.ads.googleads.v6.errors.types.database_error", - "DateErrorEnum": "google.ads.googleads.v6.errors.types.date_error", - "DateRangeErrorEnum": "google.ads.googleads.v6.errors.types.date_range_error", - "DistinctErrorEnum": "google.ads.googleads.v6.errors.types.distinct_error", - "EnumErrorEnum": "google.ads.googleads.v6.errors.types.enum_error", - "ErrorCode": "google.ads.googleads.v6.errors.types.errors", - "ErrorDetails": "google.ads.googleads.v6.errors.types.errors", - "ErrorLocation": "google.ads.googleads.v6.errors.types.errors", - "ExtensionFeedItemErrorEnum": "google.ads.googleads.v6.errors.types.extension_feed_item_error", - "ExtensionSettingErrorEnum": "google.ads.googleads.v6.errors.types.extension_setting_error", - "FeedAttributeReferenceErrorEnum": "google.ads.googleads.v6.errors.types.feed_attribute_reference_error", - "FeedErrorEnum": "google.ads.googleads.v6.errors.types.feed_error", - "FeedItemErrorEnum": "google.ads.googleads.v6.errors.types.feed_item_error", - "FeedItemSetErrorEnum": "google.ads.googleads.v6.errors.types.feed_item_set_error", - "FeedItemSetLinkErrorEnum": "google.ads.googleads.v6.errors.types.feed_item_set_link_error", - "FeedItemTargetErrorEnum": "google.ads.googleads.v6.errors.types.feed_item_target_error", - "FeedItemValidationErrorEnum": "google.ads.googleads.v6.errors.types.feed_item_validation_error", - "FeedMappingErrorEnum": "google.ads.googleads.v6.errors.types.feed_mapping_error", - "FieldErrorEnum": "google.ads.googleads.v6.errors.types.field_error", - "FieldMaskErrorEnum": "google.ads.googleads.v6.errors.types.field_mask_error", - "FunctionErrorEnum": "google.ads.googleads.v6.errors.types.function_error", - "FunctionParsingErrorEnum": "google.ads.googleads.v6.errors.types.function_parsing_error", - "GeoTargetConstantSuggestionErrorEnum": "google.ads.googleads.v6.errors.types.geo_target_constant_suggestion_error", - "GoogleAdsError": "google.ads.googleads.v6.errors.types.errors", - "GoogleAdsFailure": "google.ads.googleads.v6.errors.types.errors", - "HeaderErrorEnum": "google.ads.googleads.v6.errors.types.header_error", - "IdErrorEnum": "google.ads.googleads.v6.errors.types.id_error", - "ImageErrorEnum": "google.ads.googleads.v6.errors.types.image_error", - "InternalErrorEnum": "google.ads.googleads.v6.errors.types.internal_error", - "InvoiceErrorEnum": "google.ads.googleads.v6.errors.types.invoice_error", - "KeywordPlanAdGroupErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_ad_group_error", - "KeywordPlanAdGroupKeywordErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_ad_group_keyword_error", - "KeywordPlanCampaignErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_campaign_error", - "KeywordPlanCampaignKeywordErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_campaign_keyword_error", - "KeywordPlanErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_error", - "KeywordPlanIdeaErrorEnum": "google.ads.googleads.v6.errors.types.keyword_plan_idea_error", - "LabelErrorEnum": "google.ads.googleads.v6.errors.types.label_error", - "LanguageCodeErrorEnum": "google.ads.googleads.v6.errors.types.language_code_error", - "ListOperationErrorEnum": "google.ads.googleads.v6.errors.types.list_operation_error", - "ManagerLinkErrorEnum": "google.ads.googleads.v6.errors.types.manager_link_error", - "MediaBundleErrorEnum": "google.ads.googleads.v6.errors.types.media_bundle_error", - "MediaFileErrorEnum": "google.ads.googleads.v6.errors.types.media_file_error", - "MediaUploadErrorEnum": "google.ads.googleads.v6.errors.types.media_upload_error", - "MultiplierErrorEnum": "google.ads.googleads.v6.errors.types.multiplier_error", - "MutateErrorEnum": "google.ads.googleads.v6.errors.types.mutate_error", - "NewResourceCreationErrorEnum": "google.ads.googleads.v6.errors.types.new_resource_creation_error", - "NotAllowlistedErrorEnum": "google.ads.googleads.v6.errors.types.not_allowlisted_error", - "NotEmptyErrorEnum": "google.ads.googleads.v6.errors.types.not_empty_error", - "NullErrorEnum": "google.ads.googleads.v6.errors.types.null_error", - "OfflineUserDataJobErrorEnum": "google.ads.googleads.v6.errors.types.offline_user_data_job_error", - "OperationAccessDeniedErrorEnum": "google.ads.googleads.v6.errors.types.operation_access_denied_error", - "OperatorErrorEnum": "google.ads.googleads.v6.errors.types.operator_error", - "PartialFailureErrorEnum": "google.ads.googleads.v6.errors.types.partial_failure_error", - "PaymentsAccountErrorEnum": "google.ads.googleads.v6.errors.types.payments_account_error", - "PolicyFindingDetails": "google.ads.googleads.v6.errors.types.errors", - "PolicyFindingErrorEnum": "google.ads.googleads.v6.errors.types.policy_finding_error", - "PolicyValidationParameterErrorEnum": "google.ads.googleads.v6.errors.types.policy_validation_parameter_error", - "PolicyViolationDetails": "google.ads.googleads.v6.errors.types.errors", - "PolicyViolationErrorEnum": "google.ads.googleads.v6.errors.types.policy_violation_error", - "QueryErrorEnum": "google.ads.googleads.v6.errors.types.query_error", - "QuotaErrorDetails": "google.ads.googleads.v6.errors.types.errors", - "QuotaErrorEnum": "google.ads.googleads.v6.errors.types.quota_error", - "RangeErrorEnum": "google.ads.googleads.v6.errors.types.range_error", - "ReachPlanErrorEnum": "google.ads.googleads.v6.errors.types.reach_plan_error", - "RecommendationErrorEnum": "google.ads.googleads.v6.errors.types.recommendation_error", - "RegionCodeErrorEnum": "google.ads.googleads.v6.errors.types.region_code_error", - "RequestErrorEnum": "google.ads.googleads.v6.errors.types.request_error", - "ResourceAccessDeniedErrorEnum": "google.ads.googleads.v6.errors.types.resource_access_denied_error", - "ResourceCountLimitExceededErrorEnum": "google.ads.googleads.v6.errors.types.resource_count_limit_exceeded_error", - "SettingErrorEnum": "google.ads.googleads.v6.errors.types.setting_error", - "SharedCriterionErrorEnum": "google.ads.googleads.v6.errors.types.shared_criterion_error", - "SharedSetErrorEnum": "google.ads.googleads.v6.errors.types.shared_set_error", - "SizeLimitErrorEnum": "google.ads.googleads.v6.errors.types.size_limit_error", - "StringFormatErrorEnum": "google.ads.googleads.v6.errors.types.string_format_error", - "StringLengthErrorEnum": "google.ads.googleads.v6.errors.types.string_length_error", - "ThirdPartyAppAnalyticsLinkErrorEnum": "google.ads.googleads.v6.errors.types.third_party_app_analytics_link_error", - "TimeZoneErrorEnum": "google.ads.googleads.v6.errors.types.time_zone_error", - "UrlFieldErrorEnum": "google.ads.googleads.v6.errors.types.url_field_error", - "UserDataErrorEnum": "google.ads.googleads.v6.errors.types.user_data_error", - "UserListErrorEnum": "google.ads.googleads.v6.errors.types.user_list_error", - "YoutubeVideoRegistrationErrorEnum": "google.ads.googleads.v6.errors.types.youtube_video_registration_error", - "AccountBudget": "google.ads.googleads.v6.resources.types.account_budget", - "AccountBudgetProposal": "google.ads.googleads.v6.resources.types.account_budget_proposal", - "AccountLink": "google.ads.googleads.v6.resources.types.account_link", - "Ad": "google.ads.googleads.v6.resources.types.ad", - "AdGroup": "google.ads.googleads.v6.resources.types.ad_group", - "AdGroupAd": "google.ads.googleads.v6.resources.types.ad_group_ad", - "AdGroupAdAssetPolicySummary": "google.ads.googleads.v6.resources.types.ad_group_ad_asset_view", - "AdGroupAdAssetView": "google.ads.googleads.v6.resources.types.ad_group_ad_asset_view", - "AdGroupAdLabel": "google.ads.googleads.v6.resources.types.ad_group_ad_label", - "AdGroupAdPolicySummary": "google.ads.googleads.v6.resources.types.ad_group_ad", - "AdGroupAudienceView": "google.ads.googleads.v6.resources.types.ad_group_audience_view", - "AdGroupBidModifier": "google.ads.googleads.v6.resources.types.ad_group_bid_modifier", - "AdGroupCriterion": "google.ads.googleads.v6.resources.types.ad_group_criterion", - "AdGroupCriterionLabel": "google.ads.googleads.v6.resources.types.ad_group_criterion_label", - "AdGroupCriterionSimulation": "google.ads.googleads.v6.resources.types.ad_group_criterion_simulation", - "AdGroupExtensionSetting": "google.ads.googleads.v6.resources.types.ad_group_extension_setting", - "AdGroupFeed": "google.ads.googleads.v6.resources.types.ad_group_feed", - "AdGroupLabel": "google.ads.googleads.v6.resources.types.ad_group_label", - "AdGroupSimulation": "google.ads.googleads.v6.resources.types.ad_group_simulation", - "AdParameter": "google.ads.googleads.v6.resources.types.ad_parameter", - "AdScheduleView": "google.ads.googleads.v6.resources.types.ad_schedule_view", - "AgeRangeView": "google.ads.googleads.v6.resources.types.age_range_view", - "Asset": "google.ads.googleads.v6.resources.types.asset", - "AssetPolicySummary": "google.ads.googleads.v6.resources.types.asset", - "AttributeFieldMapping": "google.ads.googleads.v6.resources.types.feed_mapping", - "BatchJob": "google.ads.googleads.v6.resources.types.batch_job", - "BiddingStrategy": "google.ads.googleads.v6.resources.types.bidding_strategy", - "BillingSetup": "google.ads.googleads.v6.resources.types.billing_setup", - "CallReportingSetting": "google.ads.googleads.v6.resources.types.customer", - "CallView": "google.ads.googleads.v6.resources.types.call_view", - "Campaign": "google.ads.googleads.v6.resources.types.campaign", - "CampaignAsset": "google.ads.googleads.v6.resources.types.campaign_asset", - "CampaignAudienceView": "google.ads.googleads.v6.resources.types.campaign_audience_view", - "CampaignBidModifier": "google.ads.googleads.v6.resources.types.campaign_bid_modifier", - "CampaignBudget": "google.ads.googleads.v6.resources.types.campaign_budget", - "CampaignCriterion": "google.ads.googleads.v6.resources.types.campaign_criterion", - "CampaignCriterionSimulation": "google.ads.googleads.v6.resources.types.campaign_criterion_simulation", - "CampaignDraft": "google.ads.googleads.v6.resources.types.campaign_draft", - "CampaignExperiment": "google.ads.googleads.v6.resources.types.campaign_experiment", - "CampaignExtensionSetting": "google.ads.googleads.v6.resources.types.campaign_extension_setting", - "CampaignFeed": "google.ads.googleads.v6.resources.types.campaign_feed", - "CampaignLabel": "google.ads.googleads.v6.resources.types.campaign_label", - "CampaignSharedSet": "google.ads.googleads.v6.resources.types.campaign_shared_set", - "CarrierConstant": "google.ads.googleads.v6.resources.types.carrier_constant", - "ChangeEvent": "google.ads.googleads.v6.resources.types.change_event", - "ChangeStatus": "google.ads.googleads.v6.resources.types.change_status", - "ClickView": "google.ads.googleads.v6.resources.types.click_view", - "CombinedAudience": "google.ads.googleads.v6.resources.types.combined_audience", - "ConversionAction": "google.ads.googleads.v6.resources.types.conversion_action", - "ConversionTrackingSetting": "google.ads.googleads.v6.resources.types.customer", - "CurrencyConstant": "google.ads.googleads.v6.resources.types.currency_constant", - "CustomAudience": "google.ads.googleads.v6.resources.types.custom_audience", - "CustomAudienceMember": "google.ads.googleads.v6.resources.types.custom_audience", - "Customer": "google.ads.googleads.v6.resources.types.customer", - "CustomerClient": "google.ads.googleads.v6.resources.types.customer_client", - "CustomerClientLink": "google.ads.googleads.v6.resources.types.customer_client_link", - "CustomerExtensionSetting": "google.ads.googleads.v6.resources.types.customer_extension_setting", - "CustomerFeed": "google.ads.googleads.v6.resources.types.customer_feed", - "CustomerLabel": "google.ads.googleads.v6.resources.types.customer_label", - "CustomerManagerLink": "google.ads.googleads.v6.resources.types.customer_manager_link", - "CustomerNegativeCriterion": "google.ads.googleads.v6.resources.types.customer_negative_criterion", - "CustomerUserAccess": "google.ads.googleads.v6.resources.types.customer_user_access", - "CustomerUserAccessInvitation": "google.ads.googleads.v6.resources.types.customer_user_access_invitation", - "CustomInterest": "google.ads.googleads.v6.resources.types.custom_interest", - "CustomInterestMember": "google.ads.googleads.v6.resources.types.custom_interest", - "DataPartnerLinkIdentifier": "google.ads.googleads.v6.resources.types.account_link", - "DetailPlacementView": "google.ads.googleads.v6.resources.types.detail_placement_view", - "DisplayKeywordView": "google.ads.googleads.v6.resources.types.display_keyword_view", - "DistanceView": "google.ads.googleads.v6.resources.types.distance_view", - "DomainCategory": "google.ads.googleads.v6.resources.types.domain_category", - "DynamicSearchAdsSearchTermView": "google.ads.googleads.v6.resources.types.dynamic_search_ads_search_term_view", - "ExpandedLandingPageView": "google.ads.googleads.v6.resources.types.expanded_landing_page_view", - "ExtensionFeedItem": "google.ads.googleads.v6.resources.types.extension_feed_item", - "Feed": "google.ads.googleads.v6.resources.types.feed", - "FeedAttribute": "google.ads.googleads.v6.resources.types.feed", - "FeedAttributeOperation": "google.ads.googleads.v6.resources.types.feed", - "FeedItem": "google.ads.googleads.v6.resources.types.feed_item", - "FeedItemAttributeValue": "google.ads.googleads.v6.resources.types.feed_item", - "FeedItemPlaceholderPolicyInfo": "google.ads.googleads.v6.resources.types.feed_item", - "FeedItemSet": "google.ads.googleads.v6.resources.types.feed_item_set", - "FeedItemSetLink": "google.ads.googleads.v6.resources.types.feed_item_set_link", - "FeedItemTarget": "google.ads.googleads.v6.resources.types.feed_item_target", - "FeedItemValidationError": "google.ads.googleads.v6.resources.types.feed_item", - "FeedMapping": "google.ads.googleads.v6.resources.types.feed_mapping", - "FeedPlaceholderView": "google.ads.googleads.v6.resources.types.feed_placeholder_view", - "GenderView": "google.ads.googleads.v6.resources.types.gender_view", - "GeographicView": "google.ads.googleads.v6.resources.types.geographic_view", - "GeoTargetConstant": "google.ads.googleads.v6.resources.types.geo_target_constant", - "GoogleAdsField": "google.ads.googleads.v6.resources.types.google_ads_field", - "GoogleAdsLinkIdentifier": "google.ads.googleads.v6.resources.types.account_link", - "GroupPlacementView": "google.ads.googleads.v6.resources.types.group_placement_view", - "HotelGroupView": "google.ads.googleads.v6.resources.types.hotel_group_view", - "HotelPerformanceView": "google.ads.googleads.v6.resources.types.hotel_performance_view", - "IncomeRangeView": "google.ads.googleads.v6.resources.types.income_range_view", - "Invoice": "google.ads.googleads.v6.resources.types.invoice", - "KeywordPlan": "google.ads.googleads.v6.resources.types.keyword_plan", - "KeywordPlanAdGroup": "google.ads.googleads.v6.resources.types.keyword_plan_ad_group", - "KeywordPlanAdGroupKeyword": "google.ads.googleads.v6.resources.types.keyword_plan_ad_group_keyword", - "KeywordPlanCampaign": "google.ads.googleads.v6.resources.types.keyword_plan_campaign", - "KeywordPlanCampaignKeyword": "google.ads.googleads.v6.resources.types.keyword_plan_campaign_keyword", - "KeywordPlanForecastPeriod": "google.ads.googleads.v6.resources.types.keyword_plan", - "KeywordPlanGeoTarget": "google.ads.googleads.v6.resources.types.keyword_plan_campaign", - "KeywordView": "google.ads.googleads.v6.resources.types.keyword_view", - "Label": "google.ads.googleads.v6.resources.types.label", - "LandingPageView": "google.ads.googleads.v6.resources.types.landing_page_view", - "LanguageConstant": "google.ads.googleads.v6.resources.types.language_constant", - "LocationView": "google.ads.googleads.v6.resources.types.location_view", - "ManagedPlacementView": "google.ads.googleads.v6.resources.types.managed_placement_view", - "MediaAudio": "google.ads.googleads.v6.resources.types.media_file", - "MediaBundle": "google.ads.googleads.v6.resources.types.media_file", - "MediaFile": "google.ads.googleads.v6.resources.types.media_file", - "MediaImage": "google.ads.googleads.v6.resources.types.media_file", - "MediaVideo": "google.ads.googleads.v6.resources.types.media_file", - "MerchantCenterLink": "google.ads.googleads.v6.resources.types.merchant_center_link", - "MobileAppCategoryConstant": "google.ads.googleads.v6.resources.types.mobile_app_category_constant", - "MobileDeviceConstant": "google.ads.googleads.v6.resources.types.mobile_device_constant", - "OfflineUserDataJob": "google.ads.googleads.v6.resources.types.offline_user_data_job", - "OperatingSystemVersionConstant": "google.ads.googleads.v6.resources.types.operating_system_version_constant", - "PaidOrganicSearchTermView": "google.ads.googleads.v6.resources.types.paid_organic_search_term_view", - "ParentalStatusView": "google.ads.googleads.v6.resources.types.parental_status_view", - "PaymentsAccount": "google.ads.googleads.v6.resources.types.payments_account", - "ProductBiddingCategoryConstant": "google.ads.googleads.v6.resources.types.product_bidding_category_constant", - "ProductGroupView": "google.ads.googleads.v6.resources.types.product_group_view", - "Recommendation": "google.ads.googleads.v6.resources.types.recommendation", - "RemarketingAction": "google.ads.googleads.v6.resources.types.remarketing_action", - "RemarketingSetting": "google.ads.googleads.v6.resources.types.customer", - "SearchTermView": "google.ads.googleads.v6.resources.types.search_term_view", - "SharedCriterion": "google.ads.googleads.v6.resources.types.shared_criterion", - "SharedSet": "google.ads.googleads.v6.resources.types.shared_set", - "ShoppingPerformanceView": "google.ads.googleads.v6.resources.types.shopping_performance_view", - "ThirdPartyAppAnalyticsLink": "google.ads.googleads.v6.resources.types.third_party_app_analytics_link", - "ThirdPartyAppAnalyticsLinkIdentifier": "google.ads.googleads.v6.resources.types.account_link", - "TopicConstant": "google.ads.googleads.v6.resources.types.topic_constant", - "TopicView": "google.ads.googleads.v6.resources.types.topic_view", - "UserInterest": "google.ads.googleads.v6.resources.types.user_interest", - "UserList": "google.ads.googleads.v6.resources.types.user_list", - "UserLocationView": "google.ads.googleads.v6.resources.types.user_location_view", - "Video": "google.ads.googleads.v6.resources.types.video", - "AccountBudgetProposalOperation": "google.ads.googleads.v6.services.types.account_budget_proposal_service", - "AccountLinkOperation": "google.ads.googleads.v6.services.types.account_link_service", - "AddBatchJobOperationsRequest": "google.ads.googleads.v6.services.types.batch_job_service", - "AddBatchJobOperationsResponse": "google.ads.googleads.v6.services.types.batch_job_service", - "AddOfflineUserDataJobOperationsRequest": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "AddOfflineUserDataJobOperationsResponse": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "AdGroupAdLabelOperation": "google.ads.googleads.v6.services.types.ad_group_ad_label_service", - "AdGroupAdOperation": "google.ads.googleads.v6.services.types.ad_group_ad_service", - "AdGroupBidModifierOperation": "google.ads.googleads.v6.services.types.ad_group_bid_modifier_service", - "AdGroupCriterionLabelOperation": "google.ads.googleads.v6.services.types.ad_group_criterion_label_service", - "AdGroupCriterionOperation": "google.ads.googleads.v6.services.types.ad_group_criterion_service", - "AdGroupExtensionSettingOperation": "google.ads.googleads.v6.services.types.ad_group_extension_setting_service", - "AdGroupFeedOperation": "google.ads.googleads.v6.services.types.ad_group_feed_service", - "AdGroupLabelOperation": "google.ads.googleads.v6.services.types.ad_group_label_service", - "AdGroupOperation": "google.ads.googleads.v6.services.types.ad_group_service", - "AdOperation": "google.ads.googleads.v6.services.types.ad_service", - "AdParameterOperation": "google.ads.googleads.v6.services.types.ad_parameter_service", - "ApplyRecommendationOperation": "google.ads.googleads.v6.services.types.recommendation_service", - "ApplyRecommendationRequest": "google.ads.googleads.v6.services.types.recommendation_service", - "ApplyRecommendationResponse": "google.ads.googleads.v6.services.types.recommendation_service", - "ApplyRecommendationResult": "google.ads.googleads.v6.services.types.recommendation_service", - "AssetOperation": "google.ads.googleads.v6.services.types.asset_service", - "BatchJobOperation": "google.ads.googleads.v6.services.types.batch_job_service", - "BatchJobResult": "google.ads.googleads.v6.services.types.batch_job_service", - "BiddingStrategyOperation": "google.ads.googleads.v6.services.types.bidding_strategy_service", - "BillingSetupOperation": "google.ads.googleads.v6.services.types.billing_setup_service", - "CallConversion": "google.ads.googleads.v6.services.types.conversion_upload_service", - "CallConversionResult": "google.ads.googleads.v6.services.types.conversion_upload_service", - "CampaignAssetOperation": "google.ads.googleads.v6.services.types.campaign_asset_service", - "CampaignBidModifierOperation": "google.ads.googleads.v6.services.types.campaign_bid_modifier_service", - "CampaignBudgetOperation": "google.ads.googleads.v6.services.types.campaign_budget_service", - "CampaignCriterionOperation": "google.ads.googleads.v6.services.types.campaign_criterion_service", - "CampaignDraftOperation": "google.ads.googleads.v6.services.types.campaign_draft_service", - "CampaignDuration": "google.ads.googleads.v6.services.types.reach_plan_service", - "CampaignExperimentOperation": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "CampaignExtensionSettingOperation": "google.ads.googleads.v6.services.types.campaign_extension_setting_service", - "CampaignFeedOperation": "google.ads.googleads.v6.services.types.campaign_feed_service", - "CampaignLabelOperation": "google.ads.googleads.v6.services.types.campaign_label_service", - "CampaignOperation": "google.ads.googleads.v6.services.types.campaign_service", - "CampaignSharedSetOperation": "google.ads.googleads.v6.services.types.campaign_shared_set_service", - "ClickConversion": "google.ads.googleads.v6.services.types.conversion_upload_service", - "ClickConversionResult": "google.ads.googleads.v6.services.types.conversion_upload_service", - "ConversionActionOperation": "google.ads.googleads.v6.services.types.conversion_action_service", - "ConversionAdjustment": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "ConversionAdjustmentResult": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "CreateAccountLinkRequest": "google.ads.googleads.v6.services.types.account_link_service", - "CreateAccountLinkResponse": "google.ads.googleads.v6.services.types.account_link_service", - "CreateCampaignExperimentMetadata": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "CreateCampaignExperimentRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "CreateCustomerClientRequest": "google.ads.googleads.v6.services.types.customer_service", - "CreateCustomerClientResponse": "google.ads.googleads.v6.services.types.customer_service", - "CreateOfflineUserDataJobRequest": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "CreateOfflineUserDataJobResponse": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "CustomAudienceOperation": "google.ads.googleads.v6.services.types.custom_audience_service", - "CustomerClientLinkOperation": "google.ads.googleads.v6.services.types.customer_client_link_service", - "CustomerExtensionSettingOperation": "google.ads.googleads.v6.services.types.customer_extension_setting_service", - "CustomerFeedOperation": "google.ads.googleads.v6.services.types.customer_feed_service", - "CustomerLabelOperation": "google.ads.googleads.v6.services.types.customer_label_service", - "CustomerManagerLinkOperation": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "CustomerNegativeCriterionOperation": "google.ads.googleads.v6.services.types.customer_negative_criterion_service", - "CustomerOperation": "google.ads.googleads.v6.services.types.customer_service", - "CustomerUserAccessInvitationOperation": "google.ads.googleads.v6.services.types.customer_user_access_invitation_service", - "CustomerUserAccessOperation": "google.ads.googleads.v6.services.types.customer_user_access_service", - "CustomInterestOperation": "google.ads.googleads.v6.services.types.custom_interest_service", - "DismissRecommendationRequest": "google.ads.googleads.v6.services.types.recommendation_service", - "DismissRecommendationResponse": "google.ads.googleads.v6.services.types.recommendation_service", - "EndCampaignExperimentRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "ExtensionFeedItemOperation": "google.ads.googleads.v6.services.types.extension_feed_item_service", - "ExternalAttributionData": "google.ads.googleads.v6.services.types.conversion_upload_service", - "FeedItemOperation": "google.ads.googleads.v6.services.types.feed_item_service", - "FeedItemSetLinkOperation": "google.ads.googleads.v6.services.types.feed_item_set_link_service", - "FeedItemSetOperation": "google.ads.googleads.v6.services.types.feed_item_set_service", - "FeedItemTargetOperation": "google.ads.googleads.v6.services.types.feed_item_target_service", - "FeedMappingOperation": "google.ads.googleads.v6.services.types.feed_mapping_service", - "FeedOperation": "google.ads.googleads.v6.services.types.feed_service", - "Forecast": "google.ads.googleads.v6.services.types.reach_plan_service", - "ForecastMetrics": "google.ads.googleads.v6.services.types.keyword_plan_service", - "FrequencyCap": "google.ads.googleads.v6.services.types.reach_plan_service", - "GclidDateTimePair": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "GenerateForecastCurveRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateForecastCurveResponse": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateForecastMetricsRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateForecastMetricsResponse": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateForecastTimeSeriesRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateForecastTimeSeriesResponse": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateHistoricalMetricsRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateHistoricalMetricsResponse": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GenerateKeywordIdeaResponse": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "GenerateKeywordIdeaResult": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "GenerateKeywordIdeasRequest": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "GenerateProductMixIdeasRequest": "google.ads.googleads.v6.services.types.reach_plan_service", - "GenerateProductMixIdeasResponse": "google.ads.googleads.v6.services.types.reach_plan_service", - "GenerateReachForecastRequest": "google.ads.googleads.v6.services.types.reach_plan_service", - "GenerateReachForecastResponse": "google.ads.googleads.v6.services.types.reach_plan_service", - "GeoTargetConstantSuggestion": "google.ads.googleads.v6.services.types.geo_target_constant_service", - "GetAccountBudgetProposalRequest": "google.ads.googleads.v6.services.types.account_budget_proposal_service", - "GetAccountBudgetRequest": "google.ads.googleads.v6.services.types.account_budget_service", - "GetAccountLinkRequest": "google.ads.googleads.v6.services.types.account_link_service", - "GetAdGroupAdAssetViewRequest": "google.ads.googleads.v6.services.types.ad_group_ad_asset_view_service", - "GetAdGroupAdLabelRequest": "google.ads.googleads.v6.services.types.ad_group_ad_label_service", - "GetAdGroupAdRequest": "google.ads.googleads.v6.services.types.ad_group_ad_service", - "GetAdGroupAudienceViewRequest": "google.ads.googleads.v6.services.types.ad_group_audience_view_service", - "GetAdGroupBidModifierRequest": "google.ads.googleads.v6.services.types.ad_group_bid_modifier_service", - "GetAdGroupCriterionLabelRequest": "google.ads.googleads.v6.services.types.ad_group_criterion_label_service", - "GetAdGroupCriterionRequest": "google.ads.googleads.v6.services.types.ad_group_criterion_service", - "GetAdGroupCriterionSimulationRequest": "google.ads.googleads.v6.services.types.ad_group_criterion_simulation_service", - "GetAdGroupExtensionSettingRequest": "google.ads.googleads.v6.services.types.ad_group_extension_setting_service", - "GetAdGroupFeedRequest": "google.ads.googleads.v6.services.types.ad_group_feed_service", - "GetAdGroupLabelRequest": "google.ads.googleads.v6.services.types.ad_group_label_service", - "GetAdGroupRequest": "google.ads.googleads.v6.services.types.ad_group_service", - "GetAdGroupSimulationRequest": "google.ads.googleads.v6.services.types.ad_group_simulation_service", - "GetAdParameterRequest": "google.ads.googleads.v6.services.types.ad_parameter_service", - "GetAdRequest": "google.ads.googleads.v6.services.types.ad_service", - "GetAdScheduleViewRequest": "google.ads.googleads.v6.services.types.ad_schedule_view_service", - "GetAgeRangeViewRequest": "google.ads.googleads.v6.services.types.age_range_view_service", - "GetAssetRequest": "google.ads.googleads.v6.services.types.asset_service", - "GetBatchJobRequest": "google.ads.googleads.v6.services.types.batch_job_service", - "GetBiddingStrategyRequest": "google.ads.googleads.v6.services.types.bidding_strategy_service", - "GetBillingSetupRequest": "google.ads.googleads.v6.services.types.billing_setup_service", - "GetCampaignAssetRequest": "google.ads.googleads.v6.services.types.campaign_asset_service", - "GetCampaignAudienceViewRequest": "google.ads.googleads.v6.services.types.campaign_audience_view_service", - "GetCampaignBidModifierRequest": "google.ads.googleads.v6.services.types.campaign_bid_modifier_service", - "GetCampaignBudgetRequest": "google.ads.googleads.v6.services.types.campaign_budget_service", - "GetCampaignCriterionRequest": "google.ads.googleads.v6.services.types.campaign_criterion_service", - "GetCampaignCriterionSimulationRequest": "google.ads.googleads.v6.services.types.campaign_criterion_simulation_service", - "GetCampaignDraftRequest": "google.ads.googleads.v6.services.types.campaign_draft_service", - "GetCampaignExperimentRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "GetCampaignExtensionSettingRequest": "google.ads.googleads.v6.services.types.campaign_extension_setting_service", - "GetCampaignFeedRequest": "google.ads.googleads.v6.services.types.campaign_feed_service", - "GetCampaignLabelRequest": "google.ads.googleads.v6.services.types.campaign_label_service", - "GetCampaignRequest": "google.ads.googleads.v6.services.types.campaign_service", - "GetCampaignSharedSetRequest": "google.ads.googleads.v6.services.types.campaign_shared_set_service", - "GetCarrierConstantRequest": "google.ads.googleads.v6.services.types.carrier_constant_service", - "GetChangeStatusRequest": "google.ads.googleads.v6.services.types.change_status_service", - "GetClickViewRequest": "google.ads.googleads.v6.services.types.click_view_service", - "GetCombinedAudienceRequest": "google.ads.googleads.v6.services.types.combined_audience_service", - "GetConversionActionRequest": "google.ads.googleads.v6.services.types.conversion_action_service", - "GetCurrencyConstantRequest": "google.ads.googleads.v6.services.types.currency_constant_service", - "GetCustomAudienceRequest": "google.ads.googleads.v6.services.types.custom_audience_service", - "GetCustomerClientLinkRequest": "google.ads.googleads.v6.services.types.customer_client_link_service", - "GetCustomerClientRequest": "google.ads.googleads.v6.services.types.customer_client_service", - "GetCustomerExtensionSettingRequest": "google.ads.googleads.v6.services.types.customer_extension_setting_service", - "GetCustomerFeedRequest": "google.ads.googleads.v6.services.types.customer_feed_service", - "GetCustomerLabelRequest": "google.ads.googleads.v6.services.types.customer_label_service", - "GetCustomerManagerLinkRequest": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "GetCustomerNegativeCriterionRequest": "google.ads.googleads.v6.services.types.customer_negative_criterion_service", - "GetCustomerRequest": "google.ads.googleads.v6.services.types.customer_service", - "GetCustomerUserAccessInvitationRequest": "google.ads.googleads.v6.services.types.customer_user_access_invitation_service", - "GetCustomerUserAccessRequest": "google.ads.googleads.v6.services.types.customer_user_access_service", - "GetCustomInterestRequest": "google.ads.googleads.v6.services.types.custom_interest_service", - "GetDetailPlacementViewRequest": "google.ads.googleads.v6.services.types.detail_placement_view_service", - "GetDisplayKeywordViewRequest": "google.ads.googleads.v6.services.types.display_keyword_view_service", - "GetDistanceViewRequest": "google.ads.googleads.v6.services.types.distance_view_service", - "GetDomainCategoryRequest": "google.ads.googleads.v6.services.types.domain_category_service", - "GetDynamicSearchAdsSearchTermViewRequest": "google.ads.googleads.v6.services.types.dynamic_search_ads_search_term_view_service", - "GetExpandedLandingPageViewRequest": "google.ads.googleads.v6.services.types.expanded_landing_page_view_service", - "GetExtensionFeedItemRequest": "google.ads.googleads.v6.services.types.extension_feed_item_service", - "GetFeedItemRequest": "google.ads.googleads.v6.services.types.feed_item_service", - "GetFeedItemSetLinkRequest": "google.ads.googleads.v6.services.types.feed_item_set_link_service", - "GetFeedItemSetRequest": "google.ads.googleads.v6.services.types.feed_item_set_service", - "GetFeedItemTargetRequest": "google.ads.googleads.v6.services.types.feed_item_target_service", - "GetFeedMappingRequest": "google.ads.googleads.v6.services.types.feed_mapping_service", - "GetFeedPlaceholderViewRequest": "google.ads.googleads.v6.services.types.feed_placeholder_view_service", - "GetFeedRequest": "google.ads.googleads.v6.services.types.feed_service", - "GetGenderViewRequest": "google.ads.googleads.v6.services.types.gender_view_service", - "GetGeographicViewRequest": "google.ads.googleads.v6.services.types.geographic_view_service", - "GetGeoTargetConstantRequest": "google.ads.googleads.v6.services.types.geo_target_constant_service", - "GetGoogleAdsFieldRequest": "google.ads.googleads.v6.services.types.google_ads_field_service", - "GetGroupPlacementViewRequest": "google.ads.googleads.v6.services.types.group_placement_view_service", - "GetHotelGroupViewRequest": "google.ads.googleads.v6.services.types.hotel_group_view_service", - "GetHotelPerformanceViewRequest": "google.ads.googleads.v6.services.types.hotel_performance_view_service", - "GetIncomeRangeViewRequest": "google.ads.googleads.v6.services.types.income_range_view_service", - "GetKeywordPlanAdGroupKeywordRequest": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_keyword_service", - "GetKeywordPlanAdGroupRequest": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_service", - "GetKeywordPlanCampaignKeywordRequest": "google.ads.googleads.v6.services.types.keyword_plan_campaign_keyword_service", - "GetKeywordPlanCampaignRequest": "google.ads.googleads.v6.services.types.keyword_plan_campaign_service", - "GetKeywordPlanRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "GetKeywordViewRequest": "google.ads.googleads.v6.services.types.keyword_view_service", - "GetLabelRequest": "google.ads.googleads.v6.services.types.label_service", - "GetLandingPageViewRequest": "google.ads.googleads.v6.services.types.landing_page_view_service", - "GetLanguageConstantRequest": "google.ads.googleads.v6.services.types.language_constant_service", - "GetLocationViewRequest": "google.ads.googleads.v6.services.types.location_view_service", - "GetManagedPlacementViewRequest": "google.ads.googleads.v6.services.types.managed_placement_view_service", - "GetMediaFileRequest": "google.ads.googleads.v6.services.types.media_file_service", - "GetMerchantCenterLinkRequest": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "GetMobileAppCategoryConstantRequest": "google.ads.googleads.v6.services.types.mobile_app_category_constant_service", - "GetMobileDeviceConstantRequest": "google.ads.googleads.v6.services.types.mobile_device_constant_service", - "GetOfflineUserDataJobRequest": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "GetOperatingSystemVersionConstantRequest": "google.ads.googleads.v6.services.types.operating_system_version_constant_service", - "GetPaidOrganicSearchTermViewRequest": "google.ads.googleads.v6.services.types.paid_organic_search_term_view_service", - "GetParentalStatusViewRequest": "google.ads.googleads.v6.services.types.parental_status_view_service", - "GetProductBiddingCategoryConstantRequest": "google.ads.googleads.v6.services.types.product_bidding_category_constant_service", - "GetProductGroupViewRequest": "google.ads.googleads.v6.services.types.product_group_view_service", - "GetRecommendationRequest": "google.ads.googleads.v6.services.types.recommendation_service", - "GetRemarketingActionRequest": "google.ads.googleads.v6.services.types.remarketing_action_service", - "GetSearchTermViewRequest": "google.ads.googleads.v6.services.types.search_term_view_service", - "GetSharedCriterionRequest": "google.ads.googleads.v6.services.types.shared_criterion_service", - "GetSharedSetRequest": "google.ads.googleads.v6.services.types.shared_set_service", - "GetShoppingPerformanceViewRequest": "google.ads.googleads.v6.services.types.shopping_performance_view_service", - "GetThirdPartyAppAnalyticsLinkRequest": "google.ads.googleads.v6.services.types.third_party_app_analytics_link_service", - "GetTopicConstantRequest": "google.ads.googleads.v6.services.types.topic_constant_service", - "GetTopicViewRequest": "google.ads.googleads.v6.services.types.topic_view_service", - "GetUserInterestRequest": "google.ads.googleads.v6.services.types.user_interest_service", - "GetUserListRequest": "google.ads.googleads.v6.services.types.user_list_service", - "GetUserLocationViewRequest": "google.ads.googleads.v6.services.types.user_location_view_service", - "GetVideoRequest": "google.ads.googleads.v6.services.types.video_service", - "GoogleAdsRow": "google.ads.googleads.v6.services.types.google_ads_service", - "GraduateCampaignExperimentRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "GraduateCampaignExperimentResponse": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "KeywordAndUrlSeed": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "KeywordPlanAdGroupForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanAdGroupKeywordOperation": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_keyword_service", - "KeywordPlanAdGroupOperation": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_service", - "KeywordPlanCampaignForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanCampaignForecastCurve": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanCampaignKeywordOperation": "google.ads.googleads.v6.services.types.keyword_plan_campaign_keyword_service", - "KeywordPlanCampaignOperation": "google.ads.googleads.v6.services.types.keyword_plan_campaign_service", - "KeywordPlanKeywordForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanKeywordHistoricalMetrics": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanMaxCpcBidForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanMaxCpcBidForecastCurve": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanOperation": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanWeeklyForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordPlanWeeklyTimeSeriesForecast": "google.ads.googleads.v6.services.types.keyword_plan_service", - "KeywordSeed": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "LabelOperation": "google.ads.googleads.v6.services.types.label_service", - "ListAccessibleCustomersRequest": "google.ads.googleads.v6.services.types.customer_service", - "ListAccessibleCustomersResponse": "google.ads.googleads.v6.services.types.customer_service", - "ListBatchJobResultsRequest": "google.ads.googleads.v6.services.types.batch_job_service", - "ListBatchJobResultsResponse": "google.ads.googleads.v6.services.types.batch_job_service", - "ListCampaignDraftAsyncErrorsRequest": "google.ads.googleads.v6.services.types.campaign_draft_service", - "ListCampaignDraftAsyncErrorsResponse": "google.ads.googleads.v6.services.types.campaign_draft_service", - "ListCampaignExperimentAsyncErrorsRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "ListCampaignExperimentAsyncErrorsResponse": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "ListInvoicesRequest": "google.ads.googleads.v6.services.types.invoice_service", - "ListInvoicesResponse": "google.ads.googleads.v6.services.types.invoice_service", - "ListMerchantCenterLinksRequest": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "ListMerchantCenterLinksResponse": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "ListPaymentsAccountsRequest": "google.ads.googleads.v6.services.types.payments_account_service", - "ListPaymentsAccountsResponse": "google.ads.googleads.v6.services.types.payments_account_service", - "ListPlannableLocationsRequest": "google.ads.googleads.v6.services.types.reach_plan_service", - "ListPlannableLocationsResponse": "google.ads.googleads.v6.services.types.reach_plan_service", - "ListPlannableProductsRequest": "google.ads.googleads.v6.services.types.reach_plan_service", - "ListPlannableProductsResponse": "google.ads.googleads.v6.services.types.reach_plan_service", - "MediaFileOperation": "google.ads.googleads.v6.services.types.media_file_service", - "MerchantCenterLinkOperation": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "MoveManagerLinkRequest": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "MoveManagerLinkResponse": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "MutateAccountBudgetProposalRequest": "google.ads.googleads.v6.services.types.account_budget_proposal_service", - "MutateAccountBudgetProposalResponse": "google.ads.googleads.v6.services.types.account_budget_proposal_service", - "MutateAccountBudgetProposalResult": "google.ads.googleads.v6.services.types.account_budget_proposal_service", - "MutateAccountLinkRequest": "google.ads.googleads.v6.services.types.account_link_service", - "MutateAccountLinkResponse": "google.ads.googleads.v6.services.types.account_link_service", - "MutateAccountLinkResult": "google.ads.googleads.v6.services.types.account_link_service", - "MutateAdGroupAdLabelResult": "google.ads.googleads.v6.services.types.ad_group_ad_label_service", - "MutateAdGroupAdLabelsRequest": "google.ads.googleads.v6.services.types.ad_group_ad_label_service", - "MutateAdGroupAdLabelsResponse": "google.ads.googleads.v6.services.types.ad_group_ad_label_service", - "MutateAdGroupAdResult": "google.ads.googleads.v6.services.types.ad_group_ad_service", - "MutateAdGroupAdsRequest": "google.ads.googleads.v6.services.types.ad_group_ad_service", - "MutateAdGroupAdsResponse": "google.ads.googleads.v6.services.types.ad_group_ad_service", - "MutateAdGroupBidModifierResult": "google.ads.googleads.v6.services.types.ad_group_bid_modifier_service", - "MutateAdGroupBidModifiersRequest": "google.ads.googleads.v6.services.types.ad_group_bid_modifier_service", - "MutateAdGroupBidModifiersResponse": "google.ads.googleads.v6.services.types.ad_group_bid_modifier_service", - "MutateAdGroupCriteriaRequest": "google.ads.googleads.v6.services.types.ad_group_criterion_service", - "MutateAdGroupCriteriaResponse": "google.ads.googleads.v6.services.types.ad_group_criterion_service", - "MutateAdGroupCriterionLabelResult": "google.ads.googleads.v6.services.types.ad_group_criterion_label_service", - "MutateAdGroupCriterionLabelsRequest": "google.ads.googleads.v6.services.types.ad_group_criterion_label_service", - "MutateAdGroupCriterionLabelsResponse": "google.ads.googleads.v6.services.types.ad_group_criterion_label_service", - "MutateAdGroupCriterionResult": "google.ads.googleads.v6.services.types.ad_group_criterion_service", - "MutateAdGroupExtensionSettingResult": "google.ads.googleads.v6.services.types.ad_group_extension_setting_service", - "MutateAdGroupExtensionSettingsRequest": "google.ads.googleads.v6.services.types.ad_group_extension_setting_service", - "MutateAdGroupExtensionSettingsResponse": "google.ads.googleads.v6.services.types.ad_group_extension_setting_service", - "MutateAdGroupFeedResult": "google.ads.googleads.v6.services.types.ad_group_feed_service", - "MutateAdGroupFeedsRequest": "google.ads.googleads.v6.services.types.ad_group_feed_service", - "MutateAdGroupFeedsResponse": "google.ads.googleads.v6.services.types.ad_group_feed_service", - "MutateAdGroupLabelResult": "google.ads.googleads.v6.services.types.ad_group_label_service", - "MutateAdGroupLabelsRequest": "google.ads.googleads.v6.services.types.ad_group_label_service", - "MutateAdGroupLabelsResponse": "google.ads.googleads.v6.services.types.ad_group_label_service", - "MutateAdGroupResult": "google.ads.googleads.v6.services.types.ad_group_service", - "MutateAdGroupsRequest": "google.ads.googleads.v6.services.types.ad_group_service", - "MutateAdGroupsResponse": "google.ads.googleads.v6.services.types.ad_group_service", - "MutateAdParameterResult": "google.ads.googleads.v6.services.types.ad_parameter_service", - "MutateAdParametersRequest": "google.ads.googleads.v6.services.types.ad_parameter_service", - "MutateAdParametersResponse": "google.ads.googleads.v6.services.types.ad_parameter_service", - "MutateAdResult": "google.ads.googleads.v6.services.types.ad_service", - "MutateAdsRequest": "google.ads.googleads.v6.services.types.ad_service", - "MutateAdsResponse": "google.ads.googleads.v6.services.types.ad_service", - "MutateAssetResult": "google.ads.googleads.v6.services.types.asset_service", - "MutateAssetsRequest": "google.ads.googleads.v6.services.types.asset_service", - "MutateAssetsResponse": "google.ads.googleads.v6.services.types.asset_service", - "MutateBatchJobRequest": "google.ads.googleads.v6.services.types.batch_job_service", - "MutateBatchJobResponse": "google.ads.googleads.v6.services.types.batch_job_service", - "MutateBatchJobResult": "google.ads.googleads.v6.services.types.batch_job_service", - "MutateBiddingStrategiesRequest": "google.ads.googleads.v6.services.types.bidding_strategy_service", - "MutateBiddingStrategiesResponse": "google.ads.googleads.v6.services.types.bidding_strategy_service", - "MutateBiddingStrategyResult": "google.ads.googleads.v6.services.types.bidding_strategy_service", - "MutateBillingSetupRequest": "google.ads.googleads.v6.services.types.billing_setup_service", - "MutateBillingSetupResponse": "google.ads.googleads.v6.services.types.billing_setup_service", - "MutateBillingSetupResult": "google.ads.googleads.v6.services.types.billing_setup_service", - "MutateCampaignAssetResult": "google.ads.googleads.v6.services.types.campaign_asset_service", - "MutateCampaignAssetsRequest": "google.ads.googleads.v6.services.types.campaign_asset_service", - "MutateCampaignAssetsResponse": "google.ads.googleads.v6.services.types.campaign_asset_service", - "MutateCampaignBidModifierResult": "google.ads.googleads.v6.services.types.campaign_bid_modifier_service", - "MutateCampaignBidModifiersRequest": "google.ads.googleads.v6.services.types.campaign_bid_modifier_service", - "MutateCampaignBidModifiersResponse": "google.ads.googleads.v6.services.types.campaign_bid_modifier_service", - "MutateCampaignBudgetResult": "google.ads.googleads.v6.services.types.campaign_budget_service", - "MutateCampaignBudgetsRequest": "google.ads.googleads.v6.services.types.campaign_budget_service", - "MutateCampaignBudgetsResponse": "google.ads.googleads.v6.services.types.campaign_budget_service", - "MutateCampaignCriteriaRequest": "google.ads.googleads.v6.services.types.campaign_criterion_service", - "MutateCampaignCriteriaResponse": "google.ads.googleads.v6.services.types.campaign_criterion_service", - "MutateCampaignCriterionResult": "google.ads.googleads.v6.services.types.campaign_criterion_service", - "MutateCampaignDraftResult": "google.ads.googleads.v6.services.types.campaign_draft_service", - "MutateCampaignDraftsRequest": "google.ads.googleads.v6.services.types.campaign_draft_service", - "MutateCampaignDraftsResponse": "google.ads.googleads.v6.services.types.campaign_draft_service", - "MutateCampaignExperimentResult": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "MutateCampaignExperimentsRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "MutateCampaignExperimentsResponse": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "MutateCampaignExtensionSettingResult": "google.ads.googleads.v6.services.types.campaign_extension_setting_service", - "MutateCampaignExtensionSettingsRequest": "google.ads.googleads.v6.services.types.campaign_extension_setting_service", - "MutateCampaignExtensionSettingsResponse": "google.ads.googleads.v6.services.types.campaign_extension_setting_service", - "MutateCampaignFeedResult": "google.ads.googleads.v6.services.types.campaign_feed_service", - "MutateCampaignFeedsRequest": "google.ads.googleads.v6.services.types.campaign_feed_service", - "MutateCampaignFeedsResponse": "google.ads.googleads.v6.services.types.campaign_feed_service", - "MutateCampaignLabelResult": "google.ads.googleads.v6.services.types.campaign_label_service", - "MutateCampaignLabelsRequest": "google.ads.googleads.v6.services.types.campaign_label_service", - "MutateCampaignLabelsResponse": "google.ads.googleads.v6.services.types.campaign_label_service", - "MutateCampaignResult": "google.ads.googleads.v6.services.types.campaign_service", - "MutateCampaignSharedSetResult": "google.ads.googleads.v6.services.types.campaign_shared_set_service", - "MutateCampaignSharedSetsRequest": "google.ads.googleads.v6.services.types.campaign_shared_set_service", - "MutateCampaignSharedSetsResponse": "google.ads.googleads.v6.services.types.campaign_shared_set_service", - "MutateCampaignsRequest": "google.ads.googleads.v6.services.types.campaign_service", - "MutateCampaignsResponse": "google.ads.googleads.v6.services.types.campaign_service", - "MutateConversionActionResult": "google.ads.googleads.v6.services.types.conversion_action_service", - "MutateConversionActionsRequest": "google.ads.googleads.v6.services.types.conversion_action_service", - "MutateConversionActionsResponse": "google.ads.googleads.v6.services.types.conversion_action_service", - "MutateCustomAudienceResult": "google.ads.googleads.v6.services.types.custom_audience_service", - "MutateCustomAudiencesRequest": "google.ads.googleads.v6.services.types.custom_audience_service", - "MutateCustomAudiencesResponse": "google.ads.googleads.v6.services.types.custom_audience_service", - "MutateCustomerClientLinkRequest": "google.ads.googleads.v6.services.types.customer_client_link_service", - "MutateCustomerClientLinkResponse": "google.ads.googleads.v6.services.types.customer_client_link_service", - "MutateCustomerClientLinkResult": "google.ads.googleads.v6.services.types.customer_client_link_service", - "MutateCustomerExtensionSettingResult": "google.ads.googleads.v6.services.types.customer_extension_setting_service", - "MutateCustomerExtensionSettingsRequest": "google.ads.googleads.v6.services.types.customer_extension_setting_service", - "MutateCustomerExtensionSettingsResponse": "google.ads.googleads.v6.services.types.customer_extension_setting_service", - "MutateCustomerFeedResult": "google.ads.googleads.v6.services.types.customer_feed_service", - "MutateCustomerFeedsRequest": "google.ads.googleads.v6.services.types.customer_feed_service", - "MutateCustomerFeedsResponse": "google.ads.googleads.v6.services.types.customer_feed_service", - "MutateCustomerLabelResult": "google.ads.googleads.v6.services.types.customer_label_service", - "MutateCustomerLabelsRequest": "google.ads.googleads.v6.services.types.customer_label_service", - "MutateCustomerLabelsResponse": "google.ads.googleads.v6.services.types.customer_label_service", - "MutateCustomerManagerLinkRequest": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "MutateCustomerManagerLinkResponse": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "MutateCustomerManagerLinkResult": "google.ads.googleads.v6.services.types.customer_manager_link_service", - "MutateCustomerNegativeCriteriaRequest": "google.ads.googleads.v6.services.types.customer_negative_criterion_service", - "MutateCustomerNegativeCriteriaResponse": "google.ads.googleads.v6.services.types.customer_negative_criterion_service", - "MutateCustomerNegativeCriteriaResult": "google.ads.googleads.v6.services.types.customer_negative_criterion_service", - "MutateCustomerRequest": "google.ads.googleads.v6.services.types.customer_service", - "MutateCustomerResponse": "google.ads.googleads.v6.services.types.customer_service", - "MutateCustomerResult": "google.ads.googleads.v6.services.types.customer_service", - "MutateCustomerUserAccessInvitationRequest": "google.ads.googleads.v6.services.types.customer_user_access_invitation_service", - "MutateCustomerUserAccessInvitationResponse": "google.ads.googleads.v6.services.types.customer_user_access_invitation_service", - "MutateCustomerUserAccessInvitationResult": "google.ads.googleads.v6.services.types.customer_user_access_invitation_service", - "MutateCustomerUserAccessRequest": "google.ads.googleads.v6.services.types.customer_user_access_service", - "MutateCustomerUserAccessResponse": "google.ads.googleads.v6.services.types.customer_user_access_service", - "MutateCustomerUserAccessResult": "google.ads.googleads.v6.services.types.customer_user_access_service", - "MutateCustomInterestResult": "google.ads.googleads.v6.services.types.custom_interest_service", - "MutateCustomInterestsRequest": "google.ads.googleads.v6.services.types.custom_interest_service", - "MutateCustomInterestsResponse": "google.ads.googleads.v6.services.types.custom_interest_service", - "MutateExtensionFeedItemResult": "google.ads.googleads.v6.services.types.extension_feed_item_service", - "MutateExtensionFeedItemsRequest": "google.ads.googleads.v6.services.types.extension_feed_item_service", - "MutateExtensionFeedItemsResponse": "google.ads.googleads.v6.services.types.extension_feed_item_service", - "MutateFeedItemResult": "google.ads.googleads.v6.services.types.feed_item_service", - "MutateFeedItemSetLinkResult": "google.ads.googleads.v6.services.types.feed_item_set_link_service", - "MutateFeedItemSetLinksRequest": "google.ads.googleads.v6.services.types.feed_item_set_link_service", - "MutateFeedItemSetLinksResponse": "google.ads.googleads.v6.services.types.feed_item_set_link_service", - "MutateFeedItemSetResult": "google.ads.googleads.v6.services.types.feed_item_set_service", - "MutateFeedItemSetsRequest": "google.ads.googleads.v6.services.types.feed_item_set_service", - "MutateFeedItemSetsResponse": "google.ads.googleads.v6.services.types.feed_item_set_service", - "MutateFeedItemsRequest": "google.ads.googleads.v6.services.types.feed_item_service", - "MutateFeedItemsResponse": "google.ads.googleads.v6.services.types.feed_item_service", - "MutateFeedItemTargetResult": "google.ads.googleads.v6.services.types.feed_item_target_service", - "MutateFeedItemTargetsRequest": "google.ads.googleads.v6.services.types.feed_item_target_service", - "MutateFeedItemTargetsResponse": "google.ads.googleads.v6.services.types.feed_item_target_service", - "MutateFeedMappingResult": "google.ads.googleads.v6.services.types.feed_mapping_service", - "MutateFeedMappingsRequest": "google.ads.googleads.v6.services.types.feed_mapping_service", - "MutateFeedMappingsResponse": "google.ads.googleads.v6.services.types.feed_mapping_service", - "MutateFeedResult": "google.ads.googleads.v6.services.types.feed_service", - "MutateFeedsRequest": "google.ads.googleads.v6.services.types.feed_service", - "MutateFeedsResponse": "google.ads.googleads.v6.services.types.feed_service", - "MutateGoogleAdsRequest": "google.ads.googleads.v6.services.types.google_ads_service", - "MutateGoogleAdsResponse": "google.ads.googleads.v6.services.types.google_ads_service", - "MutateKeywordPlanAdGroupKeywordResult": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_keyword_service", - "MutateKeywordPlanAdGroupKeywordsRequest": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_keyword_service", - "MutateKeywordPlanAdGroupKeywordsResponse": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_keyword_service", - "MutateKeywordPlanAdGroupResult": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_service", - "MutateKeywordPlanAdGroupsRequest": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_service", - "MutateKeywordPlanAdGroupsResponse": "google.ads.googleads.v6.services.types.keyword_plan_ad_group_service", - "MutateKeywordPlanCampaignKeywordResult": "google.ads.googleads.v6.services.types.keyword_plan_campaign_keyword_service", - "MutateKeywordPlanCampaignKeywordsRequest": "google.ads.googleads.v6.services.types.keyword_plan_campaign_keyword_service", - "MutateKeywordPlanCampaignKeywordsResponse": "google.ads.googleads.v6.services.types.keyword_plan_campaign_keyword_service", - "MutateKeywordPlanCampaignResult": "google.ads.googleads.v6.services.types.keyword_plan_campaign_service", - "MutateKeywordPlanCampaignsRequest": "google.ads.googleads.v6.services.types.keyword_plan_campaign_service", - "MutateKeywordPlanCampaignsResponse": "google.ads.googleads.v6.services.types.keyword_plan_campaign_service", - "MutateKeywordPlansRequest": "google.ads.googleads.v6.services.types.keyword_plan_service", - "MutateKeywordPlansResponse": "google.ads.googleads.v6.services.types.keyword_plan_service", - "MutateKeywordPlansResult": "google.ads.googleads.v6.services.types.keyword_plan_service", - "MutateLabelResult": "google.ads.googleads.v6.services.types.label_service", - "MutateLabelsRequest": "google.ads.googleads.v6.services.types.label_service", - "MutateLabelsResponse": "google.ads.googleads.v6.services.types.label_service", - "MutateMediaFileResult": "google.ads.googleads.v6.services.types.media_file_service", - "MutateMediaFilesRequest": "google.ads.googleads.v6.services.types.media_file_service", - "MutateMediaFilesResponse": "google.ads.googleads.v6.services.types.media_file_service", - "MutateMerchantCenterLinkRequest": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "MutateMerchantCenterLinkResponse": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "MutateMerchantCenterLinkResult": "google.ads.googleads.v6.services.types.merchant_center_link_service", - "MutateOperation": "google.ads.googleads.v6.services.types.google_ads_service", - "MutateOperationResponse": "google.ads.googleads.v6.services.types.google_ads_service", - "MutateRemarketingActionResult": "google.ads.googleads.v6.services.types.remarketing_action_service", - "MutateRemarketingActionsRequest": "google.ads.googleads.v6.services.types.remarketing_action_service", - "MutateRemarketingActionsResponse": "google.ads.googleads.v6.services.types.remarketing_action_service", - "MutateSharedCriteriaRequest": "google.ads.googleads.v6.services.types.shared_criterion_service", - "MutateSharedCriteriaResponse": "google.ads.googleads.v6.services.types.shared_criterion_service", - "MutateSharedCriterionResult": "google.ads.googleads.v6.services.types.shared_criterion_service", - "MutateSharedSetResult": "google.ads.googleads.v6.services.types.shared_set_service", - "MutateSharedSetsRequest": "google.ads.googleads.v6.services.types.shared_set_service", - "MutateSharedSetsResponse": "google.ads.googleads.v6.services.types.shared_set_service", - "MutateUserListResult": "google.ads.googleads.v6.services.types.user_list_service", - "MutateUserListsRequest": "google.ads.googleads.v6.services.types.user_list_service", - "MutateUserListsResponse": "google.ads.googleads.v6.services.types.user_list_service", - "OfflineUserDataJobOperation": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "OnTargetAudienceMetrics": "google.ads.googleads.v6.services.types.reach_plan_service", - "PlannableLocation": "google.ads.googleads.v6.services.types.reach_plan_service", - "PlannableTargeting": "google.ads.googleads.v6.services.types.reach_plan_service", - "PlannedProduct": "google.ads.googleads.v6.services.types.reach_plan_service", - "PlannedProductForecast": "google.ads.googleads.v6.services.types.reach_plan_service", - "PlannedProductReachForecast": "google.ads.googleads.v6.services.types.reach_plan_service", - "Preferences": "google.ads.googleads.v6.services.types.reach_plan_service", - "ProductAllocation": "google.ads.googleads.v6.services.types.reach_plan_service", - "ProductMetadata": "google.ads.googleads.v6.services.types.reach_plan_service", - "PromoteCampaignDraftRequest": "google.ads.googleads.v6.services.types.campaign_draft_service", - "PromoteCampaignExperimentRequest": "google.ads.googleads.v6.services.types.campaign_experiment_service", - "ReachCurve": "google.ads.googleads.v6.services.types.reach_plan_service", - "ReachForecast": "google.ads.googleads.v6.services.types.reach_plan_service", - "RegenerateShareableLinkIdRequest": "google.ads.googleads.v6.services.types.third_party_app_analytics_link_service", - "RegenerateShareableLinkIdResponse": "google.ads.googleads.v6.services.types.third_party_app_analytics_link_service", - "RemarketingActionOperation": "google.ads.googleads.v6.services.types.remarketing_action_service", - "RestatementValue": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "RunBatchJobRequest": "google.ads.googleads.v6.services.types.batch_job_service", - "RunOfflineUserDataJobRequest": "google.ads.googleads.v6.services.types.offline_user_data_job_service", - "SearchGoogleAdsFieldsRequest": "google.ads.googleads.v6.services.types.google_ads_field_service", - "SearchGoogleAdsFieldsResponse": "google.ads.googleads.v6.services.types.google_ads_field_service", - "SearchGoogleAdsRequest": "google.ads.googleads.v6.services.types.google_ads_service", - "SearchGoogleAdsResponse": "google.ads.googleads.v6.services.types.google_ads_service", - "SearchGoogleAdsStreamRequest": "google.ads.googleads.v6.services.types.google_ads_service", - "SearchGoogleAdsStreamResponse": "google.ads.googleads.v6.services.types.google_ads_service", - "SharedCriterionOperation": "google.ads.googleads.v6.services.types.shared_criterion_service", - "SharedSetOperation": "google.ads.googleads.v6.services.types.shared_set_service", - "SiteSeed": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "SuggestGeoTargetConstantsRequest": "google.ads.googleads.v6.services.types.geo_target_constant_service", - "SuggestGeoTargetConstantsResponse": "google.ads.googleads.v6.services.types.geo_target_constant_service", - "Targeting": "google.ads.googleads.v6.services.types.reach_plan_service", - "UploadCallConversionsRequest": "google.ads.googleads.v6.services.types.conversion_upload_service", - "UploadCallConversionsResponse": "google.ads.googleads.v6.services.types.conversion_upload_service", - "UploadClickConversionsRequest": "google.ads.googleads.v6.services.types.conversion_upload_service", - "UploadClickConversionsResponse": "google.ads.googleads.v6.services.types.conversion_upload_service", - "UploadConversionAdjustmentsRequest": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "UploadConversionAdjustmentsResponse": "google.ads.googleads.v6.services.types.conversion_adjustment_upload_service", - "UploadUserDataRequest": "google.ads.googleads.v6.services.types.user_data_service", - "UploadUserDataResponse": "google.ads.googleads.v6.services.types.user_data_service", - "UrlSeed": "google.ads.googleads.v6.services.types.keyword_plan_idea_service", - "UserDataOperation": "google.ads.googleads.v6.services.types.user_data_service", - "UserListOperation": "google.ads.googleads.v6.services.types.user_list_service", - # Enum types - # Client classes and transports - "AccountBudgetProposalServiceClient": "google.ads.googleads.v6.services.services.account_budget_proposal_service", - "AccountBudgetProposalServiceTransport": "google.ads.googleads.v6.services.services.account_budget_proposal_service.transports", - "AccountBudgetProposalServiceGrpcTransport": "google.ads.googleads.v6.services.services.account_budget_proposal_service.transports", - "AccountBudgetServiceClient": "google.ads.googleads.v6.services.services.account_budget_service", - "AccountBudgetServiceTransport": "google.ads.googleads.v6.services.services.account_budget_service.transports", - "AccountBudgetServiceGrpcTransport": "google.ads.googleads.v6.services.services.account_budget_service.transports", - "AccountLinkServiceClient": "google.ads.googleads.v6.services.services.account_link_service", - "AccountLinkServiceTransport": "google.ads.googleads.v6.services.services.account_link_service.transports", - "AccountLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.account_link_service.transports", - "AdGroupAdAssetViewServiceClient": "google.ads.googleads.v6.services.services.ad_group_ad_asset_view_service", - "AdGroupAdAssetViewServiceTransport": "google.ads.googleads.v6.services.services.ad_group_ad_asset_view_service.transports", - "AdGroupAdAssetViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_ad_asset_view_service.transports", - "AdGroupAdLabelServiceClient": "google.ads.googleads.v6.services.services.ad_group_ad_label_service", - "AdGroupAdLabelServiceTransport": "google.ads.googleads.v6.services.services.ad_group_ad_label_service.transports", - "AdGroupAdLabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_ad_label_service.transports", - "AdGroupAdServiceClient": "google.ads.googleads.v6.services.services.ad_group_ad_service", - "AdGroupAdServiceTransport": "google.ads.googleads.v6.services.services.ad_group_ad_service.transports", - "AdGroupAdServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_ad_service.transports", - "AdGroupAudienceViewServiceClient": "google.ads.googleads.v6.services.services.ad_group_audience_view_service", - "AdGroupAudienceViewServiceTransport": "google.ads.googleads.v6.services.services.ad_group_audience_view_service.transports", - "AdGroupAudienceViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_audience_view_service.transports", - "AdGroupBidModifierServiceClient": "google.ads.googleads.v6.services.services.ad_group_bid_modifier_service", - "AdGroupBidModifierServiceTransport": "google.ads.googleads.v6.services.services.ad_group_bid_modifier_service.transports", - "AdGroupBidModifierServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_bid_modifier_service.transports", - "AdGroupCriterionLabelServiceClient": "google.ads.googleads.v6.services.services.ad_group_criterion_label_service", - "AdGroupCriterionLabelServiceTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_label_service.transports", - "AdGroupCriterionLabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_label_service.transports", - "AdGroupCriterionServiceClient": "google.ads.googleads.v6.services.services.ad_group_criterion_service", - "AdGroupCriterionServiceTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_service.transports", - "AdGroupCriterionServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_service.transports", - "AdGroupCriterionSimulationServiceClient": "google.ads.googleads.v6.services.services.ad_group_criterion_simulation_service", - "AdGroupCriterionSimulationServiceTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_simulation_service.transports", - "AdGroupCriterionSimulationServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_criterion_simulation_service.transports", - "AdGroupExtensionSettingServiceClient": "google.ads.googleads.v6.services.services.ad_group_extension_setting_service", - "AdGroupExtensionSettingServiceTransport": "google.ads.googleads.v6.services.services.ad_group_extension_setting_service.transports", - "AdGroupExtensionSettingServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_extension_setting_service.transports", - "AdGroupFeedServiceClient": "google.ads.googleads.v6.services.services.ad_group_feed_service", - "AdGroupFeedServiceTransport": "google.ads.googleads.v6.services.services.ad_group_feed_service.transports", - "AdGroupFeedServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_feed_service.transports", - "AdGroupLabelServiceClient": "google.ads.googleads.v6.services.services.ad_group_label_service", - "AdGroupLabelServiceTransport": "google.ads.googleads.v6.services.services.ad_group_label_service.transports", - "AdGroupLabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_label_service.transports", - "AdGroupServiceClient": "google.ads.googleads.v6.services.services.ad_group_service", - "AdGroupServiceTransport": "google.ads.googleads.v6.services.services.ad_group_service.transports", - "AdGroupServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_service.transports", - "AdGroupSimulationServiceClient": "google.ads.googleads.v6.services.services.ad_group_simulation_service", - "AdGroupSimulationServiceTransport": "google.ads.googleads.v6.services.services.ad_group_simulation_service.transports", - "AdGroupSimulationServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_group_simulation_service.transports", - "AdParameterServiceClient": "google.ads.googleads.v6.services.services.ad_parameter_service", - "AdParameterServiceTransport": "google.ads.googleads.v6.services.services.ad_parameter_service.transports", - "AdParameterServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_parameter_service.transports", - "AdScheduleViewServiceClient": "google.ads.googleads.v6.services.services.ad_schedule_view_service", - "AdScheduleViewServiceTransport": "google.ads.googleads.v6.services.services.ad_schedule_view_service.transports", - "AdScheduleViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_schedule_view_service.transports", - "AdServiceClient": "google.ads.googleads.v6.services.services.ad_service", - "AdServiceTransport": "google.ads.googleads.v6.services.services.ad_service.transports", - "AdServiceGrpcTransport": "google.ads.googleads.v6.services.services.ad_service.transports", - "AgeRangeViewServiceClient": "google.ads.googleads.v6.services.services.age_range_view_service", - "AgeRangeViewServiceTransport": "google.ads.googleads.v6.services.services.age_range_view_service.transports", - "AgeRangeViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.age_range_view_service.transports", - "AssetServiceClient": "google.ads.googleads.v6.services.services.asset_service", - "AssetServiceTransport": "google.ads.googleads.v6.services.services.asset_service.transports", - "AssetServiceGrpcTransport": "google.ads.googleads.v6.services.services.asset_service.transports", - "BatchJobServiceClient": "google.ads.googleads.v6.services.services.batch_job_service", - "BatchJobServiceTransport": "google.ads.googleads.v6.services.services.batch_job_service.transports", - "BatchJobServiceGrpcTransport": "google.ads.googleads.v6.services.services.batch_job_service.transports", - "BiddingStrategyServiceClient": "google.ads.googleads.v6.services.services.bidding_strategy_service", - "BiddingStrategyServiceTransport": "google.ads.googleads.v6.services.services.bidding_strategy_service.transports", - "BiddingStrategyServiceGrpcTransport": "google.ads.googleads.v6.services.services.bidding_strategy_service.transports", - "BillingSetupServiceClient": "google.ads.googleads.v6.services.services.billing_setup_service", - "BillingSetupServiceTransport": "google.ads.googleads.v6.services.services.billing_setup_service.transports", - "BillingSetupServiceGrpcTransport": "google.ads.googleads.v6.services.services.billing_setup_service.transports", - "CampaignAssetServiceClient": "google.ads.googleads.v6.services.services.campaign_asset_service", - "CampaignAssetServiceTransport": "google.ads.googleads.v6.services.services.campaign_asset_service.transports", - "CampaignAssetServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_asset_service.transports", - "CampaignAudienceViewServiceClient": "google.ads.googleads.v6.services.services.campaign_audience_view_service", - "CampaignAudienceViewServiceTransport": "google.ads.googleads.v6.services.services.campaign_audience_view_service.transports", - "CampaignAudienceViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_audience_view_service.transports", - "CampaignBidModifierServiceClient": "google.ads.googleads.v6.services.services.campaign_bid_modifier_service", - "CampaignBidModifierServiceTransport": "google.ads.googleads.v6.services.services.campaign_bid_modifier_service.transports", - "CampaignBidModifierServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_bid_modifier_service.transports", - "CampaignBudgetServiceClient": "google.ads.googleads.v6.services.services.campaign_budget_service", - "CampaignBudgetServiceTransport": "google.ads.googleads.v6.services.services.campaign_budget_service.transports", - "CampaignBudgetServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_budget_service.transports", - "CampaignCriterionServiceClient": "google.ads.googleads.v6.services.services.campaign_criterion_service", - "CampaignCriterionServiceTransport": "google.ads.googleads.v6.services.services.campaign_criterion_service.transports", - "CampaignCriterionServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_criterion_service.transports", - "CampaignCriterionSimulationServiceClient": "google.ads.googleads.v6.services.services.campaign_criterion_simulation_service", - "CampaignCriterionSimulationServiceTransport": "google.ads.googleads.v6.services.services.campaign_criterion_simulation_service.transports", - "CampaignCriterionSimulationServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_criterion_simulation_service.transports", - "CampaignDraftServiceClient": "google.ads.googleads.v6.services.services.campaign_draft_service", - "CampaignDraftServiceTransport": "google.ads.googleads.v6.services.services.campaign_draft_service.transports", - "CampaignDraftServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_draft_service.transports", - "CampaignExperimentServiceClient": "google.ads.googleads.v6.services.services.campaign_experiment_service", - "CampaignExperimentServiceTransport": "google.ads.googleads.v6.services.services.campaign_experiment_service.transports", - "CampaignExperimentServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_experiment_service.transports", - "CampaignExtensionSettingServiceClient": "google.ads.googleads.v6.services.services.campaign_extension_setting_service", - "CampaignExtensionSettingServiceTransport": "google.ads.googleads.v6.services.services.campaign_extension_setting_service.transports", - "CampaignExtensionSettingServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_extension_setting_service.transports", - "CampaignFeedServiceClient": "google.ads.googleads.v6.services.services.campaign_feed_service", - "CampaignFeedServiceTransport": "google.ads.googleads.v6.services.services.campaign_feed_service.transports", - "CampaignFeedServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_feed_service.transports", - "CampaignLabelServiceClient": "google.ads.googleads.v6.services.services.campaign_label_service", - "CampaignLabelServiceTransport": "google.ads.googleads.v6.services.services.campaign_label_service.transports", - "CampaignLabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_label_service.transports", - "CampaignServiceClient": "google.ads.googleads.v6.services.services.campaign_service", - "CampaignServiceTransport": "google.ads.googleads.v6.services.services.campaign_service.transports", - "CampaignServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_service.transports", - "CampaignSharedSetServiceClient": "google.ads.googleads.v6.services.services.campaign_shared_set_service", - "CampaignSharedSetServiceTransport": "google.ads.googleads.v6.services.services.campaign_shared_set_service.transports", - "CampaignSharedSetServiceGrpcTransport": "google.ads.googleads.v6.services.services.campaign_shared_set_service.transports", - "CarrierConstantServiceClient": "google.ads.googleads.v6.services.services.carrier_constant_service", - "CarrierConstantServiceTransport": "google.ads.googleads.v6.services.services.carrier_constant_service.transports", - "CarrierConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.carrier_constant_service.transports", - "ChangeStatusServiceClient": "google.ads.googleads.v6.services.services.change_status_service", - "ChangeStatusServiceTransport": "google.ads.googleads.v6.services.services.change_status_service.transports", - "ChangeStatusServiceGrpcTransport": "google.ads.googleads.v6.services.services.change_status_service.transports", - "ClickViewServiceClient": "google.ads.googleads.v6.services.services.click_view_service", - "ClickViewServiceTransport": "google.ads.googleads.v6.services.services.click_view_service.transports", - "ClickViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.click_view_service.transports", - "CombinedAudienceServiceClient": "google.ads.googleads.v6.services.services.combined_audience_service", - "CombinedAudienceServiceTransport": "google.ads.googleads.v6.services.services.combined_audience_service.transports", - "CombinedAudienceServiceGrpcTransport": "google.ads.googleads.v6.services.services.combined_audience_service.transports", - "ConversionActionServiceClient": "google.ads.googleads.v6.services.services.conversion_action_service", - "ConversionActionServiceTransport": "google.ads.googleads.v6.services.services.conversion_action_service.transports", - "ConversionActionServiceGrpcTransport": "google.ads.googleads.v6.services.services.conversion_action_service.transports", - "ConversionAdjustmentUploadServiceClient": "google.ads.googleads.v6.services.services.conversion_adjustment_upload_service", - "ConversionAdjustmentUploadServiceTransport": "google.ads.googleads.v6.services.services.conversion_adjustment_upload_service.transports", - "ConversionAdjustmentUploadServiceGrpcTransport": "google.ads.googleads.v6.services.services.conversion_adjustment_upload_service.transports", - "ConversionUploadServiceClient": "google.ads.googleads.v6.services.services.conversion_upload_service", - "ConversionUploadServiceTransport": "google.ads.googleads.v6.services.services.conversion_upload_service.transports", - "ConversionUploadServiceGrpcTransport": "google.ads.googleads.v6.services.services.conversion_upload_service.transports", - "CurrencyConstantServiceClient": "google.ads.googleads.v6.services.services.currency_constant_service", - "CurrencyConstantServiceTransport": "google.ads.googleads.v6.services.services.currency_constant_service.transports", - "CurrencyConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.currency_constant_service.transports", - "CustomAudienceServiceClient": "google.ads.googleads.v6.services.services.custom_audience_service", - "CustomAudienceServiceTransport": "google.ads.googleads.v6.services.services.custom_audience_service.transports", - "CustomAudienceServiceGrpcTransport": "google.ads.googleads.v6.services.services.custom_audience_service.transports", - "CustomerClientLinkServiceClient": "google.ads.googleads.v6.services.services.customer_client_link_service", - "CustomerClientLinkServiceTransport": "google.ads.googleads.v6.services.services.customer_client_link_service.transports", - "CustomerClientLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_client_link_service.transports", - "CustomerClientServiceClient": "google.ads.googleads.v6.services.services.customer_client_service", - "CustomerClientServiceTransport": "google.ads.googleads.v6.services.services.customer_client_service.transports", - "CustomerClientServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_client_service.transports", - "CustomerExtensionSettingServiceClient": "google.ads.googleads.v6.services.services.customer_extension_setting_service", - "CustomerExtensionSettingServiceTransport": "google.ads.googleads.v6.services.services.customer_extension_setting_service.transports", - "CustomerExtensionSettingServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_extension_setting_service.transports", - "CustomerFeedServiceClient": "google.ads.googleads.v6.services.services.customer_feed_service", - "CustomerFeedServiceTransport": "google.ads.googleads.v6.services.services.customer_feed_service.transports", - "CustomerFeedServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_feed_service.transports", - "CustomerLabelServiceClient": "google.ads.googleads.v6.services.services.customer_label_service", - "CustomerLabelServiceTransport": "google.ads.googleads.v6.services.services.customer_label_service.transports", - "CustomerLabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_label_service.transports", - "CustomerManagerLinkServiceClient": "google.ads.googleads.v6.services.services.customer_manager_link_service", - "CustomerManagerLinkServiceTransport": "google.ads.googleads.v6.services.services.customer_manager_link_service.transports", - "CustomerManagerLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_manager_link_service.transports", - "CustomerNegativeCriterionServiceClient": "google.ads.googleads.v6.services.services.customer_negative_criterion_service", - "CustomerNegativeCriterionServiceTransport": "google.ads.googleads.v6.services.services.customer_negative_criterion_service.transports", - "CustomerNegativeCriterionServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_negative_criterion_service.transports", - "CustomerServiceClient": "google.ads.googleads.v6.services.services.customer_service", - "CustomerServiceTransport": "google.ads.googleads.v6.services.services.customer_service.transports", - "CustomerServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_service.transports", - "CustomerUserAccessInvitationServiceClient": "google.ads.googleads.v6.services.services.customer_user_access_invitation_service", - "CustomerUserAccessInvitationServiceTransport": "google.ads.googleads.v6.services.services.customer_user_access_invitation_service.transports", - "CustomerUserAccessInvitationServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_user_access_invitation_service.transports", - "CustomerUserAccessServiceClient": "google.ads.googleads.v6.services.services.customer_user_access_service", - "CustomerUserAccessServiceTransport": "google.ads.googleads.v6.services.services.customer_user_access_service.transports", - "CustomerUserAccessServiceGrpcTransport": "google.ads.googleads.v6.services.services.customer_user_access_service.transports", - "CustomInterestServiceClient": "google.ads.googleads.v6.services.services.custom_interest_service", - "CustomInterestServiceTransport": "google.ads.googleads.v6.services.services.custom_interest_service.transports", - "CustomInterestServiceGrpcTransport": "google.ads.googleads.v6.services.services.custom_interest_service.transports", - "DetailPlacementViewServiceClient": "google.ads.googleads.v6.services.services.detail_placement_view_service", - "DetailPlacementViewServiceTransport": "google.ads.googleads.v6.services.services.detail_placement_view_service.transports", - "DetailPlacementViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.detail_placement_view_service.transports", - "DisplayKeywordViewServiceClient": "google.ads.googleads.v6.services.services.display_keyword_view_service", - "DisplayKeywordViewServiceTransport": "google.ads.googleads.v6.services.services.display_keyword_view_service.transports", - "DisplayKeywordViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.display_keyword_view_service.transports", - "DistanceViewServiceClient": "google.ads.googleads.v6.services.services.distance_view_service", - "DistanceViewServiceTransport": "google.ads.googleads.v6.services.services.distance_view_service.transports", - "DistanceViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.distance_view_service.transports", - "DomainCategoryServiceClient": "google.ads.googleads.v6.services.services.domain_category_service", - "DomainCategoryServiceTransport": "google.ads.googleads.v6.services.services.domain_category_service.transports", - "DomainCategoryServiceGrpcTransport": "google.ads.googleads.v6.services.services.domain_category_service.transports", - "DynamicSearchAdsSearchTermViewServiceClient": "google.ads.googleads.v6.services.services.dynamic_search_ads_search_term_view_service", - "DynamicSearchAdsSearchTermViewServiceTransport": "google.ads.googleads.v6.services.services.dynamic_search_ads_search_term_view_service.transports", - "DynamicSearchAdsSearchTermViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.dynamic_search_ads_search_term_view_service.transports", - "ExpandedLandingPageViewServiceClient": "google.ads.googleads.v6.services.services.expanded_landing_page_view_service", - "ExpandedLandingPageViewServiceTransport": "google.ads.googleads.v6.services.services.expanded_landing_page_view_service.transports", - "ExpandedLandingPageViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.expanded_landing_page_view_service.transports", - "ExtensionFeedItemServiceClient": "google.ads.googleads.v6.services.services.extension_feed_item_service", - "ExtensionFeedItemServiceTransport": "google.ads.googleads.v6.services.services.extension_feed_item_service.transports", - "ExtensionFeedItemServiceGrpcTransport": "google.ads.googleads.v6.services.services.extension_feed_item_service.transports", - "FeedItemServiceClient": "google.ads.googleads.v6.services.services.feed_item_service", - "FeedItemServiceTransport": "google.ads.googleads.v6.services.services.feed_item_service.transports", - "FeedItemServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_item_service.transports", - "FeedItemSetLinkServiceClient": "google.ads.googleads.v6.services.services.feed_item_set_link_service", - "FeedItemSetLinkServiceTransport": "google.ads.googleads.v6.services.services.feed_item_set_link_service.transports", - "FeedItemSetLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_item_set_link_service.transports", - "FeedItemSetServiceClient": "google.ads.googleads.v6.services.services.feed_item_set_service", - "FeedItemSetServiceTransport": "google.ads.googleads.v6.services.services.feed_item_set_service.transports", - "FeedItemSetServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_item_set_service.transports", - "FeedItemTargetServiceClient": "google.ads.googleads.v6.services.services.feed_item_target_service", - "FeedItemTargetServiceTransport": "google.ads.googleads.v6.services.services.feed_item_target_service.transports", - "FeedItemTargetServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_item_target_service.transports", - "FeedMappingServiceClient": "google.ads.googleads.v6.services.services.feed_mapping_service", - "FeedMappingServiceTransport": "google.ads.googleads.v6.services.services.feed_mapping_service.transports", - "FeedMappingServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_mapping_service.transports", - "FeedPlaceholderViewServiceClient": "google.ads.googleads.v6.services.services.feed_placeholder_view_service", - "FeedPlaceholderViewServiceTransport": "google.ads.googleads.v6.services.services.feed_placeholder_view_service.transports", - "FeedPlaceholderViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_placeholder_view_service.transports", - "FeedServiceClient": "google.ads.googleads.v6.services.services.feed_service", - "FeedServiceTransport": "google.ads.googleads.v6.services.services.feed_service.transports", - "FeedServiceGrpcTransport": "google.ads.googleads.v6.services.services.feed_service.transports", - "GenderViewServiceClient": "google.ads.googleads.v6.services.services.gender_view_service", - "GenderViewServiceTransport": "google.ads.googleads.v6.services.services.gender_view_service.transports", - "GenderViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.gender_view_service.transports", - "GeographicViewServiceClient": "google.ads.googleads.v6.services.services.geographic_view_service", - "GeographicViewServiceTransport": "google.ads.googleads.v6.services.services.geographic_view_service.transports", - "GeographicViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.geographic_view_service.transports", - "GeoTargetConstantServiceClient": "google.ads.googleads.v6.services.services.geo_target_constant_service", - "GeoTargetConstantServiceTransport": "google.ads.googleads.v6.services.services.geo_target_constant_service.transports", - "GeoTargetConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.geo_target_constant_service.transports", - "GoogleAdsFieldServiceClient": "google.ads.googleads.v6.services.services.google_ads_field_service", - "GoogleAdsFieldServiceTransport": "google.ads.googleads.v6.services.services.google_ads_field_service.transports", - "GoogleAdsFieldServiceGrpcTransport": "google.ads.googleads.v6.services.services.google_ads_field_service.transports", - "GoogleAdsServiceClient": "google.ads.googleads.v6.services.services.google_ads_service", - "GoogleAdsServiceTransport": "google.ads.googleads.v6.services.services.google_ads_service.transports", - "GoogleAdsServiceGrpcTransport": "google.ads.googleads.v6.services.services.google_ads_service.transports", - "GroupPlacementViewServiceClient": "google.ads.googleads.v6.services.services.group_placement_view_service", - "GroupPlacementViewServiceTransport": "google.ads.googleads.v6.services.services.group_placement_view_service.transports", - "GroupPlacementViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.group_placement_view_service.transports", - "HotelGroupViewServiceClient": "google.ads.googleads.v6.services.services.hotel_group_view_service", - "HotelGroupViewServiceTransport": "google.ads.googleads.v6.services.services.hotel_group_view_service.transports", - "HotelGroupViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.hotel_group_view_service.transports", - "HotelPerformanceViewServiceClient": "google.ads.googleads.v6.services.services.hotel_performance_view_service", - "HotelPerformanceViewServiceTransport": "google.ads.googleads.v6.services.services.hotel_performance_view_service.transports", - "HotelPerformanceViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.hotel_performance_view_service.transports", - "IncomeRangeViewServiceClient": "google.ads.googleads.v6.services.services.income_range_view_service", - "IncomeRangeViewServiceTransport": "google.ads.googleads.v6.services.services.income_range_view_service.transports", - "IncomeRangeViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.income_range_view_service.transports", - "InvoiceServiceClient": "google.ads.googleads.v6.services.services.invoice_service", - "InvoiceServiceTransport": "google.ads.googleads.v6.services.services.invoice_service.transports", - "InvoiceServiceGrpcTransport": "google.ads.googleads.v6.services.services.invoice_service.transports", - "KeywordPlanAdGroupKeywordServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_keyword_service", - "KeywordPlanAdGroupKeywordServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_keyword_service.transports", - "KeywordPlanAdGroupKeywordServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_keyword_service.transports", - "KeywordPlanAdGroupServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_service", - "KeywordPlanAdGroupServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_service.transports", - "KeywordPlanAdGroupServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_ad_group_service.transports", - "KeywordPlanCampaignKeywordServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_campaign_keyword_service", - "KeywordPlanCampaignKeywordServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_campaign_keyword_service.transports", - "KeywordPlanCampaignKeywordServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_campaign_keyword_service.transports", - "KeywordPlanCampaignServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_campaign_service", - "KeywordPlanCampaignServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_campaign_service.transports", - "KeywordPlanCampaignServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_campaign_service.transports", - "KeywordPlanIdeaServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_idea_service", - "KeywordPlanIdeaServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_idea_service.transports", - "KeywordPlanIdeaServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_idea_service.transports", - "KeywordPlanServiceClient": "google.ads.googleads.v6.services.services.keyword_plan_service", - "KeywordPlanServiceTransport": "google.ads.googleads.v6.services.services.keyword_plan_service.transports", - "KeywordPlanServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_plan_service.transports", - "KeywordViewServiceClient": "google.ads.googleads.v6.services.services.keyword_view_service", - "KeywordViewServiceTransport": "google.ads.googleads.v6.services.services.keyword_view_service.transports", - "KeywordViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.keyword_view_service.transports", - "LabelServiceClient": "google.ads.googleads.v6.services.services.label_service", - "LabelServiceTransport": "google.ads.googleads.v6.services.services.label_service.transports", - "LabelServiceGrpcTransport": "google.ads.googleads.v6.services.services.label_service.transports", - "LandingPageViewServiceClient": "google.ads.googleads.v6.services.services.landing_page_view_service", - "LandingPageViewServiceTransport": "google.ads.googleads.v6.services.services.landing_page_view_service.transports", - "LandingPageViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.landing_page_view_service.transports", - "LanguageConstantServiceClient": "google.ads.googleads.v6.services.services.language_constant_service", - "LanguageConstantServiceTransport": "google.ads.googleads.v6.services.services.language_constant_service.transports", - "LanguageConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.language_constant_service.transports", - "LocationViewServiceClient": "google.ads.googleads.v6.services.services.location_view_service", - "LocationViewServiceTransport": "google.ads.googleads.v6.services.services.location_view_service.transports", - "LocationViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.location_view_service.transports", - "ManagedPlacementViewServiceClient": "google.ads.googleads.v6.services.services.managed_placement_view_service", - "ManagedPlacementViewServiceTransport": "google.ads.googleads.v6.services.services.managed_placement_view_service.transports", - "ManagedPlacementViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.managed_placement_view_service.transports", - "MediaFileServiceClient": "google.ads.googleads.v6.services.services.media_file_service", - "MediaFileServiceTransport": "google.ads.googleads.v6.services.services.media_file_service.transports", - "MediaFileServiceGrpcTransport": "google.ads.googleads.v6.services.services.media_file_service.transports", - "MerchantCenterLinkServiceClient": "google.ads.googleads.v6.services.services.merchant_center_link_service", - "MerchantCenterLinkServiceTransport": "google.ads.googleads.v6.services.services.merchant_center_link_service.transports", - "MerchantCenterLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.merchant_center_link_service.transports", - "MobileAppCategoryConstantServiceClient": "google.ads.googleads.v6.services.services.mobile_app_category_constant_service", - "MobileAppCategoryConstantServiceTransport": "google.ads.googleads.v6.services.services.mobile_app_category_constant_service.transports", - "MobileAppCategoryConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.mobile_app_category_constant_service.transports", - "MobileDeviceConstantServiceClient": "google.ads.googleads.v6.services.services.mobile_device_constant_service", - "MobileDeviceConstantServiceTransport": "google.ads.googleads.v6.services.services.mobile_device_constant_service.transports", - "MobileDeviceConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.mobile_device_constant_service.transports", - "OfflineUserDataJobServiceClient": "google.ads.googleads.v6.services.services.offline_user_data_job_service", - "OfflineUserDataJobServiceTransport": "google.ads.googleads.v6.services.services.offline_user_data_job_service.transports", - "OfflineUserDataJobServiceGrpcTransport": "google.ads.googleads.v6.services.services.offline_user_data_job_service.transports", - "OperatingSystemVersionConstantServiceClient": "google.ads.googleads.v6.services.services.operating_system_version_constant_service", - "OperatingSystemVersionConstantServiceTransport": "google.ads.googleads.v6.services.services.operating_system_version_constant_service.transports", - "OperatingSystemVersionConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.operating_system_version_constant_service.transports", - "PaidOrganicSearchTermViewServiceClient": "google.ads.googleads.v6.services.services.paid_organic_search_term_view_service", - "PaidOrganicSearchTermViewServiceTransport": "google.ads.googleads.v6.services.services.paid_organic_search_term_view_service.transports", - "PaidOrganicSearchTermViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.paid_organic_search_term_view_service.transports", - "ParentalStatusViewServiceClient": "google.ads.googleads.v6.services.services.parental_status_view_service", - "ParentalStatusViewServiceTransport": "google.ads.googleads.v6.services.services.parental_status_view_service.transports", - "ParentalStatusViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.parental_status_view_service.transports", - "PaymentsAccountServiceClient": "google.ads.googleads.v6.services.services.payments_account_service", - "PaymentsAccountServiceTransport": "google.ads.googleads.v6.services.services.payments_account_service.transports", - "PaymentsAccountServiceGrpcTransport": "google.ads.googleads.v6.services.services.payments_account_service.transports", - "ProductBiddingCategoryConstantServiceClient": "google.ads.googleads.v6.services.services.product_bidding_category_constant_service", - "ProductBiddingCategoryConstantServiceTransport": "google.ads.googleads.v6.services.services.product_bidding_category_constant_service.transports", - "ProductBiddingCategoryConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.product_bidding_category_constant_service.transports", - "ProductGroupViewServiceClient": "google.ads.googleads.v6.services.services.product_group_view_service", - "ProductGroupViewServiceTransport": "google.ads.googleads.v6.services.services.product_group_view_service.transports", - "ProductGroupViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.product_group_view_service.transports", - "ReachPlanServiceClient": "google.ads.googleads.v6.services.services.reach_plan_service", - "ReachPlanServiceTransport": "google.ads.googleads.v6.services.services.reach_plan_service.transports", - "ReachPlanServiceGrpcTransport": "google.ads.googleads.v6.services.services.reach_plan_service.transports", - "RecommendationServiceClient": "google.ads.googleads.v6.services.services.recommendation_service", - "RecommendationServiceTransport": "google.ads.googleads.v6.services.services.recommendation_service.transports", - "RecommendationServiceGrpcTransport": "google.ads.googleads.v6.services.services.recommendation_service.transports", - "RemarketingActionServiceClient": "google.ads.googleads.v6.services.services.remarketing_action_service", - "RemarketingActionServiceTransport": "google.ads.googleads.v6.services.services.remarketing_action_service.transports", - "RemarketingActionServiceGrpcTransport": "google.ads.googleads.v6.services.services.remarketing_action_service.transports", - "SearchTermViewServiceClient": "google.ads.googleads.v6.services.services.search_term_view_service", - "SearchTermViewServiceTransport": "google.ads.googleads.v6.services.services.search_term_view_service.transports", - "SearchTermViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.search_term_view_service.transports", - "SharedCriterionServiceClient": "google.ads.googleads.v6.services.services.shared_criterion_service", - "SharedCriterionServiceTransport": "google.ads.googleads.v6.services.services.shared_criterion_service.transports", - "SharedCriterionServiceGrpcTransport": "google.ads.googleads.v6.services.services.shared_criterion_service.transports", - "SharedSetServiceClient": "google.ads.googleads.v6.services.services.shared_set_service", - "SharedSetServiceTransport": "google.ads.googleads.v6.services.services.shared_set_service.transports", - "SharedSetServiceGrpcTransport": "google.ads.googleads.v6.services.services.shared_set_service.transports", - "ShoppingPerformanceViewServiceClient": "google.ads.googleads.v6.services.services.shopping_performance_view_service", - "ShoppingPerformanceViewServiceTransport": "google.ads.googleads.v6.services.services.shopping_performance_view_service.transports", - "ShoppingPerformanceViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.shopping_performance_view_service.transports", - "ThirdPartyAppAnalyticsLinkServiceClient": "google.ads.googleads.v6.services.services.third_party_app_analytics_link_service", - "ThirdPartyAppAnalyticsLinkServiceTransport": "google.ads.googleads.v6.services.services.third_party_app_analytics_link_service.transports", - "ThirdPartyAppAnalyticsLinkServiceGrpcTransport": "google.ads.googleads.v6.services.services.third_party_app_analytics_link_service.transports", - "TopicConstantServiceClient": "google.ads.googleads.v6.services.services.topic_constant_service", - "TopicConstantServiceTransport": "google.ads.googleads.v6.services.services.topic_constant_service.transports", - "TopicConstantServiceGrpcTransport": "google.ads.googleads.v6.services.services.topic_constant_service.transports", - "TopicViewServiceClient": "google.ads.googleads.v6.services.services.topic_view_service", - "TopicViewServiceTransport": "google.ads.googleads.v6.services.services.topic_view_service.transports", - "TopicViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.topic_view_service.transports", - "UserDataServiceClient": "google.ads.googleads.v6.services.services.user_data_service", - "UserDataServiceTransport": "google.ads.googleads.v6.services.services.user_data_service.transports", - "UserDataServiceGrpcTransport": "google.ads.googleads.v6.services.services.user_data_service.transports", - "UserInterestServiceClient": "google.ads.googleads.v6.services.services.user_interest_service", - "UserInterestServiceTransport": "google.ads.googleads.v6.services.services.user_interest_service.transports", - "UserInterestServiceGrpcTransport": "google.ads.googleads.v6.services.services.user_interest_service.transports", - "UserListServiceClient": "google.ads.googleads.v6.services.services.user_list_service", - "UserListServiceTransport": "google.ads.googleads.v6.services.services.user_list_service.transports", - "UserListServiceGrpcTransport": "google.ads.googleads.v6.services.services.user_list_service.transports", - "UserLocationViewServiceClient": "google.ads.googleads.v6.services.services.user_location_view_service", - "UserLocationViewServiceTransport": "google.ads.googleads.v6.services.services.user_location_view_service.transports", - "UserLocationViewServiceGrpcTransport": "google.ads.googleads.v6.services.services.user_location_view_service.transports", - "VideoServiceClient": "google.ads.googleads.v6.services.services.video_service", - "VideoServiceTransport": "google.ads.googleads.v6.services.services.video_service.transports", - "VideoServiceGrpcTransport": "google.ads.googleads.v6.services.services.video_service.transports", -} - - -# Background on how this behaves: https://www.python.org/dev/peps/pep-0562/ -def __getattr__(name): # Requires Python >= 3.7 - if name == "__all__": - all_names = globals()["__all__"] = sorted(_lazy_type_to_package_map) - return all_names - elif name in _lazy_type_to_package_map: - module = importlib.import_module(f"{_lazy_type_to_package_map[name]}") - klass = getattr(module, name) - - globals()[name] = klass - return klass - else: - raise AttributeError(f"unknown type {name!r}.") - - -def __dir__(): - return globals().get("__all__") or __getattr__("__all__") diff --git a/google/ads/googleads/v6/common/__init__.py b/google/ads/googleads/v6/common/__init__.py deleted file mode 100644 index 483d2083f..000000000 --- a/google/ads/googleads/v6/common/__init__.py +++ /dev/null @@ -1,221 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - - -__all__ = ( - "AdAssetPolicySummary", - "AdImageAsset", - "AdMediaBundleAsset", - "AdScheduleInfo", - "AdTextAsset", - "AdVideoAsset", - "AddressInfo", - "AffiliateLocationFeedItem", - "AgeRangeInfo", - "AppAdInfo", - "AppEngagementAdInfo", - "AppFeedItem", - "AppPaymentModelInfo", - "BasicUserListInfo", - "BidModifierSimulationPoint", - "BidModifierSimulationPointList", - "BookOnGoogleAsset", - "BudgetCampaignAssociationStatus", - "BusinessNameFilter", - "CallFeedItem", - "CallOnlyAdInfo", - "CalloutFeedItem", - "CarrierInfo", - "ClickLocation", - "CombinedAudienceInfo", - "CombinedRuleUserListInfo", - "Commission", - "ContentLabelInfo", - "CpcBidSimulationPoint", - "CpcBidSimulationPointList", - "CpvBidSimulationPoint", - "CpvBidSimulationPointList", - "CriterionCategoryAvailability", - "CriterionCategoryChannelAvailability", - "CriterionCategoryLocaleAvailability", - "CrmBasedUserListInfo", - "CustomAffinityInfo", - "CustomAudienceInfo", - "CustomIntentInfo", - "CustomParameter", - "CustomerMatchUserListMetadata", - "DateRange", - "DateSpecificRuleUserListInfo", - "DeviceInfo", - "DisplayCallToAction", - "DisplayUploadAdInfo", - "DynamicAffiliateLocationSetFilter", - "DynamicLocationSetFilter", - "EnhancedCpc", - "ExpandedDynamicSearchAdInfo", - "ExpandedTextAdInfo", - "ExplorerAutoOptimizerSetting", - "ExpressionRuleUserListInfo", - "FinalAppUrl", - "FrequencyCapEntry", - "FrequencyCapKey", - "GenderInfo", - "GeoPointInfo", - "GmailAdInfo", - "GmailTeaser", - "HotelAdInfo", - "HotelAdvanceBookingWindowInfo", - "HotelCalloutFeedItem", - "HotelCheckInDayInfo", - "HotelCityInfo", - "HotelClassInfo", - "HotelCountryRegionInfo", - "HotelDateSelectionTypeInfo", - "HotelIdInfo", - "HotelLengthOfStayInfo", - "HotelStateInfo", - "ImageAdInfo", - "ImageAsset", - "ImageDimension", - "ImageFeedItem", - "IncomeRangeInfo", - "InteractionTypeInfo", - "IpBlockInfo", - "Keyword", - "KeywordInfo", - "KeywordPlanHistoricalMetrics", - "LanguageInfo", - "LeadFormAsset", - "LeadFormDeliveryMethod", - "LeadFormField", - "LeadFormSingleChoiceAnswers", - "LegacyAppInstallAdInfo", - "LegacyResponsiveDisplayAdInfo", - "ListingDimensionInfo", - "ListingGroupInfo", - "ListingScopeInfo", - "LocalAdInfo", - "LocationFeedItem", - "LocationGroupInfo", - "LocationInfo", - "LogicalUserListInfo", - "LogicalUserListOperandInfo", - "ManualCpc", - "ManualCpm", - "ManualCpv", - "MatchingFunction", - "MaximizeConversionValue", - "MaximizeConversions", - "MediaBundleAsset", - "Metrics", - "MobileAppCategoryInfo", - "MobileApplicationInfo", - "MobileDeviceInfo", - "Money", - "MonthlySearchVolume", - "OfflineUserAddressInfo", - "Operand", - "OperatingSystemVersionInfo", - "ParentalStatusInfo", - "PercentCpc", - "PercentCpcBidSimulationPoint", - "PercentCpcBidSimulationPointList", - "PlacementInfo", - "PolicyTopicConstraint", - "PolicyTopicEntry", - "PolicyTopicEvidence", - "PolicyValidationParameter", - "PreferredContentInfo", - "PriceFeedItem", - "PriceOffer", - "ProductBiddingCategoryInfo", - "ProductBrandInfo", - "ProductChannelExclusivityInfo", - "ProductChannelInfo", - "ProductConditionInfo", - "ProductCustomAttributeInfo", - "ProductImage", - "ProductItemIdInfo", - "ProductTypeInfo", - "ProductVideo", - "PromotionFeedItem", - "ProximityInfo", - "RealTimeBiddingSetting", - "ResponsiveDisplayAdControlSpec", - "ResponsiveDisplayAdInfo", - "ResponsiveSearchAdInfo", - "RuleBasedUserListInfo", - "Segments", - "ShoppingComparisonListingAdInfo", - "ShoppingProductAdInfo", - "ShoppingSmartAdInfo", - "SimilarUserListInfo", - "SitelinkFeedItem", - "StoreAttribute", - "StoreSalesMetadata", - "StoreSalesThirdPartyMetadata", - "StructuredSnippetFeedItem", - "TagSnippet", - "TargetCpa", - "TargetCpaSimulationPoint", - "TargetCpaSimulationPointList", - "TargetCpm", - "TargetImpressionShare", - "TargetRestriction", - "TargetRestrictionOperation", - "TargetRoas", - "TargetRoasSimulationPoint", - "TargetRoasSimulationPointList", - "TargetSpend", - "TargetingSetting", - "TextAdInfo", - "TextAsset", - "TextLabel", - "TextMessageFeedItem", - "TopicInfo", - "TransactionAttribute", - "UnknownListingDimensionInfo", - "UrlCollection", - "UserAttribute", - "UserData", - "UserIdentifier", - "UserInterestInfo", - "UserListActionInfo", - "UserListDateRuleItemInfo", - "UserListInfo", - "UserListLogicalRuleInfo", - "UserListNumberRuleItemInfo", - "UserListRuleInfo", - "UserListRuleItemGroupInfo", - "UserListRuleItemInfo", - "UserListStringRuleItemInfo", - "Value", - "VideoAdInfo", - "VideoBumperInStreamAdInfo", - "VideoNonSkippableInStreamAdInfo", - "VideoOutstreamAdInfo", - "VideoResponsiveAdInfo", - "VideoTrueViewDiscoveryAdInfo", - "VideoTrueViewInStreamAdInfo", - "WebhookDelivery", - "WebpageConditionInfo", - "WebpageInfo", - "YouTubeChannelInfo", - "YouTubeVideoInfo", - "YoutubeVideoAsset", - "PolicyViolationKey", -) diff --git a/google/ads/googleads/v6/common/types/ad_asset.py b/google/ads/googleads/v6/common/types/ad_asset.py deleted file mode 100644 index e9fba1126..000000000 --- a/google/ads/googleads/v6/common/types/ad_asset.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import asset_policy -from google.ads.googleads.v6.enums.types import ( - asset_performance_label as gage_asset_performance_label, -) -from google.ads.googleads.v6.enums.types import served_asset_field_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "AdTextAsset", - "AdImageAsset", - "AdVideoAsset", - "AdMediaBundleAsset", - }, -) - - -class AdTextAsset(proto.Message): - r"""A text asset used inside an ad. - - Attributes: - text (str): - Asset text. - pinned_field (google.ads.googleads.v6.enums.types.ServedAssetFieldTypeEnum.ServedAssetFieldType): - The pinned field of the asset. This restricts - the asset to only serve within this field. - Multiple assets can be pinned to the same field. - An asset that is unpinned or pinned to a - different field will not serve in a field where - some other asset has been pinned. - asset_performance_label (google.ads.googleads.v6.enums.types.AssetPerformanceLabelEnum.AssetPerformanceLabel): - The performance label of this text asset. - policy_summary_info (google.ads.googleads.v6.common.types.AdAssetPolicySummary): - The policy summary of this text asset. - """ - - text = proto.Field(proto.STRING, number=4, optional=True) - pinned_field = proto.Field( - proto.ENUM, - number=2, - enum=served_asset_field_type.ServedAssetFieldTypeEnum.ServedAssetFieldType, - ) - asset_performance_label = proto.Field( - proto.ENUM, - number=5, - enum=gage_asset_performance_label.AssetPerformanceLabelEnum.AssetPerformanceLabel, - ) - policy_summary_info = proto.Field( - proto.MESSAGE, number=6, message=asset_policy.AdAssetPolicySummary, - ) - - -class AdImageAsset(proto.Message): - r"""An image asset used inside an ad. - - Attributes: - asset (str): - The Asset resource name of this image. - """ - - asset = proto.Field(proto.STRING, number=2, optional=True) - - -class AdVideoAsset(proto.Message): - r"""A video asset used inside an ad. - - Attributes: - asset (str): - The Asset resource name of this video. - """ - - asset = proto.Field(proto.STRING, number=2, optional=True) - - -class AdMediaBundleAsset(proto.Message): - r"""A media bundle asset used inside an ad. - - Attributes: - asset (str): - The Asset resource name of this media bundle. - """ - - asset = proto.Field(proto.STRING, number=2, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/ad_type_infos.py b/google/ads/googleads/v6/common/types/ad_type_infos.py deleted file mode 100644 index 25f3b50d1..000000000 --- a/google/ads/googleads/v6/common/types/ad_type_infos.py +++ /dev/null @@ -1,1037 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import ad_asset -from google.ads.googleads.v6.enums.types import call_conversion_reporting_state -from google.ads.googleads.v6.enums.types import display_ad_format_setting -from google.ads.googleads.v6.enums.types import ( - display_upload_product_type as gage_display_upload_product_type, -) -from google.ads.googleads.v6.enums.types import legacy_app_install_ad_app_store -from google.ads.googleads.v6.enums.types import mime_type as gage_mime_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "TextAdInfo", - "ExpandedTextAdInfo", - "CallOnlyAdInfo", - "ExpandedDynamicSearchAdInfo", - "HotelAdInfo", - "ShoppingSmartAdInfo", - "ShoppingProductAdInfo", - "ShoppingComparisonListingAdInfo", - "GmailAdInfo", - "GmailTeaser", - "DisplayCallToAction", - "ProductImage", - "ProductVideo", - "ImageAdInfo", - "VideoBumperInStreamAdInfo", - "VideoNonSkippableInStreamAdInfo", - "VideoTrueViewInStreamAdInfo", - "VideoOutstreamAdInfo", - "VideoTrueViewDiscoveryAdInfo", - "VideoAdInfo", - "VideoResponsiveAdInfo", - "ResponsiveSearchAdInfo", - "LegacyResponsiveDisplayAdInfo", - "AppAdInfo", - "AppEngagementAdInfo", - "LegacyAppInstallAdInfo", - "ResponsiveDisplayAdInfo", - "LocalAdInfo", - "DisplayUploadAdInfo", - "ResponsiveDisplayAdControlSpec", - }, -) - - -class TextAdInfo(proto.Message): - r"""A text ad. - - Attributes: - headline (str): - The headline of the ad. - description1 (str): - The first line of the ad's description. - description2 (str): - The second line of the ad's description. - """ - - headline = proto.Field(proto.STRING, number=4, optional=True) - description1 = proto.Field(proto.STRING, number=5, optional=True) - description2 = proto.Field(proto.STRING, number=6, optional=True) - - -class ExpandedTextAdInfo(proto.Message): - r"""An expanded text ad. - - Attributes: - headline_part1 (str): - The first part of the ad's headline. - headline_part2 (str): - The second part of the ad's headline. - headline_part3 (str): - The third part of the ad's headline. - description (str): - The description of the ad. - description2 (str): - The second description of the ad. - path1 (str): - The text that can appear alongside the ad's - displayed URL. - path2 (str): - Additional text that can appear alongside the - ad's displayed URL. - """ - - headline_part1 = proto.Field(proto.STRING, number=8, optional=True) - headline_part2 = proto.Field(proto.STRING, number=9, optional=True) - headline_part3 = proto.Field(proto.STRING, number=10, optional=True) - description = proto.Field(proto.STRING, number=11, optional=True) - description2 = proto.Field(proto.STRING, number=12, optional=True) - path1 = proto.Field(proto.STRING, number=13, optional=True) - path2 = proto.Field(proto.STRING, number=14, optional=True) - - -class CallOnlyAdInfo(proto.Message): - r"""A call-only ad. - - Attributes: - country_code (str): - The country code in the ad. - phone_number (str): - The phone number in the ad. - business_name (str): - The business name in the ad. - headline1 (str): - First headline in the ad. - headline2 (str): - Second headline in the ad. - description1 (str): - The first line of the ad's description. - description2 (str): - The second line of the ad's description. - call_tracked (bool): - Whether to enable call tracking for the - creative. Enabling call tracking also enables - call conversions. - disable_call_conversion (bool): - Whether to disable call conversion for the creative. If set - to ``true``, disables call conversions even when - ``call_tracked`` is ``true``. If ``call_tracked`` is - ``false``, this field is ignored. - phone_number_verification_url (str): - The URL to be used for phone number - verification. - conversion_action (str): - The conversion action to attribute a call conversion to. If - not set a default conversion action is used. This field only - has effect if call_tracked is set to true. Otherwise this - field is ignored. - conversion_reporting_state (google.ads.googleads.v6.enums.types.CallConversionReportingStateEnum.CallConversionReportingState): - The call conversion behavior of this call - only ad. It can use its own call conversion - setting, inherit the account level setting, or - be disabled. - """ - - country_code = proto.Field(proto.STRING, number=13, optional=True) - phone_number = proto.Field(proto.STRING, number=14, optional=True) - business_name = proto.Field(proto.STRING, number=15, optional=True) - headline1 = proto.Field(proto.STRING, number=16, optional=True) - headline2 = proto.Field(proto.STRING, number=17, optional=True) - description1 = proto.Field(proto.STRING, number=18, optional=True) - description2 = proto.Field(proto.STRING, number=19, optional=True) - call_tracked = proto.Field(proto.BOOL, number=20, optional=True) - disable_call_conversion = proto.Field(proto.BOOL, number=21, optional=True) - phone_number_verification_url = proto.Field( - proto.STRING, number=22, optional=True - ) - conversion_action = proto.Field(proto.STRING, number=23, optional=True) - conversion_reporting_state = proto.Field( - proto.ENUM, - number=10, - enum=call_conversion_reporting_state.CallConversionReportingStateEnum.CallConversionReportingState, - ) - - -class ExpandedDynamicSearchAdInfo(proto.Message): - r"""An expanded dynamic search ad. - - Attributes: - description (str): - The description of the ad. - description2 (str): - The second description of the ad. - """ - - description = proto.Field(proto.STRING, number=3, optional=True) - description2 = proto.Field(proto.STRING, number=4, optional=True) - - -class HotelAdInfo(proto.Message): - r"""A hotel ad.""" - - -class ShoppingSmartAdInfo(proto.Message): - r"""A Smart Shopping ad.""" - - -class ShoppingProductAdInfo(proto.Message): - r"""A standard Shopping ad.""" - - -class ShoppingComparisonListingAdInfo(proto.Message): - r"""A Shopping Comparison Listing ad. - - Attributes: - headline (str): - Headline of the ad. This field is required. - Allowed length is between 25 and 45 characters. - """ - - headline = proto.Field(proto.STRING, number=2, optional=True) - - -class GmailAdInfo(proto.Message): - r"""A Gmail ad. - - Attributes: - teaser (google.ads.googleads.v6.common.types.GmailTeaser): - The Gmail teaser. - header_image (str): - The MediaFile resource name of the header - image. Valid image types are GIF, JPEG and PNG. - The minimum size is 300x100 pixels and the - aspect ratio must be between 3:1 and 5:1 (+-1%). - marketing_image (str): - The MediaFile resource name of the marketing - image. Valid image types are GIF, JPEG and PNG. - The image must either be landscape with a - minimum size of 600x314 pixels and aspect ratio - of 600:314 (+-1%) or square with a minimum size - of 300x300 pixels and aspect ratio of 1:1 (+-1%) - marketing_image_headline (str): - Headline of the marketing image. - marketing_image_description (str): - Description of the marketing image. - marketing_image_display_call_to_action (google.ads.googleads.v6.common.types.DisplayCallToAction): - Display-call-to-action of the marketing - image. - product_images (Sequence[google.ads.googleads.v6.common.types.ProductImage]): - Product images. Up to 15 images are - supported. - product_videos (Sequence[google.ads.googleads.v6.common.types.ProductVideo]): - Product videos. Up to 7 videos are supported. - At least one product video or a marketing image - must be specified. - """ - - teaser = proto.Field(proto.MESSAGE, number=1, message="GmailTeaser",) - header_image = proto.Field(proto.STRING, number=10, optional=True) - marketing_image = proto.Field(proto.STRING, number=11, optional=True) - marketing_image_headline = proto.Field( - proto.STRING, number=12, optional=True - ) - marketing_image_description = proto.Field( - proto.STRING, number=13, optional=True - ) - marketing_image_display_call_to_action = proto.Field( - proto.MESSAGE, number=6, message="DisplayCallToAction", - ) - product_images = proto.RepeatedField( - proto.MESSAGE, number=7, message="ProductImage", - ) - product_videos = proto.RepeatedField( - proto.MESSAGE, number=8, message="ProductVideo", - ) - - -class GmailTeaser(proto.Message): - r"""Gmail teaser data. The teaser is a small header that acts as - an invitation to view the rest of the ad (the body). - - Attributes: - headline (str): - Headline of the teaser. - description (str): - Description of the teaser. - business_name (str): - Business name of the advertiser. - logo_image (str): - The MediaFile resource name of the logo - image. Valid image types are GIF, JPEG and PNG. - The minimum size is 144x144 pixels and the - aspect ratio must be 1:1 (+-1%). - """ - - headline = proto.Field(proto.STRING, number=5, optional=True) - description = proto.Field(proto.STRING, number=6, optional=True) - business_name = proto.Field(proto.STRING, number=7, optional=True) - logo_image = proto.Field(proto.STRING, number=8, optional=True) - - -class DisplayCallToAction(proto.Message): - r"""Data for display call to action. The call to action is a - piece of the ad that prompts the user to do something. Like - clicking a link or making a phone call. - - Attributes: - text (str): - Text for the display-call-to-action. - text_color (str): - Text color for the display-call-to-action in - hexadecimal, e.g. #ffffff for white. - url_collection_id (str): - Identifies the url collection in the ad.url_collections - field. If not set the url defaults to final_url. - """ - - text = proto.Field(proto.STRING, number=5, optional=True) - text_color = proto.Field(proto.STRING, number=6, optional=True) - url_collection_id = proto.Field(proto.STRING, number=7, optional=True) - - -class ProductImage(proto.Message): - r"""Product image specific data. - - Attributes: - product_image (str): - The MediaFile resource name of the product - image. Valid image types are GIF, JPEG and PNG. - The minimum size is 300x300 pixels and the - aspect ratio must be 1:1 (+-1%). - description (str): - Description of the product. - display_call_to_action (google.ads.googleads.v6.common.types.DisplayCallToAction): - Display-call-to-action of the product image. - """ - - product_image = proto.Field(proto.STRING, number=4, optional=True) - description = proto.Field(proto.STRING, number=5, optional=True) - display_call_to_action = proto.Field( - proto.MESSAGE, number=3, message="DisplayCallToAction", - ) - - -class ProductVideo(proto.Message): - r"""Product video specific data. - - Attributes: - product_video (str): - The MediaFile resource name of a video which - must be hosted on YouTube. - """ - - product_video = proto.Field(proto.STRING, number=2, optional=True) - - -class ImageAdInfo(proto.Message): - r"""An image ad. - - Attributes: - pixel_width (int): - Width in pixels of the full size image. - pixel_height (int): - Height in pixels of the full size image. - image_url (str): - URL of the full size image. - preview_pixel_width (int): - Width in pixels of the preview size image. - preview_pixel_height (int): - Height in pixels of the preview size image. - preview_image_url (str): - URL of the preview size image. - mime_type (google.ads.googleads.v6.enums.types.MimeTypeEnum.MimeType): - The mime type of the image. - name (str): - The name of the image. If the image was - created from a MediaFile, this is the - MediaFile's name. If the image was created from - bytes, this is empty. - media_file (str): - The MediaFile resource to use for the image. - data (bytes): - Raw image data as bytes. - ad_id_to_copy_image_from (int): - An ad ID to copy the image from. - """ - - pixel_width = proto.Field(proto.INT64, number=15, optional=True) - pixel_height = proto.Field(proto.INT64, number=16, optional=True) - image_url = proto.Field(proto.STRING, number=17, optional=True) - preview_pixel_width = proto.Field(proto.INT64, number=18, optional=True) - preview_pixel_height = proto.Field(proto.INT64, number=19, optional=True) - preview_image_url = proto.Field(proto.STRING, number=20, optional=True) - mime_type = proto.Field( - proto.ENUM, number=10, enum=gage_mime_type.MimeTypeEnum.MimeType, - ) - name = proto.Field(proto.STRING, number=21, optional=True) - media_file = proto.Field(proto.STRING, number=12, oneof="image") - data = proto.Field(proto.BYTES, number=13, oneof="image") - ad_id_to_copy_image_from = proto.Field( - proto.INT64, number=14, oneof="image" - ) - - -class VideoBumperInStreamAdInfo(proto.Message): - r"""Representation of video bumper in-stream ad format (very - short in-stream non-skippable video ad). - - Attributes: - companion_banner (str): - The MediaFile resource name of the companion - banner used with the ad. - """ - - companion_banner = proto.Field(proto.STRING, number=2, optional=True) - - -class VideoNonSkippableInStreamAdInfo(proto.Message): - r"""Representation of video non-skippable in-stream ad format (15 - second in-stream non-skippable video ad). - - Attributes: - companion_banner (str): - The MediaFile resource name of the companion - banner used with the ad. - """ - - companion_banner = proto.Field(proto.STRING, number=2, optional=True) - - -class VideoTrueViewInStreamAdInfo(proto.Message): - r"""Representation of video TrueView in-stream ad format (ad - shown during video playback, often at beginning, which displays - a skip button a few seconds into the video). - - Attributes: - action_button_label (str): - Label on the CTA (call-to-action) button - taking the user to the video ad's final URL. - Required for TrueView for action campaigns, - optional otherwise. - action_headline (str): - Additional text displayed with the CTA (call- - o-action) button to give context and encourage - clicking on the button. - companion_banner (str): - The MediaFile resource name of the companion - banner used with the ad. - """ - - action_button_label = proto.Field(proto.STRING, number=4, optional=True) - action_headline = proto.Field(proto.STRING, number=5, optional=True) - companion_banner = proto.Field(proto.STRING, number=6, optional=True) - - -class VideoOutstreamAdInfo(proto.Message): - r"""Representation of video out-stream ad format (ad shown - alongside a feed with automatic playback, without sound). - - Attributes: - headline (str): - The headline of the ad. - description (str): - The description line. - """ - - headline = proto.Field(proto.STRING, number=3, optional=True) - description = proto.Field(proto.STRING, number=4, optional=True) - - -class VideoTrueViewDiscoveryAdInfo(proto.Message): - r"""Representation of video TrueView discovery ad format. - - Attributes: - headline (str): - The headline of the ad. - description1 (str): - First text line for a TrueView video - discovery ad. - description2 (str): - Second text line for a TrueView video - discovery ad. - """ - - headline = proto.Field(proto.STRING, number=4, optional=True) - description1 = proto.Field(proto.STRING, number=5, optional=True) - description2 = proto.Field(proto.STRING, number=6, optional=True) - - -class VideoAdInfo(proto.Message): - r"""A video ad. - - Attributes: - media_file (str): - The MediaFile resource to use for the video. - in_stream (google.ads.googleads.v6.common.types.VideoTrueViewInStreamAdInfo): - Video TrueView in-stream ad format. - bumper (google.ads.googleads.v6.common.types.VideoBumperInStreamAdInfo): - Video bumper in-stream ad format. - out_stream (google.ads.googleads.v6.common.types.VideoOutstreamAdInfo): - Video out-stream ad format. - non_skippable (google.ads.googleads.v6.common.types.VideoNonSkippableInStreamAdInfo): - Video non-skippable in-stream ad format. - discovery (google.ads.googleads.v6.common.types.VideoTrueViewDiscoveryAdInfo): - Video TrueView discovery ad format. - """ - - media_file = proto.Field(proto.STRING, number=7, optional=True) - in_stream = proto.Field( - proto.MESSAGE, - number=2, - oneof="format", - message="VideoTrueViewInStreamAdInfo", - ) - bumper = proto.Field( - proto.MESSAGE, - number=3, - oneof="format", - message="VideoBumperInStreamAdInfo", - ) - out_stream = proto.Field( - proto.MESSAGE, number=4, oneof="format", message="VideoOutstreamAdInfo", - ) - non_skippable = proto.Field( - proto.MESSAGE, - number=5, - oneof="format", - message="VideoNonSkippableInStreamAdInfo", - ) - discovery = proto.Field( - proto.MESSAGE, - number=6, - oneof="format", - message="VideoTrueViewDiscoveryAdInfo", - ) - - -class VideoResponsiveAdInfo(proto.Message): - r"""A video responsive ad. - - Attributes: - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets used for the short - headline, e.g. the "Call To Action" banner. - Currently, only a single value for the short - headline is supported. - long_headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets used for the long - headline. Currently, only a single value for the - long headline is supported. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets used for the description. - Currently, only a single value for the - description is supported. - call_to_actions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets used for the button, e.g. - the "Call To Action" button. Currently, only a - single value for the button is supported. - videos (Sequence[google.ads.googleads.v6.common.types.AdVideoAsset]): - List of YouTube video assets used for the ad. - Currently, only a single value for the YouTube - video asset is supported. - companion_banners (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - List of image assets used for the companion - banner. Currently, only a single value for the - companion banner asset is supported. - """ - - headlines = proto.RepeatedField( - proto.MESSAGE, number=1, message=ad_asset.AdTextAsset, - ) - long_headlines = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=3, message=ad_asset.AdTextAsset, - ) - call_to_actions = proto.RepeatedField( - proto.MESSAGE, number=4, message=ad_asset.AdTextAsset, - ) - videos = proto.RepeatedField( - proto.MESSAGE, number=5, message=ad_asset.AdVideoAsset, - ) - companion_banners = proto.RepeatedField( - proto.MESSAGE, number=6, message=ad_asset.AdImageAsset, - ) - - -class ResponsiveSearchAdInfo(proto.Message): - r"""A responsive search ad. - Responsive search ads let you create an ad that adapts to show - more text, and more relevant messages, to your customers. Enter - multiple headlines and descriptions when creating a responsive - search ad, and over time, Google Ads will automatically test - different combinations and learn which combinations perform - best. By adapting your ad's content to more closely match - potential customers' search terms, responsive search ads may - improve your campaign's performance. - - More information at https://support.google.com/google- - ads/answer/7684791 - - Attributes: - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for headlines. When the - ad serves the headlines will be selected from - this list. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for descriptions. When - the ad serves the descriptions will be selected - from this list. - path1 (str): - First part of text that may appear appended - to the url displayed in the ad. - path2 (str): - Second part of text that may appear appended - to the url displayed in the ad. This field can - only be set when path1 is also set. - """ - - headlines = proto.RepeatedField( - proto.MESSAGE, number=1, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdTextAsset, - ) - path1 = proto.Field(proto.STRING, number=5, optional=True) - path2 = proto.Field(proto.STRING, number=6, optional=True) - - -class LegacyResponsiveDisplayAdInfo(proto.Message): - r"""A legacy responsive display ad. Ads of this type are labeled - 'Responsive ads' in the Google Ads UI. - - Attributes: - short_headline (str): - The short version of the ad's headline. - long_headline (str): - The long version of the ad's headline. - description (str): - The description of the ad. - business_name (str): - The business name in the ad. - allow_flexible_color (bool): - Advertiser's consent to allow flexible color. When true, the - ad may be served with different color if necessary. When - false, the ad will be served with the specified colors or a - neutral color. The default value is true. Must be true if - main_color and accent_color are not set. - accent_color (str): - The accent color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. - main_color (str): - The main color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. - call_to_action_text (str): - The call-to-action text for the ad. - logo_image (str): - The MediaFile resource name of the logo image - used in the ad. - square_logo_image (str): - The MediaFile resource name of the square - logo image used in the ad. - marketing_image (str): - The MediaFile resource name of the marketing - image used in the ad. - square_marketing_image (str): - The MediaFile resource name of the square - marketing image used in the ad. - format_setting (google.ads.googleads.v6.enums.types.DisplayAdFormatSettingEnum.DisplayAdFormatSetting): - Specifies which format the ad will be served in. Default is - ALL_FORMATS. - price_prefix (str): - Prefix before price. E.g. 'as low as'. - promo_text (str): - Promotion text used for dyanmic formats of - responsive ads. For example 'Free two-day - shipping'. - """ - - short_headline = proto.Field(proto.STRING, number=16, optional=True) - long_headline = proto.Field(proto.STRING, number=17, optional=True) - description = proto.Field(proto.STRING, number=18, optional=True) - business_name = proto.Field(proto.STRING, number=19, optional=True) - allow_flexible_color = proto.Field(proto.BOOL, number=20, optional=True) - accent_color = proto.Field(proto.STRING, number=21, optional=True) - main_color = proto.Field(proto.STRING, number=22, optional=True) - call_to_action_text = proto.Field(proto.STRING, number=23, optional=True) - logo_image = proto.Field(proto.STRING, number=24, optional=True) - square_logo_image = proto.Field(proto.STRING, number=25, optional=True) - marketing_image = proto.Field(proto.STRING, number=26, optional=True) - square_marketing_image = proto.Field(proto.STRING, number=27, optional=True) - format_setting = proto.Field( - proto.ENUM, - number=13, - enum=display_ad_format_setting.DisplayAdFormatSettingEnum.DisplayAdFormatSetting, - ) - price_prefix = proto.Field(proto.STRING, number=28, optional=True) - promo_text = proto.Field(proto.STRING, number=29, optional=True) - - -class AppAdInfo(proto.Message): - r"""An app ad. - - Attributes: - mandatory_ad_text (google.ads.googleads.v6.common.types.AdTextAsset): - Mandatory ad text. - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for headlines. When the - ad serves the headlines will be selected from - this list. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for descriptions. When - the ad serves the descriptions will be selected - from this list. - images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - List of image assets that may be displayed - with the ad. - youtube_videos (Sequence[google.ads.googleads.v6.common.types.AdVideoAsset]): - List of YouTube video assets that may be - displayed with the ad. - html5_media_bundles (Sequence[google.ads.googleads.v6.common.types.AdMediaBundleAsset]): - List of media bundle assets that may be used - with the ad. - """ - - mandatory_ad_text = proto.Field( - proto.MESSAGE, number=1, message=ad_asset.AdTextAsset, - ) - headlines = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=3, message=ad_asset.AdTextAsset, - ) - images = proto.RepeatedField( - proto.MESSAGE, number=4, message=ad_asset.AdImageAsset, - ) - youtube_videos = proto.RepeatedField( - proto.MESSAGE, number=5, message=ad_asset.AdVideoAsset, - ) - html5_media_bundles = proto.RepeatedField( - proto.MESSAGE, number=6, message=ad_asset.AdMediaBundleAsset, - ) - - -class AppEngagementAdInfo(proto.Message): - r"""App engagement ads allow you to write text encouraging a - specific action in the app, like checking in, making a purchase, - or booking a flight. They allow you to send users to a specific - part of your app where they can find what they're looking for - easier and faster. - - Attributes: - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for headlines. When the - ad serves the headlines will be selected from - this list. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for descriptions. When - the ad serves the descriptions will be selected - from this list. - images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - List of image assets that may be displayed - with the ad. - videos (Sequence[google.ads.googleads.v6.common.types.AdVideoAsset]): - List of video assets that may be displayed - with the ad. - """ - - headlines = proto.RepeatedField( - proto.MESSAGE, number=1, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdTextAsset, - ) - images = proto.RepeatedField( - proto.MESSAGE, number=3, message=ad_asset.AdImageAsset, - ) - videos = proto.RepeatedField( - proto.MESSAGE, number=4, message=ad_asset.AdVideoAsset, - ) - - -class LegacyAppInstallAdInfo(proto.Message): - r"""A legacy app install ad that only can be used by a few select - customers. - - Attributes: - app_id (str): - The id of the mobile app. - app_store (google.ads.googleads.v6.enums.types.LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore): - The app store the mobile app is available in. - headline (str): - The headline of the ad. - description1 (str): - The first description line of the ad. - description2 (str): - The second description line of the ad. - """ - - app_id = proto.Field(proto.STRING, number=6, optional=True) - app_store = proto.Field( - proto.ENUM, - number=2, - enum=legacy_app_install_ad_app_store.LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore, - ) - headline = proto.Field(proto.STRING, number=7, optional=True) - description1 = proto.Field(proto.STRING, number=8, optional=True) - description2 = proto.Field(proto.STRING, number=9, optional=True) - - -class ResponsiveDisplayAdInfo(proto.Message): - r"""A responsive display ad. - - Attributes: - marketing_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - Marketing images to be used in the ad. Valid image types are - GIF, JPEG, and PNG. The minimum size is 600x314 and the - aspect ratio must be 1.91:1 (+-1%). At least one - marketing_image is required. Combined with - square_marketing_images the maximum is 15. - square_marketing_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - Square marketing images to be used in the ad. Valid image - types are GIF, JPEG, and PNG. The minimum size is 300x300 - and the aspect ratio must be 1:1 (+-1%). At least one square - marketing_image is required. Combined with marketing_images - the maximum is 15. - logo_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - Logo images to be used in the ad. Valid image types are GIF, - JPEG, and PNG. The minimum size is 512x128 and the aspect - ratio must be 4:1 (+-1%). Combined with square_logo_images - the maximum is 5. - square_logo_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - Square logo images to be used in the ad. Valid image types - are GIF, JPEG, and PNG. The minimum size is 128x128 and the - aspect ratio must be 1:1 (+-1%). Combined with - square_logo_images the maximum is 5. - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - Short format headlines for the ad. The - maximum length is 30 characters. At least 1 and - max 5 headlines can be specified. - long_headline (google.ads.googleads.v6.common.types.AdTextAsset): - A required long format headline. The maximum - length is 90 characters. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - Descriptive texts for the ad. The maximum - length is 90 characters. At least 1 and max 5 - headlines can be specified. - youtube_videos (Sequence[google.ads.googleads.v6.common.types.AdVideoAsset]): - Optional YouTube videos for the ad. A maximum - of 5 videos can be specified. - business_name (str): - The advertiser/brand name. Maximum display - width is 25. - main_color (str): - The main color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. - accent_color (str): - The accent color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. - allow_flexible_color (bool): - Advertiser's consent to allow flexible color. When true, the - ad may be served with different color if necessary. When - false, the ad will be served with the specified colors or a - neutral color. The default value is true. Must be true if - main_color and accent_color are not set. - call_to_action_text (str): - The call-to-action text for the ad. Maximum - display width is 30. - price_prefix (str): - Prefix before price. E.g. 'as low as'. - promo_text (str): - Promotion text used for dyanmic formats of - responsive ads. For example 'Free two-day - shipping'. - format_setting (google.ads.googleads.v6.enums.types.DisplayAdFormatSettingEnum.DisplayAdFormatSetting): - Specifies which format the ad will be served in. Default is - ALL_FORMATS. - control_spec (google.ads.googleads.v6.common.types.ResponsiveDisplayAdControlSpec): - Specification for various creative controls. - """ - - marketing_images = proto.RepeatedField( - proto.MESSAGE, number=1, message=ad_asset.AdImageAsset, - ) - square_marketing_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdImageAsset, - ) - logo_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=ad_asset.AdImageAsset, - ) - square_logo_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=ad_asset.AdImageAsset, - ) - headlines = proto.RepeatedField( - proto.MESSAGE, number=5, message=ad_asset.AdTextAsset, - ) - long_headline = proto.Field( - proto.MESSAGE, number=6, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=7, message=ad_asset.AdTextAsset, - ) - youtube_videos = proto.RepeatedField( - proto.MESSAGE, number=8, message=ad_asset.AdVideoAsset, - ) - business_name = proto.Field(proto.STRING, number=17, optional=True) - main_color = proto.Field(proto.STRING, number=18, optional=True) - accent_color = proto.Field(proto.STRING, number=19, optional=True) - allow_flexible_color = proto.Field(proto.BOOL, number=20, optional=True) - call_to_action_text = proto.Field(proto.STRING, number=21, optional=True) - price_prefix = proto.Field(proto.STRING, number=22, optional=True) - promo_text = proto.Field(proto.STRING, number=23, optional=True) - format_setting = proto.Field( - proto.ENUM, - number=16, - enum=display_ad_format_setting.DisplayAdFormatSettingEnum.DisplayAdFormatSetting, - ) - control_spec = proto.Field( - proto.MESSAGE, number=24, message="ResponsiveDisplayAdControlSpec", - ) - - -class LocalAdInfo(proto.Message): - r"""A local ad. - - Attributes: - headlines (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for headlines. When the - ad serves the headlines will be selected from - this list. At least 1 and at most 5 headlines - must be specified. - descriptions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for descriptions. When - the ad serves the descriptions will be selected - from this list. At least 1 and at most 5 - descriptions must be specified. - call_to_actions (Sequence[google.ads.googleads.v6.common.types.AdTextAsset]): - List of text assets for call-to-actions. When - the ad serves the call-to-actions will be - selected from this list. Call-to-actions are - optional and at most 5 can be specified. - marketing_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - List of marketing image assets that may be - displayed with the ad. The images must be - 314x600 pixels or 320x320 pixels. At least 1 and - at most 20 image assets must be specified. - logo_images (Sequence[google.ads.googleads.v6.common.types.AdImageAsset]): - List of logo image assets that may be - displayed with the ad. The images must be - 128x128 pixels and not larger than 120KB. At - least 1 and at most 5 image assets must be - specified. - videos (Sequence[google.ads.googleads.v6.common.types.AdVideoAsset]): - List of YouTube video assets that may be - displayed with the ad. Videos are optional and - at most 20 can be specified. - path1 (str): - First part of optional text that may appear - appended to the url displayed in the ad. - path2 (str): - Second part of optional text that may appear - appended to the url displayed in the ad. This - field can only be set when path1 is also set. - """ - - headlines = proto.RepeatedField( - proto.MESSAGE, number=1, message=ad_asset.AdTextAsset, - ) - descriptions = proto.RepeatedField( - proto.MESSAGE, number=2, message=ad_asset.AdTextAsset, - ) - call_to_actions = proto.RepeatedField( - proto.MESSAGE, number=3, message=ad_asset.AdTextAsset, - ) - marketing_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=ad_asset.AdImageAsset, - ) - logo_images = proto.RepeatedField( - proto.MESSAGE, number=5, message=ad_asset.AdImageAsset, - ) - videos = proto.RepeatedField( - proto.MESSAGE, number=6, message=ad_asset.AdVideoAsset, - ) - path1 = proto.Field(proto.STRING, number=9, optional=True) - path2 = proto.Field(proto.STRING, number=10, optional=True) - - -class DisplayUploadAdInfo(proto.Message): - r"""A generic type of display ad. The exact ad format is controlled by - the display_upload_product_type field, which determines what kinds - of data need to be included with the ad. - - Attributes: - display_upload_product_type (google.ads.googleads.v6.enums.types.DisplayUploadProductTypeEnum.DisplayUploadProductType): - The product type of this ad. See comments on - the enum for details. - media_bundle (google.ads.googleads.v6.common.types.AdMediaBundleAsset): - A media bundle asset to be used in the ad. For information - about the media bundle for HTML5_UPLOAD_AD see - https://support.google.com/google-ads/answer/1722096 Media - bundles that are part of dynamic product types use a special - format that needs to be created through the Google Web - Designer. See - https://support.google.com/webdesigner/answer/7543898 for - more information. - """ - - display_upload_product_type = proto.Field( - proto.ENUM, - number=1, - enum=gage_display_upload_product_type.DisplayUploadProductTypeEnum.DisplayUploadProductType, - ) - media_bundle = proto.Field( - proto.MESSAGE, - number=2, - oneof="media_asset", - message=ad_asset.AdMediaBundleAsset, - ) - - -class ResponsiveDisplayAdControlSpec(proto.Message): - r"""Specification for various creative controls for a responsive - display ad. - - Attributes: - enable_asset_enhancements (bool): - Whether the advertiser has opted into the - asset enhancements feature. - enable_autogen_video (bool): - Whether the advertiser has opted into auto- - en video feature. - """ - - enable_asset_enhancements = proto.Field(proto.BOOL, number=1) - enable_autogen_video = proto.Field(proto.BOOL, number=2) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/asset_policy.py b/google/ads/googleads/v6/common/types/asset_policy.py deleted file mode 100644 index 28f4546f5..000000000 --- a/google/ads/googleads/v6/common/types/asset_policy.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import policy_approval_status -from google.ads.googleads.v6.enums.types import policy_review_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"AdAssetPolicySummary",}, -) - - -class AdAssetPolicySummary(proto.Message): - r"""Contains policy information for an asset inside an ad. - - Attributes: - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - The list of policy findings for this asset. - review_status (google.ads.googleads.v6.enums.types.PolicyReviewStatusEnum.PolicyReviewStatus): - Where in the review process this asset. - approval_status (google.ads.googleads.v6.enums.types.PolicyApprovalStatusEnum.PolicyApprovalStatus): - The overall approval status of this asset, - which is calculated based on the status of its - individual policy topic entries. - """ - - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=1, message=policy.PolicyTopicEntry, - ) - review_status = proto.Field( - proto.ENUM, - number=2, - enum=policy_review_status.PolicyReviewStatusEnum.PolicyReviewStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=3, - enum=policy_approval_status.PolicyApprovalStatusEnum.PolicyApprovalStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/asset_types.py b/google/ads/googleads/v6/common/types/asset_types.py deleted file mode 100644 index 1d59e2f09..000000000 --- a/google/ads/googleads/v6/common/types/asset_types.py +++ /dev/null @@ -1,310 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import lead_form_call_to_action_type -from google.ads.googleads.v6.enums.types import lead_form_desired_intent -from google.ads.googleads.v6.enums.types import lead_form_field_user_input_type -from google.ads.googleads.v6.enums.types import ( - lead_form_post_submit_call_to_action_type, -) -from google.ads.googleads.v6.enums.types import mime_type as gage_mime_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "YoutubeVideoAsset", - "MediaBundleAsset", - "ImageAsset", - "ImageDimension", - "TextAsset", - "LeadFormAsset", - "LeadFormField", - "LeadFormSingleChoiceAnswers", - "LeadFormDeliveryMethod", - "WebhookDelivery", - "BookOnGoogleAsset", - }, -) - - -class YoutubeVideoAsset(proto.Message): - r"""A YouTube asset. - - Attributes: - youtube_video_id (str): - YouTube video id. This is the 11 character - string value used in the YouTube video URL. - youtube_video_title (str): - YouTube video title. - """ - - youtube_video_id = proto.Field(proto.STRING, number=2, optional=True) - youtube_video_title = proto.Field(proto.STRING, number=3) - - -class MediaBundleAsset(proto.Message): - r"""A MediaBundle asset. - - Attributes: - data (bytes): - Media bundle (ZIP file) asset data. The - format of the uploaded ZIP file depends on the - ad field where it will be used. For more - information on the format, see the documentation - of the ad field where you plan on using the - MediaBundleAsset. This field is mutate only. - """ - - data = proto.Field(proto.BYTES, number=2, optional=True) - - -class ImageAsset(proto.Message): - r"""An Image asset. - - Attributes: - data (bytes): - The raw bytes data of an image. This field is - mutate only. - file_size (int): - File size of the image asset in bytes. - mime_type (google.ads.googleads.v6.enums.types.MimeTypeEnum.MimeType): - MIME type of the image asset. - full_size (google.ads.googleads.v6.common.types.ImageDimension): - Metadata for this image at its original size. - """ - - data = proto.Field(proto.BYTES, number=5, optional=True) - file_size = proto.Field(proto.INT64, number=6, optional=True) - mime_type = proto.Field( - proto.ENUM, number=3, enum=gage_mime_type.MimeTypeEnum.MimeType, - ) - full_size = proto.Field(proto.MESSAGE, number=4, message="ImageDimension",) - - -class ImageDimension(proto.Message): - r"""Metadata for an image at a certain size, either original or - resized. - - Attributes: - height_pixels (int): - Height of the image. - width_pixels (int): - Width of the image. - url (str): - A URL that returns the image with this height - and width. - """ - - height_pixels = proto.Field(proto.INT64, number=4, optional=True) - width_pixels = proto.Field(proto.INT64, number=5, optional=True) - url = proto.Field(proto.STRING, number=6, optional=True) - - -class TextAsset(proto.Message): - r"""A Text asset. - - Attributes: - text (str): - Text content of the text asset. - """ - - text = proto.Field(proto.STRING, number=2, optional=True) - - -class LeadFormAsset(proto.Message): - r"""A Lead Form asset. - - Attributes: - business_name (str): - Required. The name of the business being - advertised. - call_to_action_type (google.ads.googleads.v6.enums.types.LeadFormCallToActionTypeEnum.LeadFormCallToActionType): - Required. Pre-defined display text that - encourages user to expand the form. - call_to_action_description (str): - Required. Text giving a clear value - proposition of what users expect once they - expand the form. - headline (str): - Required. Headline of the expanded form to - describe what the form is asking for or - facilitating. - description (str): - Required. Detailed description of the - expanded form to describe what the form is - asking for or facilitating. - privacy_policy_url (str): - Required. Link to a page describing the - policy on how the collected data is handled by - the advertiser/business. - post_submit_headline (str): - Headline of text shown after form submission - that describes how the advertiser will follow up - with the user. - post_submit_description (str): - Detailed description shown after form - submission that describes how the advertiser - will follow up with the user. - fields (Sequence[google.ads.googleads.v6.common.types.LeadFormField]): - Ordered list of input fields. - delivery_methods (Sequence[google.ads.googleads.v6.common.types.LeadFormDeliveryMethod]): - Configured methods for collected lead data to - be delivered to advertiser. - post_submit_call_to_action_type (google.ads.googleads.v6.enums.types.LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType): - Pre-defined display text that encourages user - action after the form is submitted. - background_image_asset (str): - Asset resource name of the background image. - The minimum size is 600x314 and the aspect ratio - must be 1.91:1 (+-1%). - desired_intent (google.ads.googleads.v6.enums.types.LeadFormDesiredIntentEnum.LeadFormDesiredIntent): - Desired intent for the lead form, e.g. more - volume or higher intent. - custom_disclosure (str): - Custom disclosure shown along with Google - disclaimer on the lead form. Accessible to - allowed customers only. - """ - - business_name = proto.Field(proto.STRING, number=10) - call_to_action_type = proto.Field( - proto.ENUM, - number=17, - enum=lead_form_call_to_action_type.LeadFormCallToActionTypeEnum.LeadFormCallToActionType, - ) - call_to_action_description = proto.Field(proto.STRING, number=18) - headline = proto.Field(proto.STRING, number=12) - description = proto.Field(proto.STRING, number=13) - privacy_policy_url = proto.Field(proto.STRING, number=14) - post_submit_headline = proto.Field(proto.STRING, number=15, optional=True) - post_submit_description = proto.Field( - proto.STRING, number=16, optional=True - ) - fields = proto.RepeatedField( - proto.MESSAGE, number=8, message="LeadFormField", - ) - delivery_methods = proto.RepeatedField( - proto.MESSAGE, number=9, message="LeadFormDeliveryMethod", - ) - post_submit_call_to_action_type = proto.Field( - proto.ENUM, - number=19, - enum=lead_form_post_submit_call_to_action_type.LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType, - ) - background_image_asset = proto.Field(proto.STRING, number=20, optional=True) - desired_intent = proto.Field( - proto.ENUM, - number=21, - enum=lead_form_desired_intent.LeadFormDesiredIntentEnum.LeadFormDesiredIntent, - ) - custom_disclosure = proto.Field(proto.STRING, number=22, optional=True) - - -class LeadFormField(proto.Message): - r"""One input field instance within a form. - - Attributes: - input_type (google.ads.googleads.v6.enums.types.LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType): - Describes the input type, which may be a - predefined type such as "full name" or a pre- - vetted question like "Do you own a car?". - single_choice_answers (google.ads.googleads.v6.common.types.LeadFormSingleChoiceAnswers): - Answer configuration for a single choice - question. Can be set only for pre-vetted - question fields. Minimum of 2 answers required - and maximum of 12 allowed. - """ - - input_type = proto.Field( - proto.ENUM, - number=1, - enum=lead_form_field_user_input_type.LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType, - ) - single_choice_answers = proto.Field( - proto.MESSAGE, - number=2, - oneof="answers", - message="LeadFormSingleChoiceAnswers", - ) - - -class LeadFormSingleChoiceAnswers(proto.Message): - r"""Defines possible answers for a single choice question, - usually presented as a single-choice drop-down list. - - Attributes: - answers (Sequence[str]): - List of choices for a single question field. - The order of entries defines UI order. Minimum - of 2 answers required and maximum of 12 allowed. - """ - - answers = proto.RepeatedField(proto.STRING, number=1) - - -class LeadFormDeliveryMethod(proto.Message): - r"""A configuration of how leads are delivered to the advertiser. - - Attributes: - webhook (google.ads.googleads.v6.common.types.WebhookDelivery): - Webhook method of delivery. - """ - - webhook = proto.Field( - proto.MESSAGE, - number=1, - oneof="delivery_details", - message="WebhookDelivery", - ) - - -class WebhookDelivery(proto.Message): - r"""Google notifies the advertiser of leads by making HTTP calls - to an endpoint they specify. The requests contain JSON matching - a schema that Google publishes as part of form ads - documentation. - - Attributes: - advertiser_webhook_url (str): - Webhook url specified by advertiser to send - the lead. - google_secret (str): - Anti-spoofing secret set by the advertiser as - part of the webhook payload. - payload_schema_version (int): - The schema version that this delivery - instance will use. - """ - - advertiser_webhook_url = proto.Field(proto.STRING, number=4, optional=True) - google_secret = proto.Field(proto.STRING, number=5, optional=True) - payload_schema_version = proto.Field(proto.INT64, number=6, optional=True) - - -class BookOnGoogleAsset(proto.Message): - r"""A Book on Google asset. Used to redirect user to book through - Google. Book on Google will change the redirect url to book - directly through Google. - """ - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/bidding.py b/google/ads/googleads/v6/common/types/bidding.py deleted file mode 100644 index 9b9e5cdd4..000000000 --- a/google/ads/googleads/v6/common/types/bidding.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import target_impression_share_location - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "Commission", - "EnhancedCpc", - "ManualCpc", - "ManualCpm", - "ManualCpv", - "MaximizeConversions", - "MaximizeConversionValue", - "TargetCpa", - "TargetCpm", - "TargetImpressionShare", - "TargetRoas", - "TargetSpend", - "PercentCpc", - }, -) - - -class Commission(proto.Message): - r"""Commission is an automatic bidding strategy in which the - advertiser pays a certain portion of the conversion value. - - Attributes: - commission_rate_micros (int): - Commission rate defines the portion of the conversion value - that the advertiser will be billed. A commission rate of x - should be passed into this field as (x \* 1,000,000). For - example, 106,000 represents a commission rate of 0.106 - (10.6%). - """ - - commission_rate_micros = proto.Field(proto.INT64, number=2, optional=True) - - -class EnhancedCpc(proto.Message): - r"""An automated bidding strategy that raises bids for clicks - that seem more likely to lead to a conversion and lowers them - for clicks where they seem less likely. - """ - - -class ManualCpc(proto.Message): - r"""Manual click-based bidding where user pays per click. - - Attributes: - enhanced_cpc_enabled (bool): - Whether bids are to be enhanced based on - conversion optimizer data. - """ - - enhanced_cpc_enabled = proto.Field(proto.BOOL, number=2, optional=True) - - -class ManualCpm(proto.Message): - r"""Manual impression-based bidding where user pays per thousand - impressions. - """ - - -class ManualCpv(proto.Message): - r"""View based bidding where user pays per video view.""" - - -class MaximizeConversions(proto.Message): - r"""An automated bidding strategy to help get the most - conversions for your campaigns while spending your budget. - - Attributes: - target_cpa (int): - The target cost per acquisition (CPA) option. - This is the average amount that you would like - to spend per acquisition. - This field is read-only. - """ - - target_cpa = proto.Field(proto.INT64, number=1) - - -class MaximizeConversionValue(proto.Message): - r"""An automated bidding strategy to help get the most conversion - value for your campaigns while spending your budget. - - Attributes: - target_roas (float): - The target return on ad spend (ROAS) option. - If set, the bid strategy will maximize revenue - while averaging the target return on ad spend. - If the target ROAS is high, the bid strategy may - not be able to spend the full budget. If the - target ROAS is not set, the bid strategy will - aim to achieve the highest possible ROAS for the - budget. - """ - - target_roas = proto.Field(proto.DOUBLE, number=2, optional=True) - - -class TargetCpa(proto.Message): - r"""An automated bid strategy that sets bids to help get as many - conversions as possible at the target cost-per-acquisition (CPA) - you set. - - Attributes: - target_cpa_micros (int): - Average CPA target. - This target should be greater than or equal to - minimum billable unit based on the currency for - the account. - cpc_bid_ceiling_micros (int): - Maximum bid limit that can be set by the bid - strategy. The limit applies to all keywords - managed by the strategy. - cpc_bid_floor_micros (int): - Minimum bid limit that can be set by the bid - strategy. The limit applies to all keywords - managed by the strategy. - """ - - target_cpa_micros = proto.Field(proto.INT64, number=4, optional=True) - cpc_bid_ceiling_micros = proto.Field(proto.INT64, number=5, optional=True) - cpc_bid_floor_micros = proto.Field(proto.INT64, number=6, optional=True) - - -class TargetCpm(proto.Message): - r"""Target CPM (cost per thousand impressions) is an automated - bidding strategy that sets bids to optimize performance given - the target CPM you set. - """ - - -class TargetImpressionShare(proto.Message): - r"""An automated bidding strategy that sets bids so that a - certain percentage of search ads are shown at the top of the - first page (or other targeted location). - - Attributes: - location (google.ads.googleads.v6.enums.types.TargetImpressionShareLocationEnum.TargetImpressionShareLocation): - The targeted location on the search results - page. - location_fraction_micros (int): - The desired fraction of ads to be shown in - the targeted location in micros. E.g. 1% equals - 10,000. - cpc_bid_ceiling_micros (int): - The highest CPC bid the automated bidding - system is permitted to specify. This is a - required field entered by the advertiser that - sets the ceiling and specified in local micros. - """ - - location = proto.Field( - proto.ENUM, - number=1, - enum=target_impression_share_location.TargetImpressionShareLocationEnum.TargetImpressionShareLocation, - ) - location_fraction_micros = proto.Field(proto.INT64, number=4, optional=True) - cpc_bid_ceiling_micros = proto.Field(proto.INT64, number=5, optional=True) - - -class TargetRoas(proto.Message): - r"""An automated bidding strategy that helps you maximize revenue - while averaging a specific target return on ad spend (ROAS). - - Attributes: - target_roas (float): - Required. The desired revenue (based on - conversion data) per unit of spend. Value must - be between 0.01 and 1000.0, inclusive. - cpc_bid_ceiling_micros (int): - Maximum bid limit that can be set by the bid - strategy. The limit applies to all keywords - managed by the strategy. - cpc_bid_floor_micros (int): - Minimum bid limit that can be set by the bid - strategy. The limit applies to all keywords - managed by the strategy. - """ - - target_roas = proto.Field(proto.DOUBLE, number=4, optional=True) - cpc_bid_ceiling_micros = proto.Field(proto.INT64, number=5, optional=True) - cpc_bid_floor_micros = proto.Field(proto.INT64, number=6, optional=True) - - -class TargetSpend(proto.Message): - r"""An automated bid strategy that sets your bids to help get as - many clicks as possible within your budget. - - Attributes: - target_spend_micros (int): - The spend target under which to maximize - clicks. A TargetSpend bidder will attempt to - spend the smaller of this value or the natural - throttling spend amount. - If not specified, the budget is used as the - spend target. This field is deprecated and - should no longer be used. See https://ads- - developers.googleblog.com/2020/05/reminder- - about-sunset-creation-of.html for details. - cpc_bid_ceiling_micros (int): - Maximum bid limit that can be set by the bid - strategy. The limit applies to all keywords - managed by the strategy. - """ - - target_spend_micros = proto.Field(proto.INT64, number=3, optional=True) - cpc_bid_ceiling_micros = proto.Field(proto.INT64, number=4, optional=True) - - -class PercentCpc(proto.Message): - r"""A bidding strategy where bids are a fraction of the - advertised price for some good or service. - - Attributes: - cpc_bid_ceiling_micros (int): - Maximum bid limit that can be set by the bid strategy. This - is an optional field entered by the advertiser and specified - in local micros. Note: A zero value is interpreted in the - same way as having bid_ceiling undefined. - enhanced_cpc_enabled (bool): - Adjusts the bid for each auction upward or downward, - depending on the likelihood of a conversion. Individual bids - may exceed cpc_bid_ceiling_micros, but the average bid - amount for a campaign should not. - """ - - cpc_bid_ceiling_micros = proto.Field(proto.INT64, number=3, optional=True) - enhanced_cpc_enabled = proto.Field(proto.BOOL, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/click_location.py b/google/ads/googleads/v6/common/types/click_location.py deleted file mode 100644 index 65dabc515..000000000 --- a/google/ads/googleads/v6/common/types/click_location.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"ClickLocation",}, -) - - -class ClickLocation(proto.Message): - r"""Location criteria associated with a click. - - Attributes: - city (str): - The city location criterion associated with - the impression. - country (str): - The country location criterion associated - with the impression. - metro (str): - The metro location criterion associated with - the impression. - most_specific (str): - The most specific location criterion - associated with the impression. - region (str): - The region location criterion associated with - the impression. - """ - - city = proto.Field(proto.STRING, number=6, optional=True) - country = proto.Field(proto.STRING, number=7, optional=True) - metro = proto.Field(proto.STRING, number=8, optional=True) - most_specific = proto.Field(proto.STRING, number=9, optional=True) - region = proto.Field(proto.STRING, number=10, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/criteria.py b/google/ads/googleads/v6/common/types/criteria.py deleted file mode 100644 index a226381e0..000000000 --- a/google/ads/googleads/v6/common/types/criteria.py +++ /dev/null @@ -1,1132 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import age_range_type -from google.ads.googleads.v6.enums.types import app_payment_model_type -from google.ads.googleads.v6.enums.types import content_label_type -from google.ads.googleads.v6.enums.types import day_of_week as gage_day_of_week -from google.ads.googleads.v6.enums.types import device -from google.ads.googleads.v6.enums.types import gender_type -from google.ads.googleads.v6.enums.types import hotel_date_selection_type -from google.ads.googleads.v6.enums.types import income_range_type -from google.ads.googleads.v6.enums.types import interaction_type -from google.ads.googleads.v6.enums.types import keyword_match_type -from google.ads.googleads.v6.enums.types import listing_group_type -from google.ads.googleads.v6.enums.types import location_group_radius_units -from google.ads.googleads.v6.enums.types import minute_of_hour -from google.ads.googleads.v6.enums.types import parental_status_type -from google.ads.googleads.v6.enums.types import preferred_content_type -from google.ads.googleads.v6.enums.types import product_bidding_category_level -from google.ads.googleads.v6.enums.types import ( - product_channel as gage_product_channel, -) -from google.ads.googleads.v6.enums.types import ( - product_channel_exclusivity as gage_product_channel_exclusivity, -) -from google.ads.googleads.v6.enums.types import ( - product_condition as gage_product_condition, -) -from google.ads.googleads.v6.enums.types import product_custom_attribute_index -from google.ads.googleads.v6.enums.types import product_type_level -from google.ads.googleads.v6.enums.types import proximity_radius_units -from google.ads.googleads.v6.enums.types import webpage_condition_operand -from google.ads.googleads.v6.enums.types import webpage_condition_operator - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "KeywordInfo", - "PlacementInfo", - "MobileAppCategoryInfo", - "MobileApplicationInfo", - "LocationInfo", - "DeviceInfo", - "PreferredContentInfo", - "ListingGroupInfo", - "ListingScopeInfo", - "ListingDimensionInfo", - "HotelIdInfo", - "HotelClassInfo", - "HotelCountryRegionInfo", - "HotelStateInfo", - "HotelCityInfo", - "ProductBiddingCategoryInfo", - "ProductBrandInfo", - "ProductChannelInfo", - "ProductChannelExclusivityInfo", - "ProductConditionInfo", - "ProductCustomAttributeInfo", - "ProductItemIdInfo", - "ProductTypeInfo", - "UnknownListingDimensionInfo", - "HotelDateSelectionTypeInfo", - "HotelAdvanceBookingWindowInfo", - "HotelLengthOfStayInfo", - "HotelCheckInDayInfo", - "InteractionTypeInfo", - "AdScheduleInfo", - "AgeRangeInfo", - "GenderInfo", - "IncomeRangeInfo", - "ParentalStatusInfo", - "YouTubeVideoInfo", - "YouTubeChannelInfo", - "UserListInfo", - "ProximityInfo", - "GeoPointInfo", - "AddressInfo", - "TopicInfo", - "LanguageInfo", - "IpBlockInfo", - "ContentLabelInfo", - "CarrierInfo", - "UserInterestInfo", - "WebpageInfo", - "WebpageConditionInfo", - "OperatingSystemVersionInfo", - "AppPaymentModelInfo", - "MobileDeviceInfo", - "CustomAffinityInfo", - "CustomIntentInfo", - "LocationGroupInfo", - "CustomAudienceInfo", - "CombinedAudienceInfo", - }, -) - - -class KeywordInfo(proto.Message): - r"""A keyword criterion. - - Attributes: - text (str): - The text of the keyword (at most 80 - characters and 10 words). - match_type (google.ads.googleads.v6.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - The match type of the keyword. - """ - - text = proto.Field(proto.STRING, number=3, optional=True) - match_type = proto.Field( - proto.ENUM, - number=2, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - - -class PlacementInfo(proto.Message): - r"""A placement criterion. This can be used to modify bids for - sites when targeting the content network. - - Attributes: - url (str): - URL of the placement. - For example, "http://www.domain.com". - """ - - url = proto.Field(proto.STRING, number=2, optional=True) - - -class MobileAppCategoryInfo(proto.Message): - r"""A mobile app category criterion. - - Attributes: - mobile_app_category_constant (str): - The mobile app category constant resource - name. - """ - - mobile_app_category_constant = proto.Field( - proto.STRING, number=2, optional=True - ) - - -class MobileApplicationInfo(proto.Message): - r"""A mobile application criterion. - - Attributes: - app_id (str): - A string that uniquely identifies a mobile application to - Google Ads API. The format of this string is - "{platform}-{platform_native_id}", where platform is "1" for - iOS apps and "2" for Android apps, and where - platform_native_id is the mobile application identifier - native to the corresponding platform. For iOS, this native - identifier is the 9 digit string that appears at the end of - an App Store URL (e.g., "476943146" for "Flood-It! 2" whose - App Store link is - "http://itunes.apple.com/us/app/flood-it!-2/id476943146"). - For Android, this native identifier is the application's - package name (e.g., "com.labpixies.colordrips" for "Color - Drips" given Google Play link - "https://play.google.com/store/apps/details?id=com.labpixies.colordrips"). - A well formed app id for Google Ads API would thus be - "1-476943146" for iOS and "2-com.labpixies.colordrips" for - Android. This field is required and must be set in CREATE - operations. - name (str): - Name of this mobile application. - """ - - app_id = proto.Field(proto.STRING, number=4, optional=True) - name = proto.Field(proto.STRING, number=5, optional=True) - - -class LocationInfo(proto.Message): - r"""A location criterion. - - Attributes: - geo_target_constant (str): - The geo target constant resource name. - """ - - geo_target_constant = proto.Field(proto.STRING, number=2, optional=True) - - -class DeviceInfo(proto.Message): - r"""A device criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.DeviceEnum.Device): - Type of the device. - """ - - type_ = proto.Field(proto.ENUM, number=1, enum=device.DeviceEnum.Device,) - - -class PreferredContentInfo(proto.Message): - r"""A preferred content criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.PreferredContentTypeEnum.PreferredContentType): - Type of the preferred content. - """ - - type_ = proto.Field( - proto.ENUM, - number=2, - enum=preferred_content_type.PreferredContentTypeEnum.PreferredContentType, - ) - - -class ListingGroupInfo(proto.Message): - r"""A listing group criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.ListingGroupTypeEnum.ListingGroupType): - Type of the listing group. - case_value (google.ads.googleads.v6.common.types.ListingDimensionInfo): - Dimension value with which this listing group - is refining its parent. Undefined for the root - group. - parent_ad_group_criterion (str): - Resource name of ad group criterion which is - the parent listing group subdivision. Null for - the root group. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=listing_group_type.ListingGroupTypeEnum.ListingGroupType, - ) - case_value = proto.Field( - proto.MESSAGE, number=2, message="ListingDimensionInfo", - ) - parent_ad_group_criterion = proto.Field( - proto.STRING, number=4, optional=True - ) - - -class ListingScopeInfo(proto.Message): - r"""A listing scope criterion. - - Attributes: - dimensions (Sequence[google.ads.googleads.v6.common.types.ListingDimensionInfo]): - Scope of the campaign criterion. - """ - - dimensions = proto.RepeatedField( - proto.MESSAGE, number=2, message="ListingDimensionInfo", - ) - - -class ListingDimensionInfo(proto.Message): - r"""Listing dimensions for listing group criterion. - - Attributes: - hotel_id (google.ads.googleads.v6.common.types.HotelIdInfo): - Advertiser-specific hotel ID. - hotel_class (google.ads.googleads.v6.common.types.HotelClassInfo): - Class of the hotel as a number of stars 1 to - 5. - hotel_country_region (google.ads.googleads.v6.common.types.HotelCountryRegionInfo): - Country or Region the hotel is located in. - hotel_state (google.ads.googleads.v6.common.types.HotelStateInfo): - State the hotel is located in. - hotel_city (google.ads.googleads.v6.common.types.HotelCityInfo): - City the hotel is located in. - product_bidding_category (google.ads.googleads.v6.common.types.ProductBiddingCategoryInfo): - Bidding category of a product offer. - product_brand (google.ads.googleads.v6.common.types.ProductBrandInfo): - Brand of a product offer. - product_channel (google.ads.googleads.v6.common.types.ProductChannelInfo): - Locality of a product offer. - product_channel_exclusivity (google.ads.googleads.v6.common.types.ProductChannelExclusivityInfo): - Availability of a product offer. - product_condition (google.ads.googleads.v6.common.types.ProductConditionInfo): - Condition of a product offer. - product_custom_attribute (google.ads.googleads.v6.common.types.ProductCustomAttributeInfo): - Custom attribute of a product offer. - product_item_id (google.ads.googleads.v6.common.types.ProductItemIdInfo): - Item id of a product offer. - product_type (google.ads.googleads.v6.common.types.ProductTypeInfo): - Type of a product offer. - unknown_listing_dimension (google.ads.googleads.v6.common.types.UnknownListingDimensionInfo): - Unknown dimension. Set when no other listing - dimension is set. - """ - - hotel_id = proto.Field( - proto.MESSAGE, number=2, oneof="dimension", message="HotelIdInfo", - ) - hotel_class = proto.Field( - proto.MESSAGE, number=3, oneof="dimension", message="HotelClassInfo", - ) - hotel_country_region = proto.Field( - proto.MESSAGE, - number=4, - oneof="dimension", - message="HotelCountryRegionInfo", - ) - hotel_state = proto.Field( - proto.MESSAGE, number=5, oneof="dimension", message="HotelStateInfo", - ) - hotel_city = proto.Field( - proto.MESSAGE, number=6, oneof="dimension", message="HotelCityInfo", - ) - product_bidding_category = proto.Field( - proto.MESSAGE, - number=13, - oneof="dimension", - message="ProductBiddingCategoryInfo", - ) - product_brand = proto.Field( - proto.MESSAGE, number=15, oneof="dimension", message="ProductBrandInfo", - ) - product_channel = proto.Field( - proto.MESSAGE, - number=8, - oneof="dimension", - message="ProductChannelInfo", - ) - product_channel_exclusivity = proto.Field( - proto.MESSAGE, - number=9, - oneof="dimension", - message="ProductChannelExclusivityInfo", - ) - product_condition = proto.Field( - proto.MESSAGE, - number=10, - oneof="dimension", - message="ProductConditionInfo", - ) - product_custom_attribute = proto.Field( - proto.MESSAGE, - number=16, - oneof="dimension", - message="ProductCustomAttributeInfo", - ) - product_item_id = proto.Field( - proto.MESSAGE, - number=11, - oneof="dimension", - message="ProductItemIdInfo", - ) - product_type = proto.Field( - proto.MESSAGE, number=12, oneof="dimension", message="ProductTypeInfo", - ) - unknown_listing_dimension = proto.Field( - proto.MESSAGE, - number=14, - oneof="dimension", - message="UnknownListingDimensionInfo", - ) - - -class HotelIdInfo(proto.Message): - r"""Advertiser-specific hotel ID. - - Attributes: - value (str): - String value of the hotel ID. - """ - - value = proto.Field(proto.STRING, number=2, optional=True) - - -class HotelClassInfo(proto.Message): - r"""Class of the hotel as a number of stars 1 to 5. - - Attributes: - value (int): - Long value of the hotel class. - """ - - value = proto.Field(proto.INT64, number=2, optional=True) - - -class HotelCountryRegionInfo(proto.Message): - r"""Country or Region the hotel is located in. - - Attributes: - country_region_criterion (str): - The Geo Target Constant resource name. - """ - - country_region_criterion = proto.Field( - proto.STRING, number=2, optional=True - ) - - -class HotelStateInfo(proto.Message): - r"""State the hotel is located in. - - Attributes: - state_criterion (str): - The Geo Target Constant resource name. - """ - - state_criterion = proto.Field(proto.STRING, number=2, optional=True) - - -class HotelCityInfo(proto.Message): - r"""City the hotel is located in. - - Attributes: - city_criterion (str): - The Geo Target Constant resource name. - """ - - city_criterion = proto.Field(proto.STRING, number=2, optional=True) - - -class ProductBiddingCategoryInfo(proto.Message): - r"""Bidding category of a product offer. - - Attributes: - id (int): - ID of the product bidding category. - - This ID is equivalent to the google_product_category ID as - described in this article: - https://support.google.com/merchants/answer/6324436 - country_code (str): - Two-letter upper-case country code of the product bidding - category. It must match the - campaign.shopping_setting.sales_country field. - level (google.ads.googleads.v6.enums.types.ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel): - Level of the product bidding category. - """ - - id = proto.Field(proto.INT64, number=4, optional=True) - country_code = proto.Field(proto.STRING, number=5, optional=True) - level = proto.Field( - proto.ENUM, - number=3, - enum=product_bidding_category_level.ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel, - ) - - -class ProductBrandInfo(proto.Message): - r"""Brand of the product. - - Attributes: - value (str): - String value of the product brand. - """ - - value = proto.Field(proto.STRING, number=2, optional=True) - - -class ProductChannelInfo(proto.Message): - r"""Locality of a product offer. - - Attributes: - channel (google.ads.googleads.v6.enums.types.ProductChannelEnum.ProductChannel): - Value of the locality. - """ - - channel = proto.Field( - proto.ENUM, - number=1, - enum=gage_product_channel.ProductChannelEnum.ProductChannel, - ) - - -class ProductChannelExclusivityInfo(proto.Message): - r"""Availability of a product offer. - - Attributes: - channel_exclusivity (google.ads.googleads.v6.enums.types.ProductChannelExclusivityEnum.ProductChannelExclusivity): - Value of the availability. - """ - - channel_exclusivity = proto.Field( - proto.ENUM, - number=1, - enum=gage_product_channel_exclusivity.ProductChannelExclusivityEnum.ProductChannelExclusivity, - ) - - -class ProductConditionInfo(proto.Message): - r"""Condition of a product offer. - - Attributes: - condition (google.ads.googleads.v6.enums.types.ProductConditionEnum.ProductCondition): - Value of the condition. - """ - - condition = proto.Field( - proto.ENUM, - number=1, - enum=gage_product_condition.ProductConditionEnum.ProductCondition, - ) - - -class ProductCustomAttributeInfo(proto.Message): - r"""Custom attribute of a product offer. - - Attributes: - value (str): - String value of the product custom attribute. - index (google.ads.googleads.v6.enums.types.ProductCustomAttributeIndexEnum.ProductCustomAttributeIndex): - Indicates the index of the custom attribute. - """ - - value = proto.Field(proto.STRING, number=3, optional=True) - index = proto.Field( - proto.ENUM, - number=2, - enum=product_custom_attribute_index.ProductCustomAttributeIndexEnum.ProductCustomAttributeIndex, - ) - - -class ProductItemIdInfo(proto.Message): - r"""Item id of a product offer. - - Attributes: - value (str): - Value of the id. - """ - - value = proto.Field(proto.STRING, number=2, optional=True) - - -class ProductTypeInfo(proto.Message): - r"""Type of a product offer. - - Attributes: - value (str): - Value of the type. - level (google.ads.googleads.v6.enums.types.ProductTypeLevelEnum.ProductTypeLevel): - Level of the type. - """ - - value = proto.Field(proto.STRING, number=3, optional=True) - level = proto.Field( - proto.ENUM, - number=2, - enum=product_type_level.ProductTypeLevelEnum.ProductTypeLevel, - ) - - -class UnknownListingDimensionInfo(proto.Message): - r"""Unknown listing dimension.""" - - -class HotelDateSelectionTypeInfo(proto.Message): - r"""Criterion for hotel date selection (default dates vs. user - selected). - - Attributes: - type_ (google.ads.googleads.v6.enums.types.HotelDateSelectionTypeEnum.HotelDateSelectionType): - Type of the hotel date selection - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=hotel_date_selection_type.HotelDateSelectionTypeEnum.HotelDateSelectionType, - ) - - -class HotelAdvanceBookingWindowInfo(proto.Message): - r"""Criterion for number of days prior to the stay the booking is - being made. - - Attributes: - min_days (int): - Low end of the number of days prior to the - stay. - max_days (int): - High end of the number of days prior to the - stay. - """ - - min_days = proto.Field(proto.INT64, number=3, optional=True) - max_days = proto.Field(proto.INT64, number=4, optional=True) - - -class HotelLengthOfStayInfo(proto.Message): - r"""Criterion for length of hotel stay in nights. - - Attributes: - min_nights (int): - Low end of the number of nights in the stay. - max_nights (int): - High end of the number of nights in the stay. - """ - - min_nights = proto.Field(proto.INT64, number=3, optional=True) - max_nights = proto.Field(proto.INT64, number=4, optional=True) - - -class HotelCheckInDayInfo(proto.Message): - r"""Criterion for day of the week the booking is for. - - Attributes: - day_of_week (google.ads.googleads.v6.enums.types.DayOfWeekEnum.DayOfWeek): - The day of the week. - """ - - day_of_week = proto.Field( - proto.ENUM, number=1, enum=gage_day_of_week.DayOfWeekEnum.DayOfWeek, - ) - - -class InteractionTypeInfo(proto.Message): - r"""Criterion for Interaction Type. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.InteractionTypeEnum.InteractionType): - The interaction type. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=interaction_type.InteractionTypeEnum.InteractionType, - ) - - -class AdScheduleInfo(proto.Message): - r"""Represents an AdSchedule criterion. - AdSchedule is specified as the day of the week and a time - interval within which ads will be shown. - - No more than six AdSchedules can be added for the same day. - - Attributes: - start_minute (google.ads.googleads.v6.enums.types.MinuteOfHourEnum.MinuteOfHour): - Minutes after the start hour at which this - schedule starts. - This field is required for CREATE operations and - is prohibited on UPDATE operations. - end_minute (google.ads.googleads.v6.enums.types.MinuteOfHourEnum.MinuteOfHour): - Minutes after the end hour at which this - schedule ends. The schedule is exclusive of the - end minute. - This field is required for CREATE operations and - is prohibited on UPDATE operations. - start_hour (int): - Starting hour in 24 hour time. - This field must be between 0 and 23, inclusive. - This field is required for CREATE operations and - is prohibited on UPDATE operations. - end_hour (int): - Ending hour in 24 hour time; 24 signifies end - of the day. This field must be between 0 and 24, - inclusive. - This field is required for CREATE operations and - is prohibited on UPDATE operations. - day_of_week (google.ads.googleads.v6.enums.types.DayOfWeekEnum.DayOfWeek): - Day of the week the schedule applies to. - This field is required for CREATE operations and - is prohibited on UPDATE operations. - """ - - start_minute = proto.Field( - proto.ENUM, number=1, enum=minute_of_hour.MinuteOfHourEnum.MinuteOfHour, - ) - end_minute = proto.Field( - proto.ENUM, number=2, enum=minute_of_hour.MinuteOfHourEnum.MinuteOfHour, - ) - start_hour = proto.Field(proto.INT32, number=6, optional=True) - end_hour = proto.Field(proto.INT32, number=7, optional=True) - day_of_week = proto.Field( - proto.ENUM, number=5, enum=gage_day_of_week.DayOfWeekEnum.DayOfWeek, - ) - - -class AgeRangeInfo(proto.Message): - r"""An age range criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.AgeRangeTypeEnum.AgeRangeType): - Type of the age range. - """ - - type_ = proto.Field( - proto.ENUM, number=1, enum=age_range_type.AgeRangeTypeEnum.AgeRangeType, - ) - - -class GenderInfo(proto.Message): - r"""A gender criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.GenderTypeEnum.GenderType): - Type of the gender. - """ - - type_ = proto.Field( - proto.ENUM, number=1, enum=gender_type.GenderTypeEnum.GenderType, - ) - - -class IncomeRangeInfo(proto.Message): - r"""An income range criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.IncomeRangeTypeEnum.IncomeRangeType): - Type of the income range. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=income_range_type.IncomeRangeTypeEnum.IncomeRangeType, - ) - - -class ParentalStatusInfo(proto.Message): - r"""A parental status criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.ParentalStatusTypeEnum.ParentalStatusType): - Type of the parental status. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=parental_status_type.ParentalStatusTypeEnum.ParentalStatusType, - ) - - -class YouTubeVideoInfo(proto.Message): - r"""A YouTube Video criterion. - - Attributes: - video_id (str): - YouTube video id as it appears on the YouTube - watch page. - """ - - video_id = proto.Field(proto.STRING, number=2, optional=True) - - -class YouTubeChannelInfo(proto.Message): - r"""A YouTube Channel criterion. - - Attributes: - channel_id (str): - The YouTube uploader channel id or the - channel code of a YouTube channel. - """ - - channel_id = proto.Field(proto.STRING, number=2, optional=True) - - -class UserListInfo(proto.Message): - r"""A User List criterion. Represents a user list that is defined - by the advertiser to be targeted. - - Attributes: - user_list (str): - The User List resource name. - """ - - user_list = proto.Field(proto.STRING, number=2, optional=True) - - -class ProximityInfo(proto.Message): - r"""A Proximity criterion. The geo point and radius determine - what geographical area is included. The address is a description - of the geo point that does not affect ad serving. - - There are two ways to create a proximity. First, by setting an - address and radius. The geo point will be automatically - computed. Second, by setting a geo point and radius. The address - is an optional label that won't be validated. - - Attributes: - geo_point (google.ads.googleads.v6.common.types.GeoPointInfo): - Latitude and longitude. - radius (float): - The radius of the proximity. - radius_units (google.ads.googleads.v6.enums.types.ProximityRadiusUnitsEnum.ProximityRadiusUnits): - The unit of measurement of the radius. - Default is KILOMETERS. - address (google.ads.googleads.v6.common.types.AddressInfo): - Full address. - """ - - geo_point = proto.Field(proto.MESSAGE, number=1, message="GeoPointInfo",) - radius = proto.Field(proto.DOUBLE, number=5, optional=True) - radius_units = proto.Field( - proto.ENUM, - number=3, - enum=proximity_radius_units.ProximityRadiusUnitsEnum.ProximityRadiusUnits, - ) - address = proto.Field(proto.MESSAGE, number=4, message="AddressInfo",) - - -class GeoPointInfo(proto.Message): - r"""Geo point for proximity criterion. - - Attributes: - longitude_in_micro_degrees (int): - Micro degrees for the longitude. - latitude_in_micro_degrees (int): - Micro degrees for the latitude. - """ - - longitude_in_micro_degrees = proto.Field( - proto.INT32, number=3, optional=True - ) - latitude_in_micro_degrees = proto.Field( - proto.INT32, number=4, optional=True - ) - - -class AddressInfo(proto.Message): - r"""Address for proximity criterion. - - Attributes: - postal_code (str): - Postal code. - province_code (str): - Province or state code. - country_code (str): - Country code. - province_name (str): - Province or state name. - street_address (str): - Street address line 1. - street_address2 (str): - Street address line 2. This field is write-only. It is only - used for calculating the longitude and latitude of an - address when geo_point is empty. - city_name (str): - Name of the city. - """ - - postal_code = proto.Field(proto.STRING, number=8, optional=True) - province_code = proto.Field(proto.STRING, number=9, optional=True) - country_code = proto.Field(proto.STRING, number=10, optional=True) - province_name = proto.Field(proto.STRING, number=11, optional=True) - street_address = proto.Field(proto.STRING, number=12, optional=True) - street_address2 = proto.Field(proto.STRING, number=13, optional=True) - city_name = proto.Field(proto.STRING, number=14, optional=True) - - -class TopicInfo(proto.Message): - r"""A topic criterion. Use topics to target or exclude placements - in the Google Display Network based on the category into which - the placement falls (for example, "Pets & Animals/Pets/Dogs"). - - Attributes: - topic_constant (str): - The Topic Constant resource name. - path (Sequence[str]): - The category to target or exclude. Each - subsequent element in the array describes a more - specific sub-category. For example, "Pets & - Animals", "Pets", "Dogs" represents the "Pets & - Animals/Pets/Dogs" category. - """ - - topic_constant = proto.Field(proto.STRING, number=3, optional=True) - path = proto.RepeatedField(proto.STRING, number=4) - - -class LanguageInfo(proto.Message): - r"""A language criterion. - - Attributes: - language_constant (str): - The language constant resource name. - """ - - language_constant = proto.Field(proto.STRING, number=2, optional=True) - - -class IpBlockInfo(proto.Message): - r"""An IpBlock criterion used for IP exclusions. We allow: - - IPv4 and IPv6 addresses - - individual addresses (192.168.0.1) - - masks for individual addresses (192.168.0.1/32) - - masks for Class C networks (192.168.0.1/24) - - Attributes: - ip_address (str): - The IP address of this IP block. - """ - - ip_address = proto.Field(proto.STRING, number=2, optional=True) - - -class ContentLabelInfo(proto.Message): - r"""Content Label for category exclusion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.ContentLabelTypeEnum.ContentLabelType): - Content label type, required for CREATE - operations. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=content_label_type.ContentLabelTypeEnum.ContentLabelType, - ) - - -class CarrierInfo(proto.Message): - r"""Represents a Carrier Criterion. - - Attributes: - carrier_constant (str): - The Carrier constant resource name. - """ - - carrier_constant = proto.Field(proto.STRING, number=2, optional=True) - - -class UserInterestInfo(proto.Message): - r"""Represents a particular interest-based topic to be targeted. - - Attributes: - user_interest_category (str): - The UserInterest resource name. - """ - - user_interest_category = proto.Field(proto.STRING, number=2, optional=True) - - -class WebpageInfo(proto.Message): - r"""Represents a criterion for targeting webpages of an - advertiser's website. - - Attributes: - criterion_name (str): - The name of the criterion that is defined by - this parameter. The name value will be used for - identifying, sorting and filtering criteria with - this type of parameters. - - This field is required for CREATE operations and - is prohibited on UPDATE operations. - conditions (Sequence[google.ads.googleads.v6.common.types.WebpageConditionInfo]): - Conditions, or logical expressions, for - webpage targeting. The list of webpage targeting - conditions are and-ed together when evaluated - for targeting. - - This field is required for CREATE operations and - is prohibited on UPDATE operations. - """ - - criterion_name = proto.Field(proto.STRING, number=3, optional=True) - conditions = proto.RepeatedField( - proto.MESSAGE, number=2, message="WebpageConditionInfo", - ) - - -class WebpageConditionInfo(proto.Message): - r"""Logical expression for targeting webpages of an advertiser's - website. - - Attributes: - operand (google.ads.googleads.v6.enums.types.WebpageConditionOperandEnum.WebpageConditionOperand): - Operand of webpage targeting condition. - operator (google.ads.googleads.v6.enums.types.WebpageConditionOperatorEnum.WebpageConditionOperator): - Operator of webpage targeting condition. - argument (str): - Argument of webpage targeting condition. - """ - - operand = proto.Field( - proto.ENUM, - number=1, - enum=webpage_condition_operand.WebpageConditionOperandEnum.WebpageConditionOperand, - ) - operator = proto.Field( - proto.ENUM, - number=2, - enum=webpage_condition_operator.WebpageConditionOperatorEnum.WebpageConditionOperator, - ) - argument = proto.Field(proto.STRING, number=4, optional=True) - - -class OperatingSystemVersionInfo(proto.Message): - r"""Represents an operating system version to be targeted. - - Attributes: - operating_system_version_constant (str): - The operating system version constant - resource name. - """ - - operating_system_version_constant = proto.Field( - proto.STRING, number=2, optional=True - ) - - -class AppPaymentModelInfo(proto.Message): - r"""An app payment model criterion. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.AppPaymentModelTypeEnum.AppPaymentModelType): - Type of the app payment model. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=app_payment_model_type.AppPaymentModelTypeEnum.AppPaymentModelType, - ) - - -class MobileDeviceInfo(proto.Message): - r"""A mobile device criterion. - - Attributes: - mobile_device_constant (str): - The mobile device constant resource name. - """ - - mobile_device_constant = proto.Field(proto.STRING, number=2, optional=True) - - -class CustomAffinityInfo(proto.Message): - r"""A custom affinity criterion. - A criterion of this type is only targetable. - - Attributes: - custom_affinity (str): - The CustomInterest resource name. - """ - - custom_affinity = proto.Field(proto.STRING, number=2, optional=True) - - -class CustomIntentInfo(proto.Message): - r"""A custom intent criterion. - A criterion of this type is only targetable. - - Attributes: - custom_intent (str): - The CustomInterest resource name. - """ - - custom_intent = proto.Field(proto.STRING, number=2, optional=True) - - -class LocationGroupInfo(proto.Message): - r"""A radius around a list of locations specified via a feed. - - Attributes: - feed (str): - Feed specifying locations for targeting. - This is required and must be set in CREATE - operations. - geo_target_constants (Sequence[str]): - Geo target constant(s) restricting the scope - of the geographic area within the feed. - Currently only one geo target constant is - allowed. - radius (int): - Distance in units specifying the radius - around targeted locations. This is required and - must be set in CREATE operations. - radius_units (google.ads.googleads.v6.enums.types.LocationGroupRadiusUnitsEnum.LocationGroupRadiusUnits): - Unit of the radius. Miles and meters are - supported for geo target constants. Milli miles - and meters are supported for feed item sets. - This is required and must be set in CREATE - operations. - feed_item_sets (Sequence[str]): - FeedItemSets whose FeedItems are targeted. If multiple IDs - are specified, then all items that appear in at least one - set are targeted. This field cannot be used with - geo_target_constants. This is optional and can only be set - in CREATE operations. - """ - - feed = proto.Field(proto.STRING, number=5, optional=True) - geo_target_constants = proto.RepeatedField(proto.STRING, number=6) - radius = proto.Field(proto.INT64, number=7, optional=True) - radius_units = proto.Field( - proto.ENUM, - number=4, - enum=location_group_radius_units.LocationGroupRadiusUnitsEnum.LocationGroupRadiusUnits, - ) - feed_item_sets = proto.RepeatedField(proto.STRING, number=8) - - -class CustomAudienceInfo(proto.Message): - r"""A custom audience criterion. - - Attributes: - custom_audience (str): - The CustomAudience resource name. - """ - - custom_audience = proto.Field(proto.STRING, number=1) - - -class CombinedAudienceInfo(proto.Message): - r"""A combined audience criterion. - - Attributes: - combined_audience (str): - The CombinedAudience resource name. - """ - - combined_audience = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/criterion_category_availability.py b/google/ads/googleads/v6/common/types/criterion_category_availability.py deleted file mode 100644 index 8590af987..000000000 --- a/google/ads/googleads/v6/common/types/criterion_category_availability.py +++ /dev/null @@ -1,138 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - advertising_channel_sub_type as gage_advertising_channel_sub_type, -) -from google.ads.googleads.v6.enums.types import ( - advertising_channel_type as gage_advertising_channel_type, -) -from google.ads.googleads.v6.enums.types import ( - criterion_category_channel_availability_mode, -) -from google.ads.googleads.v6.enums.types import ( - criterion_category_locale_availability_mode, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "CriterionCategoryAvailability", - "CriterionCategoryChannelAvailability", - "CriterionCategoryLocaleAvailability", - }, -) - - -class CriterionCategoryAvailability(proto.Message): - r"""Information of category availability, per advertising - channel. - - Attributes: - channel (google.ads.googleads.v6.common.types.CriterionCategoryChannelAvailability): - Channel types and subtypes that are available - to the category. - locale (Sequence[google.ads.googleads.v6.common.types.CriterionCategoryLocaleAvailability]): - Locales that are available to the category - for the channel. - """ - - channel = proto.Field( - proto.MESSAGE, number=1, message="CriterionCategoryChannelAvailability", - ) - locale = proto.RepeatedField( - proto.MESSAGE, number=2, message="CriterionCategoryLocaleAvailability", - ) - - -class CriterionCategoryChannelAvailability(proto.Message): - r"""Information of advertising channel type and subtypes a - category is available in. - - Attributes: - availability_mode (google.ads.googleads.v6.enums.types.CriterionCategoryChannelAvailabilityModeEnum.CriterionCategoryChannelAvailabilityMode): - Format of the channel availability. Can be ALL_CHANNELS (the - rest of the fields will not be set), CHANNEL_TYPE (only - advertising_channel_type type will be set, the category is - available to all sub types under it) or - CHANNEL_TYPE_AND_SUBTYPES (advertising_channel_type, - advertising_channel_sub_type, and - include_default_channel_sub_type will all be set). - advertising_channel_type (google.ads.googleads.v6.enums.types.AdvertisingChannelTypeEnum.AdvertisingChannelType): - Channel type the category is available to. - advertising_channel_sub_type (Sequence[google.ads.googleads.v6.enums.types.AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType]): - Channel subtypes under the channel type the - category is available to. - include_default_channel_sub_type (bool): - Whether default channel sub type is included. For example, - advertising_channel_type being DISPLAY and - include_default_channel_sub_type being false means that the - default display campaign where channel sub type is not set - is not included in this availability configuration. - """ - - availability_mode = proto.Field( - proto.ENUM, - number=1, - enum=criterion_category_channel_availability_mode.CriterionCategoryChannelAvailabilityModeEnum.CriterionCategoryChannelAvailabilityMode, - ) - advertising_channel_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_advertising_channel_type.AdvertisingChannelTypeEnum.AdvertisingChannelType, - ) - advertising_channel_sub_type = proto.RepeatedField( - proto.ENUM, - number=3, - enum=gage_advertising_channel_sub_type.AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType, - ) - include_default_channel_sub_type = proto.Field( - proto.BOOL, number=5, optional=True - ) - - -class CriterionCategoryLocaleAvailability(proto.Message): - r"""Information about which locales a category is available in. - - Attributes: - availability_mode (google.ads.googleads.v6.enums.types.CriterionCategoryLocaleAvailabilityModeEnum.CriterionCategoryLocaleAvailabilityMode): - Format of the locale availability. Can be LAUNCHED_TO_ALL - (both country and language will be empty), COUNTRY (only - country will be set), LANGUAGE (only language wil be set), - COUNTRY_AND_LANGUAGE (both country and language will be - set). - country_code (str): - Code of the country. - language_code (str): - Code of the language. - """ - - availability_mode = proto.Field( - proto.ENUM, - number=1, - enum=criterion_category_locale_availability_mode.CriterionCategoryLocaleAvailabilityModeEnum.CriterionCategoryLocaleAvailabilityMode, - ) - country_code = proto.Field(proto.STRING, number=4, optional=True) - language_code = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/custom_parameter.py b/google/ads/googleads/v6/common/types/custom_parameter.py deleted file mode 100644 index a7ea9aefb..000000000 --- a/google/ads/googleads/v6/common/types/custom_parameter.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"CustomParameter",}, -) - - -class CustomParameter(proto.Message): - r"""A mapping that can be used by custom parameter tags in a - ``tracking_url_template``, ``final_urls``, or ``mobile_final_urls``. - - Attributes: - key (str): - The key matching the parameter tag name. - value (str): - The value to be substituted. - """ - - key = proto.Field(proto.STRING, number=3, optional=True) - value = proto.Field(proto.STRING, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/dates.py b/google/ads/googleads/v6/common/types/dates.py deleted file mode 100644 index 135d1d352..000000000 --- a/google/ads/googleads/v6/common/types/dates.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"DateRange",}, -) - - -class DateRange(proto.Message): - r"""A date range. - - Attributes: - start_date (str): - The start date, in yyyy-mm-dd format. This - date is inclusive. - end_date (str): - The end date, in yyyy-mm-dd format. This date - is inclusive. - """ - - start_date = proto.Field(proto.STRING, number=3, optional=True) - end_date = proto.Field(proto.STRING, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/explorer_auto_optimizer_setting.py b/google/ads/googleads/v6/common/types/explorer_auto_optimizer_setting.py deleted file mode 100644 index 7e724fdaf..000000000 --- a/google/ads/googleads/v6/common/types/explorer_auto_optimizer_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"ExplorerAutoOptimizerSetting",}, -) - - -class ExplorerAutoOptimizerSetting(proto.Message): - r"""Settings for the Display Campaign Optimizer, initially named - "Explorer". Learn more about `automatic - targeting `__. - - Attributes: - opt_in (bool): - Indicates whether the optimizer is turned on. - """ - - opt_in = proto.Field(proto.BOOL, number=2, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/extensions.py b/google/ads/googleads/v6/common/types/extensions.py deleted file mode 100644 index 4711c2244..000000000 --- a/google/ads/googleads/v6/common/types/extensions.py +++ /dev/null @@ -1,517 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.common.types import feed_common -from google.ads.googleads.v6.enums.types import app_store as gage_app_store -from google.ads.googleads.v6.enums.types import ( - call_conversion_reporting_state as gage_call_conversion_reporting_state, -) -from google.ads.googleads.v6.enums.types import price_extension_price_qualifier -from google.ads.googleads.v6.enums.types import price_extension_price_unit -from google.ads.googleads.v6.enums.types import price_extension_type -from google.ads.googleads.v6.enums.types import ( - promotion_extension_discount_modifier, -) -from google.ads.googleads.v6.enums.types import promotion_extension_occasion - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "AppFeedItem", - "CallFeedItem", - "CalloutFeedItem", - "LocationFeedItem", - "AffiliateLocationFeedItem", - "TextMessageFeedItem", - "PriceFeedItem", - "PriceOffer", - "PromotionFeedItem", - "StructuredSnippetFeedItem", - "SitelinkFeedItem", - "HotelCalloutFeedItem", - "ImageFeedItem", - }, -) - - -class AppFeedItem(proto.Message): - r"""Represents an App extension. - - Attributes: - link_text (str): - The visible text displayed when the link is - rendered in an ad. This string must not be - empty, and the length of this string should be - between 1 and 25, inclusive. - app_id (str): - The store-specific ID for the target - application. This string must not be empty. - app_store (google.ads.googleads.v6.enums.types.AppStoreEnum.AppStore): - The application store that the target - application belongs to. This field is required. - final_urls (Sequence[str]): - A list of possible final URLs after all cross - domain redirects. This list must not be empty. - final_mobile_urls (Sequence[str]): - A list of possible final mobile URLs after - all cross domain redirects. - tracking_url_template (str): - URL template for constructing a tracking URL. - Default value is "{lpurl}". - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - A list of mappings to be used for substituting URL custom - parameter tags in the tracking_url_template, final_urls, - and/or final_mobile_urls. - final_url_suffix (str): - URL template for appending params to landing - page URLs served with parallel tracking. - """ - - link_text = proto.Field(proto.STRING, number=9, optional=True) - app_id = proto.Field(proto.STRING, number=10, optional=True) - app_store = proto.Field( - proto.ENUM, number=3, enum=gage_app_store.AppStoreEnum.AppStore, - ) - final_urls = proto.RepeatedField(proto.STRING, number=11) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=12) - tracking_url_template = proto.Field(proto.STRING, number=13, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=7, message=custom_parameter.CustomParameter, - ) - final_url_suffix = proto.Field(proto.STRING, number=14, optional=True) - - -class CallFeedItem(proto.Message): - r"""Represents a Call extension. - - Attributes: - phone_number (str): - The advertiser's phone number to append to - the ad. This string must not be empty. - country_code (str): - Uppercase two-letter country code of the - advertiser's phone number. This string must not - be empty. - call_tracking_enabled (bool): - Indicates whether call tracking is enabled. - By default, call tracking is not enabled. - call_conversion_action (str): - The conversion action to attribute a call conversion to. If - not set a default conversion action is used. This field only - has effect if call_tracking_enabled is set to true. - Otherwise this field is ignored. - call_conversion_tracking_disabled (bool): - If true, disable call conversion tracking. - call_conversion_action should not be set if this is true. - Optional. - call_conversion_reporting_state (google.ads.googleads.v6.enums.types.CallConversionReportingStateEnum.CallConversionReportingState): - Enum value that indicates whether this call - extension uses its own call conversion setting - (or just have call conversion disabled), or - following the account level setting. - """ - - phone_number = proto.Field(proto.STRING, number=7, optional=True) - country_code = proto.Field(proto.STRING, number=8, optional=True) - call_tracking_enabled = proto.Field(proto.BOOL, number=9, optional=True) - call_conversion_action = proto.Field(proto.STRING, number=10, optional=True) - call_conversion_tracking_disabled = proto.Field( - proto.BOOL, number=11, optional=True - ) - call_conversion_reporting_state = proto.Field( - proto.ENUM, - number=6, - enum=gage_call_conversion_reporting_state.CallConversionReportingStateEnum.CallConversionReportingState, - ) - - -class CalloutFeedItem(proto.Message): - r"""Represents a callout extension. - - Attributes: - callout_text (str): - The callout text. - The length of this string should be between 1 - and 25, inclusive. - """ - - callout_text = proto.Field(proto.STRING, number=2, optional=True) - - -class LocationFeedItem(proto.Message): - r"""Represents a location extension. - - Attributes: - business_name (str): - The name of the business. - address_line_1 (str): - Line 1 of the business address. - address_line_2 (str): - Line 2 of the business address. - city (str): - City of the business address. - province (str): - Province of the business address. - postal_code (str): - Postal code of the business address. - country_code (str): - Country code of the business address. - phone_number (str): - Phone number of the business. - """ - - business_name = proto.Field(proto.STRING, number=9, optional=True) - address_line_1 = proto.Field(proto.STRING, number=10, optional=True) - address_line_2 = proto.Field(proto.STRING, number=11, optional=True) - city = proto.Field(proto.STRING, number=12, optional=True) - province = proto.Field(proto.STRING, number=13, optional=True) - postal_code = proto.Field(proto.STRING, number=14, optional=True) - country_code = proto.Field(proto.STRING, number=15, optional=True) - phone_number = proto.Field(proto.STRING, number=16, optional=True) - - -class AffiliateLocationFeedItem(proto.Message): - r"""Represents an affiliate location extension. - - Attributes: - business_name (str): - The name of the business. - address_line_1 (str): - Line 1 of the business address. - address_line_2 (str): - Line 2 of the business address. - city (str): - City of the business address. - province (str): - Province of the business address. - postal_code (str): - Postal code of the business address. - country_code (str): - Country code of the business address. - phone_number (str): - Phone number of the business. - chain_id (int): - Id of the retail chain that is advertised as - a seller of your product. - chain_name (str): - Name of chain. - """ - - business_name = proto.Field(proto.STRING, number=11, optional=True) - address_line_1 = proto.Field(proto.STRING, number=12, optional=True) - address_line_2 = proto.Field(proto.STRING, number=13, optional=True) - city = proto.Field(proto.STRING, number=14, optional=True) - province = proto.Field(proto.STRING, number=15, optional=True) - postal_code = proto.Field(proto.STRING, number=16, optional=True) - country_code = proto.Field(proto.STRING, number=17, optional=True) - phone_number = proto.Field(proto.STRING, number=18, optional=True) - chain_id = proto.Field(proto.INT64, number=19, optional=True) - chain_name = proto.Field(proto.STRING, number=20, optional=True) - - -class TextMessageFeedItem(proto.Message): - r"""An extension that users can click on to send a text message - to the advertiser. - - Attributes: - business_name (str): - The business name to prepend to the message - text. This field is required. - country_code (str): - Uppercase two-letter country code of the - advertiser's phone number. This field is - required. - phone_number (str): - The advertiser's phone number the message - will be sent to. Required. - text (str): - The text to show in the ad. - This field is required. - extension_text (str): - The message extension_text populated in the messaging app. - """ - - business_name = proto.Field(proto.STRING, number=6, optional=True) - country_code = proto.Field(proto.STRING, number=7, optional=True) - phone_number = proto.Field(proto.STRING, number=8, optional=True) - text = proto.Field(proto.STRING, number=9, optional=True) - extension_text = proto.Field(proto.STRING, number=10, optional=True) - - -class PriceFeedItem(proto.Message): - r"""Represents a Price extension. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.PriceExtensionTypeEnum.PriceExtensionType): - Price extension type of this extension. - price_qualifier (google.ads.googleads.v6.enums.types.PriceExtensionPriceQualifierEnum.PriceExtensionPriceQualifier): - Price qualifier for all offers of this price - extension. - tracking_url_template (str): - Tracking URL template for all offers of this - price extension. - language_code (str): - The code of the language used for this price - extension. - price_offerings (Sequence[google.ads.googleads.v6.common.types.PriceOffer]): - The price offerings in this price extension. - final_url_suffix (str): - Tracking URL template for all offers of this - price extension. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=price_extension_type.PriceExtensionTypeEnum.PriceExtensionType, - ) - price_qualifier = proto.Field( - proto.ENUM, - number=2, - enum=price_extension_price_qualifier.PriceExtensionPriceQualifierEnum.PriceExtensionPriceQualifier, - ) - tracking_url_template = proto.Field(proto.STRING, number=7, optional=True) - language_code = proto.Field(proto.STRING, number=8, optional=True) - price_offerings = proto.RepeatedField( - proto.MESSAGE, number=5, message="PriceOffer", - ) - final_url_suffix = proto.Field(proto.STRING, number=9, optional=True) - - -class PriceOffer(proto.Message): - r"""Represents one price offer in a price extension. - - Attributes: - header (str): - Header text of this offer. - description (str): - Description text of this offer. - price (google.ads.googleads.v6.common.types.Money): - Price value of this offer. - unit (google.ads.googleads.v6.enums.types.PriceExtensionPriceUnitEnum.PriceExtensionPriceUnit): - Price unit for this offer. - final_urls (Sequence[str]): - A list of possible final URLs after all cross - domain redirects. - final_mobile_urls (Sequence[str]): - A list of possible final mobile URLs after - all cross domain redirects. - """ - - header = proto.Field(proto.STRING, number=7, optional=True) - description = proto.Field(proto.STRING, number=8, optional=True) - price = proto.Field(proto.MESSAGE, number=3, message=feed_common.Money,) - unit = proto.Field( - proto.ENUM, - number=4, - enum=price_extension_price_unit.PriceExtensionPriceUnitEnum.PriceExtensionPriceUnit, - ) - final_urls = proto.RepeatedField(proto.STRING, number=9) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=10) - - -class PromotionFeedItem(proto.Message): - r"""Represents a Promotion extension. - - Attributes: - promotion_target (str): - A freeform description of what the promotion - is targeting. This field is required. - discount_modifier (google.ads.googleads.v6.enums.types.PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier): - Enum that modifies the qualification of the - discount. - promotion_start_date (str): - Start date of when the promotion is eligible - to be redeemed. - promotion_end_date (str): - Last date when the promotion is eligible to - be redeemed. - occasion (google.ads.googleads.v6.enums.types.PromotionExtensionOccasionEnum.PromotionExtensionOccasion): - The occasion the promotion was intended for. - If an occasion is set, the redemption window - will need to fall within the date range - associated with the occasion. - final_urls (Sequence[str]): - A list of possible final URLs after all cross - domain redirects. This field is required. - final_mobile_urls (Sequence[str]): - A list of possible final mobile URLs after - all cross domain redirects. - tracking_url_template (str): - URL template for constructing a tracking URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - A list of mappings to be used for substituting URL custom - parameter tags in the tracking_url_template, final_urls, - and/or final_mobile_urls. - final_url_suffix (str): - URL template for appending params to landing - page URLs served with parallel tracking. - language_code (str): - The language of the promotion. - Represented as BCP 47 language tag. - percent_off (int): - Percentage off discount in the promotion in micros. One - million is equivalent to one percent. Either this or - money_off_amount is required. - money_amount_off (google.ads.googleads.v6.common.types.Money): - Money amount off for discount in the promotion. Either this - or percent_off is required. - promotion_code (str): - A code the user should use in order to be - eligible for the promotion. - orders_over_amount (google.ads.googleads.v6.common.types.Money): - The amount the total order needs to be for - the user to be eligible for the promotion. - """ - - promotion_target = proto.Field(proto.STRING, number=16, optional=True) - discount_modifier = proto.Field( - proto.ENUM, - number=2, - enum=promotion_extension_discount_modifier.PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier, - ) - promotion_start_date = proto.Field(proto.STRING, number=19, optional=True) - promotion_end_date = proto.Field(proto.STRING, number=20, optional=True) - occasion = proto.Field( - proto.ENUM, - number=9, - enum=promotion_extension_occasion.PromotionExtensionOccasionEnum.PromotionExtensionOccasion, - ) - final_urls = proto.RepeatedField(proto.STRING, number=21) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=22) - tracking_url_template = proto.Field(proto.STRING, number=23, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=13, message=custom_parameter.CustomParameter, - ) - final_url_suffix = proto.Field(proto.STRING, number=24, optional=True) - language_code = proto.Field(proto.STRING, number=25, optional=True) - percent_off = proto.Field(proto.INT64, number=17, oneof="discount_type") - money_amount_off = proto.Field( - proto.MESSAGE, - number=4, - oneof="discount_type", - message=feed_common.Money, - ) - promotion_code = proto.Field( - proto.STRING, number=18, oneof="promotion_trigger" - ) - orders_over_amount = proto.Field( - proto.MESSAGE, - number=6, - oneof="promotion_trigger", - message=feed_common.Money, - ) - - -class StructuredSnippetFeedItem(proto.Message): - r"""Represents a structured snippet extension. - - Attributes: - header (str): - The header of the snippet. - This string must not be empty. - values (Sequence[str]): - The values in the snippet. - The maximum size of this collection is 10. - """ - - header = proto.Field(proto.STRING, number=3, optional=True) - values = proto.RepeatedField(proto.STRING, number=4) - - -class SitelinkFeedItem(proto.Message): - r"""Represents a sitelink extension. - - Attributes: - link_text (str): - URL display text for the sitelink. - The length of this string should be between 1 - and 25, inclusive. - line1 (str): - First line of the description for the - sitelink. If this value is set, line2 must also - be set. The length of this string should be - between 0 and 35, inclusive. - line2 (str): - Second line of the description for the - sitelink. If this value is set, line1 must also - be set. The length of this string should be - between 0 and 35, inclusive. - final_urls (Sequence[str]): - A list of possible final URLs after all cross - domain redirects. - final_mobile_urls (Sequence[str]): - A list of possible final mobile URLs after - all cross domain redirects. - tracking_url_template (str): - URL template for constructing a tracking URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - A list of mappings to be used for substituting URL custom - parameter tags in the tracking_url_template, final_urls, - and/or final_mobile_urls. - final_url_suffix (str): - Final URL suffix to be appended to landing - page URLs served with parallel tracking. - """ - - link_text = proto.Field(proto.STRING, number=9, optional=True) - line1 = proto.Field(proto.STRING, number=10, optional=True) - line2 = proto.Field(proto.STRING, number=11, optional=True) - final_urls = proto.RepeatedField(proto.STRING, number=12) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=13) - tracking_url_template = proto.Field(proto.STRING, number=14, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=7, message=custom_parameter.CustomParameter, - ) - final_url_suffix = proto.Field(proto.STRING, number=15, optional=True) - - -class HotelCalloutFeedItem(proto.Message): - r"""Represents a hotel callout extension. - - Attributes: - text (str): - The callout text. - The length of this string should be between 1 - and 25, inclusive. - language_code (str): - The language of the hotel callout text. - IETF BCP 47 compliant language code. - """ - - text = proto.Field(proto.STRING, number=3, optional=True) - language_code = proto.Field(proto.STRING, number=4, optional=True) - - -class ImageFeedItem(proto.Message): - r"""Represents an advertiser provided image extension. - - Attributes: - image_asset (str): - Required. Resource name of the image asset. - """ - - image_asset = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/feed_common.py b/google/ads/googleads/v6/common/types/feed_common.py deleted file mode 100644 index a7771e3f3..000000000 --- a/google/ads/googleads/v6/common/types/feed_common.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"Money",}, -) - - -class Money(proto.Message): - r"""Represents a price in a particular currency. - - Attributes: - currency_code (str): - Three-character ISO 4217 currency code. - amount_micros (int): - Amount in micros. One million is equivalent - to one unit. - """ - - currency_code = proto.Field(proto.STRING, number=3, optional=True) - amount_micros = proto.Field(proto.INT64, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/feed_item_set_filter_type_infos.py b/google/ads/googleads/v6/common/types/feed_item_set_filter_type_infos.py deleted file mode 100644 index c13d0fb9e..000000000 --- a/google/ads/googleads/v6/common/types/feed_item_set_filter_type_infos.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import feed_item_set_string_filter_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "DynamicLocationSetFilter", - "BusinessNameFilter", - "DynamicAffiliateLocationSetFilter", - }, -) - - -class DynamicLocationSetFilter(proto.Message): - r"""Represents a filter on locations in a feed item set. - Only applicable if the parent Feed of the FeedItemSet is a - LOCATION feed. - - Attributes: - labels (Sequence[str]): - If multiple labels are set, then only - feeditems marked with all the labels will be - added to the FeedItemSet. - business_name_filter (google.ads.googleads.v6.common.types.BusinessNameFilter): - Business name filter. - """ - - labels = proto.RepeatedField(proto.STRING, number=1) - business_name_filter = proto.Field( - proto.MESSAGE, number=2, message="BusinessNameFilter", - ) - - -class BusinessNameFilter(proto.Message): - r"""Represents a business name filter on locations in a - FeedItemSet. - - Attributes: - business_name (str): - Business name string to use for filtering. - filter_type (google.ads.googleads.v6.enums.types.FeedItemSetStringFilterTypeEnum.FeedItemSetStringFilterType): - The type of string matching to use when filtering with - business_name. - """ - - business_name = proto.Field(proto.STRING, number=1) - filter_type = proto.Field( - proto.ENUM, - number=2, - enum=feed_item_set_string_filter_type.FeedItemSetStringFilterTypeEnum.FeedItemSetStringFilterType, - ) - - -class DynamicAffiliateLocationSetFilter(proto.Message): - r"""Represents a filter on affiliate locations in a FeedItemSet. Only - applicable if the parent Feed of the FeedItemSet is an - AFFILIATE_LOCATION feed. - - Attributes: - chain_ids (Sequence[int]): - Used to filter affiliate locations by chain - ids. Only affiliate locations that belong to the - specified chain(s) will be added to the - FeedItemSet. - """ - - chain_ids = proto.RepeatedField(proto.INT64, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/final_app_url.py b/google/ads/googleads/v6/common/types/final_app_url.py deleted file mode 100644 index a50eea55c..000000000 --- a/google/ads/googleads/v6/common/types/final_app_url.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import app_url_operating_system_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"FinalAppUrl",}, -) - - -class FinalAppUrl(proto.Message): - r"""A URL for deep linking into an app for the given operating - system. - - Attributes: - os_type (google.ads.googleads.v6.enums.types.AppUrlOperatingSystemTypeEnum.AppUrlOperatingSystemType): - The operating system targeted by this URL. - Required. - url (str): - The app deep link URL. Deep links specify a location in an - app that corresponds to the content you'd like to show, and - should be of the form {scheme}://{host_path} The scheme - identifies which app to open. For your app, you can use a - custom scheme that starts with the app's name. The host and - path specify the unique location in the app where your - content exists. Example: "exampleapp://productid_1234". - Required. - """ - - os_type = proto.Field( - proto.ENUM, - number=1, - enum=app_url_operating_system_type.AppUrlOperatingSystemTypeEnum.AppUrlOperatingSystemType, - ) - url = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/frequency_cap.py b/google/ads/googleads/v6/common/types/frequency_cap.py deleted file mode 100644 index 3622167f3..000000000 --- a/google/ads/googleads/v6/common/types/frequency_cap.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import frequency_cap_event_type -from google.ads.googleads.v6.enums.types import frequency_cap_level -from google.ads.googleads.v6.enums.types import frequency_cap_time_unit - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"FrequencyCapEntry", "FrequencyCapKey",}, -) - - -class FrequencyCapEntry(proto.Message): - r"""A rule specifying the maximum number of times an ad (or some - set of ads) can be shown to a user over a particular time - period. - - Attributes: - key (google.ads.googleads.v6.common.types.FrequencyCapKey): - The key of a particular frequency cap. There - can be no more than one frequency cap with the - same key. - cap (int): - Maximum number of events allowed during the - time range by this cap. - """ - - key = proto.Field(proto.MESSAGE, number=1, message="FrequencyCapKey",) - cap = proto.Field(proto.INT32, number=3, optional=True) - - -class FrequencyCapKey(proto.Message): - r"""A group of fields used as keys for a frequency cap. - There can be no more than one frequency cap with the same key. - - Attributes: - level (google.ads.googleads.v6.enums.types.FrequencyCapLevelEnum.FrequencyCapLevel): - The level on which the cap is to be applied - (e.g. ad group ad, ad group). The cap is applied - to all the entities of this level. - event_type (google.ads.googleads.v6.enums.types.FrequencyCapEventTypeEnum.FrequencyCapEventType): - The type of event that the cap applies to - (e.g. impression). - time_unit (google.ads.googleads.v6.enums.types.FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit): - Unit of time the cap is defined at (e.g. day, - week). - time_length (int): - Number of time units the cap lasts. - """ - - level = proto.Field( - proto.ENUM, - number=1, - enum=frequency_cap_level.FrequencyCapLevelEnum.FrequencyCapLevel, - ) - event_type = proto.Field( - proto.ENUM, - number=3, - enum=frequency_cap_event_type.FrequencyCapEventTypeEnum.FrequencyCapEventType, - ) - time_unit = proto.Field( - proto.ENUM, - number=2, - enum=frequency_cap_time_unit.FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit, - ) - time_length = proto.Field(proto.INT32, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/keyword_plan_common.py b/google/ads/googleads/v6/common/types/keyword_plan_common.py deleted file mode 100644 index a3e1b3929..000000000 --- a/google/ads/googleads/v6/common/types/keyword_plan_common.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import keyword_plan_competition_level -from google.ads.googleads.v6.enums.types import month_of_year - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanHistoricalMetrics", "MonthlySearchVolume",}, -) - - -class KeywordPlanHistoricalMetrics(proto.Message): - r"""Historical metrics specific to the targeting options - selected. Targeting options include geographies, network, etc. - Refer to https://support.google.com/google-ads/answer/3022575 - for more details. - - Attributes: - avg_monthly_searches (int): - Approximate number of monthly searches on - this query averaged for the past 12 months. - monthly_search_volumes (Sequence[google.ads.googleads.v6.common.types.MonthlySearchVolume]): - Approximate number of searches on this query - for the past twelve months. - competition (google.ads.googleads.v6.enums.types.KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel): - The competition level for the query. - competition_index (int): - The competition index for the query in the range [0, 100]. - Shows how competitive ad placement is for a keyword. The - level of competition from 0-100 is determined by the number - of ad slots filled divided by the total number of ad slots - available. If not enough data is available, null is - returned. - low_top_of_page_bid_micros (int): - Top of page bid low range (20th percentile) - in micros for the keyword. - high_top_of_page_bid_micros (int): - Top of page bid high range (80th percentile) - in micros for the keyword. - """ - - avg_monthly_searches = proto.Field(proto.INT64, number=7, optional=True) - monthly_search_volumes = proto.RepeatedField( - proto.MESSAGE, number=6, message="MonthlySearchVolume", - ) - competition = proto.Field( - proto.ENUM, - number=2, - enum=keyword_plan_competition_level.KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel, - ) - competition_index = proto.Field(proto.INT64, number=8, optional=True) - low_top_of_page_bid_micros = proto.Field( - proto.INT64, number=9, optional=True - ) - high_top_of_page_bid_micros = proto.Field( - proto.INT64, number=10, optional=True - ) - - -class MonthlySearchVolume(proto.Message): - r"""Monthly search volume. - - Attributes: - year (int): - The year of the search volume (e.g. 2020). - month (google.ads.googleads.v6.enums.types.MonthOfYearEnum.MonthOfYear): - The month of the search volume. - monthly_searches (int): - Approximate number of searches for the month. - A null value indicates the search volume is - unavailable for that month. - """ - - year = proto.Field(proto.INT64, number=4, optional=True) - month = proto.Field( - proto.ENUM, number=2, enum=month_of_year.MonthOfYearEnum.MonthOfYear, - ) - monthly_searches = proto.Field(proto.INT64, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/matching_function.py b/google/ads/googleads/v6/common/types/matching_function.py deleted file mode 100644 index 0ad16f543..000000000 --- a/google/ads/googleads/v6/common/types/matching_function.py +++ /dev/null @@ -1,201 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import matching_function_context_type -from google.ads.googleads.v6.enums.types import matching_function_operator - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"MatchingFunction", "Operand",}, -) - - -class MatchingFunction(proto.Message): - r"""Matching function associated with a - CustomerFeed, CampaignFeed, or AdGroupFeed. The matching - function is used to filter the set of feed items selected. - - Attributes: - function_string (str): - String representation of the Function. - - Examples: - - 1. IDENTITY(true) or IDENTITY(false). All or no feed items - served. - 2. EQUALS(CONTEXT.DEVICE,"Mobile") - 3. IN(FEED_ITEM_ID,{1000001,1000002,1000003}) - 4. CONTAINS_ANY(FeedAttribute[12345678,0],{"Mars - cruise","Venus cruise"}) - 5. AND(IN(FEED_ITEM_ID,{10001,10002}),EQUALS(CONTEXT.DEVICE,"Mobile")) - - For more details, visit - https://developers.google.com/adwords/api/docs/guides/feed-matching-functions - - Note that because multiple strings may represent the same - underlying function (whitespace and single versus double - quotation marks, for example), the value returned may not be - identical to the string sent in a mutate request. - operator (google.ads.googleads.v6.enums.types.MatchingFunctionOperatorEnum.MatchingFunctionOperator): - Operator for a function. - left_operands (Sequence[google.ads.googleads.v6.common.types.Operand]): - The operands on the left hand side of the - equation. This is also the operand to be used - for single operand expressions such as NOT. - right_operands (Sequence[google.ads.googleads.v6.common.types.Operand]): - The operands on the right hand side of the - equation. - """ - - function_string = proto.Field(proto.STRING, number=5, optional=True) - operator = proto.Field( - proto.ENUM, - number=4, - enum=matching_function_operator.MatchingFunctionOperatorEnum.MatchingFunctionOperator, - ) - left_operands = proto.RepeatedField( - proto.MESSAGE, number=2, message="Operand", - ) - right_operands = proto.RepeatedField( - proto.MESSAGE, number=3, message="Operand", - ) - - -class Operand(proto.Message): - r"""An operand in a matching function. - - Attributes: - constant_operand (google.ads.googleads.v6.common.types.Operand.ConstantOperand): - A constant operand in a matching function. - feed_attribute_operand (google.ads.googleads.v6.common.types.Operand.FeedAttributeOperand): - This operand specifies a feed attribute in - feed. - function_operand (google.ads.googleads.v6.common.types.Operand.FunctionOperand): - A function operand in a matching function. - Used to represent nested functions. - request_context_operand (google.ads.googleads.v6.common.types.Operand.RequestContextOperand): - An operand in a function referring to a value - in the request context. - """ - - class ConstantOperand(proto.Message): - r"""A constant operand in a matching function. - - Attributes: - string_value (str): - String value of the operand if it is a string - type. - long_value (int): - Int64 value of the operand if it is a int64 - type. - boolean_value (bool): - Boolean value of the operand if it is a - boolean type. - double_value (float): - Double value of the operand if it is a double - type. - """ - - string_value = proto.Field( - proto.STRING, number=5, oneof="constant_operand_value" - ) - long_value = proto.Field( - proto.INT64, number=6, oneof="constant_operand_value" - ) - boolean_value = proto.Field( - proto.BOOL, number=7, oneof="constant_operand_value" - ) - double_value = proto.Field( - proto.DOUBLE, number=8, oneof="constant_operand_value" - ) - - class FeedAttributeOperand(proto.Message): - r"""A feed attribute operand in a matching function. - Used to represent a feed attribute in feed. - - Attributes: - feed_id (int): - The associated feed. Required. - feed_attribute_id (int): - Id of the referenced feed attribute. - Required. - """ - - feed_id = proto.Field(proto.INT64, number=3, optional=True) - feed_attribute_id = proto.Field(proto.INT64, number=4, optional=True) - - class FunctionOperand(proto.Message): - r"""A function operand in a matching function. - Used to represent nested functions. - - Attributes: - matching_function (google.ads.googleads.v6.common.types.MatchingFunction): - The matching function held in this operand. - """ - - matching_function = proto.Field( - proto.MESSAGE, number=1, message="MatchingFunction", - ) - - class RequestContextOperand(proto.Message): - r"""An operand in a function referring to a value in the request - context. - - Attributes: - context_type (google.ads.googleads.v6.enums.types.MatchingFunctionContextTypeEnum.MatchingFunctionContextType): - Type of value to be referred in the request - context. - """ - - context_type = proto.Field( - proto.ENUM, - number=1, - enum=matching_function_context_type.MatchingFunctionContextTypeEnum.MatchingFunctionContextType, - ) - - constant_operand = proto.Field( - proto.MESSAGE, - number=1, - oneof="function_argument_operand", - message=ConstantOperand, - ) - feed_attribute_operand = proto.Field( - proto.MESSAGE, - number=2, - oneof="function_argument_operand", - message=FeedAttributeOperand, - ) - function_operand = proto.Field( - proto.MESSAGE, - number=3, - oneof="function_argument_operand", - message=FunctionOperand, - ) - request_context_operand = proto.Field( - proto.MESSAGE, - number=4, - oneof="function_argument_operand", - message=RequestContextOperand, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/metrics.py b/google/ads/googleads/v6/common/types/metrics.py deleted file mode 100644 index 17bb1b1d8..000000000 --- a/google/ads/googleads/v6/common/types/metrics.py +++ /dev/null @@ -1,876 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import interaction_event_type -from google.ads.googleads.v6.enums.types import quality_score_bucket - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"Metrics",}, -) - - -class Metrics(proto.Message): - r"""Metrics data. - - Attributes: - absolute_top_impression_percentage (float): - The percent of your ad impressions that are - shown as the very first ad above the organic - search results. - active_view_cpm (float): - Average cost of viewable impressions - (``active_view_impressions``). - active_view_ctr (float): - Active view measurable clicks divided by - active view viewable impressions. This metric is - reported only for display network. - active_view_impressions (int): - A measurement of how often your ad has become - viewable on a Display Network site. - active_view_measurability (float): - The ratio of impressions that could be - measured by Active View over the number of - served impressions. - active_view_measurable_cost_micros (int): - The cost of the impressions you received that - were measurable by Active View. - active_view_measurable_impressions (int): - The number of times your ads are appearing on - placements in positions where they can be seen. - active_view_viewability (float): - The percentage of time when your ad appeared - on an Active View enabled site (measurable - impressions) and was viewable (viewable - impressions). - all_conversions_from_interactions_rate (float): - All conversions from interactions (as oppose - to view through conversions) divided by the - number of ad interactions. - all_conversions_value (float): - The value of all conversions. - all_conversions_value_by_conversion_date (float): - The value of all conversions. When this column is selected - with date, the values in date column means the conversion - date. Details for the by_conversion_date columns are - available at - https://support.google.com/google-ads/answer/9549009. - all_conversions (float): - The total number of conversions. This includes all - conversions regardless of the value of - include_in_conversions_metric. - all_conversions_by_conversion_date (float): - The total number of conversions. This includes all - conversions regardless of the value of - include_in_conversions_metric. When this column is selected - with date, the values in date column means the conversion - date. Details for the by_conversion_date columns are - available at - https://support.google.com/google-ads/answer/9549009. - all_conversions_value_per_cost (float): - The value of all conversions divided by the - total cost of ad interactions (such as clicks - for text ads or views for video ads). - all_conversions_from_click_to_call (float): - The number of times people clicked the "Call" - button to call a store during or after clicking - an ad. This number doesn't include whether or - not calls were connected, or the duration of any - calls. This metric applies to feed items only. - all_conversions_from_directions (float): - The number of times people clicked a "Get - directions" button to navigate to a store after - clicking an ad. This metric applies to feed - items only. - all_conversions_from_interactions_value_per_interaction (float): - The value of all conversions from - interactions divided by the total number of - interactions. - all_conversions_from_menu (float): - The number of times people clicked a link to - view a store's menu after clicking an ad. - This metric applies to feed items only. - all_conversions_from_order (float): - The number of times people placed an order at - a store after clicking an ad. This metric - applies to feed items only. - all_conversions_from_other_engagement (float): - The number of other conversions (for example, - posting a review or saving a location for a - store) that occurred after people clicked an ad. - This metric applies to feed items only. - all_conversions_from_store_visit (float): - Estimated number of times people visited a - store after clicking an ad. This metric applies - to feed items only. - all_conversions_from_store_website (float): - The number of times that people were taken to - a store's URL after clicking an ad. - This metric applies to feed items only. - average_cost (float): - The average amount you pay per interaction. - This amount is the total cost of your ads - divided by the total number of interactions. - average_cpc (float): - The total cost of all clicks divided by the - total number of clicks received. - average_cpe (float): - The average amount that you've been charged - for an ad engagement. This amount is the total - cost of all ad engagements divided by the total - number of ad engagements. - average_cpm (float): - Average cost-per-thousand impressions (CPM). - average_cpv (float): - The average amount you pay each time someone - views your ad. The average CPV is defined by the - total cost of all ad views divided by the number - of views. - average_page_views (float): - Average number of pages viewed per session. - average_time_on_site (float): - Total duration of all sessions (in seconds) / - number of sessions. Imported from Google - Analytics. - benchmark_average_max_cpc (float): - An indication of how other advertisers are - bidding on similar products. - benchmark_ctr (float): - An indication on how other advertisers' - Shopping ads for similar products are performing - based on how often people who see their ad click - on it. - bounce_rate (float): - Percentage of clicks where the user only - visited a single page on your site. Imported - from Google Analytics. - clicks (int): - The number of clicks. - combined_clicks (int): - The number of times your ad or your site's - listing in the unpaid results was clicked. See - the help page at - https://support.google.com/google- - ads/answer/3097241 for details. - combined_clicks_per_query (float): - The number of times your ad or your site's listing in the - unpaid results was clicked (combined_clicks) divided by - combined_queries. See the help page at - https://support.google.com/google-ads/answer/3097241 for - details. - combined_queries (int): - The number of searches that returned pages - from your site in the unpaid results or showed - one of your text ads. See the help page at - https://support.google.com/google- - ads/answer/3097241 for details. - content_budget_lost_impression_share (float): - The estimated percent of times that your ad - was eligible to show on the Display Network but - didn't because your budget was too low. Note: - Content budget lost impression share is reported - in the range of 0 to 0.9. Any value above 0.9 is - reported as 0.9001. - content_impression_share (float): - The impressions you've received on the - Display Network divided by the estimated number - of impressions you were eligible to receive. - Note: Content impression share is reported in - the range of 0.1 to 1. Any value below 0.1 is - reported as 0.0999. - conversion_last_received_request_date_time (str): - The last date/time a conversion tag for this - conversion action successfully fired and was - seen by Google Ads. This firing event may not - have been the result of an attributable - conversion (e.g. because the tag was fired from - a browser that did not previously click an ad - from an appropriate advertiser). The date/time - is in the customer's time zone. - conversion_last_conversion_date (str): - The date of the most recent conversion for - this conversion action. The date is in the - customer's time zone. - content_rank_lost_impression_share (float): - The estimated percentage of impressions on - the Display Network that your ads didn't receive - due to poor Ad Rank. Note: Content rank lost - impression share is reported in the range of 0 - to 0.9. Any value above 0.9 is reported as - 0.9001. - conversions_from_interactions_rate (float): - Conversions from interactions divided by the number of ad - interactions (such as clicks for text ads or views for video - ads). This only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - conversions_value (float): - The value of conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - conversions_value_by_conversion_date (float): - The value of conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. When this - column is selected with date, the values in date column - means the conversion date. Details for the - by_conversion_date columns are available at - https://support.google.com/google-ads/answer/9549009. - conversions_value_per_cost (float): - The value of conversions divided by the cost of ad - interactions. This only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - conversions_from_interactions_value_per_interaction (float): - The value of conversions from interactions divided by the - number of ad interactions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - conversions (float): - The number of conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - conversions_by_conversion_date (float): - The number of conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. When this - column is selected with date, the values in date column - means the conversion date. Details for the - by_conversion_date columns are available at - https://support.google.com/google-ads/answer/9549009. - cost_micros (int): - The sum of your cost-per-click (CPC) and - cost-per-thousand impressions (CPM) costs during - this period. - cost_per_all_conversions (float): - The cost of ad interactions divided by all - conversions. - cost_per_conversion (float): - The cost of ad interactions divided by conversions. This - only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - cost_per_current_model_attributed_conversion (float): - The cost of ad interactions divided by current model - attributed conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - cross_device_conversions (float): - Conversions from when a customer clicks on a Google Ads ad - on one device, then converts on a different device or - browser. Cross-device conversions are already included in - all_conversions. - ctr (float): - The number of clicks your ad receives - (Clicks) divided by the number of times your ad - is shown (Impressions). - current_model_attributed_conversions (float): - Shows how your historic conversions data would look under - the attribution model you've currently selected. This only - includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - current_model_attributed_conversions_from_interactions_rate (float): - Current model attributed conversions from interactions - divided by the number of ad interactions (such as clicks for - text ads or views for video ads). This only includes - conversion actions which include_in_conversions_metric - attribute is set to true. If you use conversion-based - bidding, your bid strategies will optimize for these - conversions. - current_model_attributed_conversions_from_interactions_value_per_interaction (float): - The value of current model attributed conversions from - interactions divided by the number of ad interactions. This - only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - current_model_attributed_conversions_value (float): - The value of current model attributed conversions. This only - includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - current_model_attributed_conversions_value_per_cost (float): - The value of current model attributed conversions divided by - the cost of ad interactions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - engagement_rate (float): - How often people engage with your ad after - it's shown to them. This is the number of ad - expansions divided by the number of times your - ad is shown. - engagements (int): - The number of engagements. - An engagement occurs when a viewer expands your - Lightbox ad. Also, in the future, other ad types - may support engagement metrics. - hotel_average_lead_value_micros (float): - Average lead value based on clicks. - hotel_price_difference_percentage (float): - The average price difference between the - price offered by reporting hotel advertiser and - the cheapest price offered by the competing - advertiser. - hotel_eligible_impressions (int): - The number of impressions that hotel partners - could have had given their feed performance. - historical_creative_quality_score (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - The creative historical quality score. - historical_landing_page_quality_score (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - The quality of historical landing page - experience. - historical_quality_score (int): - The historical quality score. - historical_search_predicted_ctr (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - The historical search predicted click through - rate (CTR). - gmail_forwards (int): - The number of times the ad was forwarded to - someone else as a message. - gmail_saves (int): - The number of times someone has saved your - Gmail ad to their inbox as a message. - gmail_secondary_clicks (int): - The number of clicks to the landing page on - the expanded state of Gmail ads. - impressions_from_store_reach (int): - The number of times a store's location-based - ad was shown. This metric applies to feed items - only. - impressions (int): - Count of how often your ad has appeared on a - search results page or website on the Google - Network. - interaction_rate (float): - How often people interact with your ad after - it is shown to them. This is the number of - interactions divided by the number of times your - ad is shown. - interactions (int): - The number of interactions. - An interaction is the main user action - associated with an ad format-clicks for text and - shopping ads, views for video ads, and so on. - interaction_event_types (Sequence[google.ads.googleads.v6.enums.types.InteractionEventTypeEnum.InteractionEventType]): - The types of payable and free interactions. - invalid_click_rate (float): - The percentage of clicks filtered out of your - total number of clicks (filtered + non-filtered - clicks) during the reporting period. - invalid_clicks (int): - Number of clicks Google considers - illegitimate and doesn't charge you for. - message_chats (int): - Number of message chats initiated for Click - To Message impressions that were message - tracking eligible. - message_impressions (int): - Number of Click To Message impressions that - were message tracking eligible. - message_chat_rate (float): - Number of message chats initiated (message_chats) divided by - the number of message impressions (message_impressions). - Rate at which a user initiates a message chat from an ad - impression with a messaging option and message tracking - enabled. Note that this rate can be more than 1.0 for a - given message impression. - mobile_friendly_clicks_percentage (float): - The percentage of mobile clicks that go to a - mobile-friendly page. - organic_clicks (int): - The number of times someone clicked your - site's listing in the unpaid results for a - particular query. See the help page at - https://support.google.com/google- - ads/answer/3097241 for details. - organic_clicks_per_query (float): - The number of times someone clicked your site's listing in - the unpaid results (organic_clicks) divided by the total - number of searches that returned pages from your site - (organic_queries). See the help page at - https://support.google.com/google-ads/answer/3097241 for - details. - organic_impressions (int): - The number of listings for your site in the - unpaid search results. See the help page at - https://support.google.com/google- - ads/answer/3097241 for details. - organic_impressions_per_query (float): - The number of times a page from your site was listed in the - unpaid search results (organic_impressions) divided by the - number of searches returning your site's listing in the - unpaid results (organic_queries). See the help page at - https://support.google.com/google-ads/answer/3097241 for - details. - organic_queries (int): - The total number of searches that returned - your site's listing in the unpaid results. See - the help page at - https://support.google.com/google- - ads/answer/3097241 for details. - percent_new_visitors (float): - Percentage of first-time sessions (from - people who had never visited your site before). - Imported from Google Analytics. - phone_calls (int): - Number of offline phone calls. - phone_impressions (int): - Number of offline phone impressions. - phone_through_rate (float): - Number of phone calls received (phone_calls) divided by the - number of times your phone number is shown - (phone_impressions). - relative_ctr (float): - Your clickthrough rate (Ctr) divided by the - average clickthrough rate of all advertisers on - the websites that show your ads. Measures how - your ads perform on Display Network sites - compared to other ads on the same sites. - search_absolute_top_impression_share (float): - The percentage of the customer's Shopping or - Search ad impressions that are shown in the most - prominent Shopping position. See - https://support.google.com/google- - ads/answer/7501826 for details. Any value below - 0.1 is reported as 0.0999. - search_budget_lost_absolute_top_impression_share (float): - The number estimating how often your ad - wasn't the very first ad above the organic - search results due to a low budget. Note: Search - budget lost absolute top impression share is - reported in the range of 0 to 0.9. Any value - above 0.9 is reported as 0.9001. - search_budget_lost_impression_share (float): - The estimated percent of times that your ad - was eligible to show on the Search Network but - didn't because your budget was too low. Note: - Search budget lost impression share is reported - in the range of 0 to 0.9. Any value above 0.9 is - reported as 0.9001. - search_budget_lost_top_impression_share (float): - The number estimating how often your ad - didn't show anywhere above the organic search - results due to a low budget. Note: Search budget - lost top impression share is reported in the - range of 0 to 0.9. Any value above 0.9 is - reported as 0.9001. - search_click_share (float): - The number of clicks you've received on the - Search Network divided by the estimated number - of clicks you were eligible to receive. Note: - Search click share is reported in the range of - 0.1 to 1. Any value below 0.1 is reported as - 0.0999. - search_exact_match_impression_share (float): - The impressions you've received divided by - the estimated number of impressions you were - eligible to receive on the Search Network for - search terms that matched your keywords exactly - (or were close variants of your keyword), - regardless of your keyword match types. Note: - Search exact match impression share is reported - in the range of 0.1 to 1. Any value below 0.1 is - reported as 0.0999. - search_impression_share (float): - The impressions you've received on the Search - Network divided by the estimated number of - impressions you were eligible to receive. Note: - Search impression share is reported in the range - of 0.1 to 1. Any value below 0.1 is reported as - 0.0999. - search_rank_lost_absolute_top_impression_share (float): - The number estimating how often your ad - wasn't the very first ad above the organic - search results due to poor Ad Rank. Note: Search - rank lost absolute top impression share is - reported in the range of 0 to 0.9. Any value - above 0.9 is reported as 0.9001. - search_rank_lost_impression_share (float): - The estimated percentage of impressions on - the Search Network that your ads didn't receive - due to poor Ad Rank. Note: Search rank lost - impression share is reported in the range of 0 - to 0.9. Any value above 0.9 is reported as - 0.9001. - search_rank_lost_top_impression_share (float): - The number estimating how often your ad - didn't show anywhere above the organic search - results due to poor Ad Rank. Note: Search rank - lost top impression share is reported in the - range of 0 to 0.9. Any value above 0.9 is - reported as 0.9001. - search_top_impression_share (float): - The impressions you've received in the top - location (anywhere above the organic search - results) compared to the estimated number of - impressions you were eligible to receive in the - top location. Note: Search top impression share - is reported in the range of 0.1 to 1. Any value - below 0.1 is reported as 0.0999. - speed_score (int): - A measure of how quickly your page loads - after clicks on your mobile ads. The score is a - range from 1 to 10, 10 being the fastest. - top_impression_percentage (float): - The percent of your ad impressions that are - shown anywhere above the organic search results. - valid_accelerated_mobile_pages_clicks_percentage (float): - The percentage of ad clicks to Accelerated - Mobile Pages (AMP) landing pages that reach a - valid AMP page. - value_per_all_conversions (float): - The value of all conversions divided by the - number of all conversions. - value_per_all_conversions_by_conversion_date (float): - The value of all conversions divided by the number of all - conversions. When this column is selected with date, the - values in date column means the conversion date. Details for - the by_conversion_date columns are available at - https://support.google.com/google-ads/answer/9549009. - value_per_conversion (float): - The value of conversions divided by the number of - conversions. This only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. - value_per_conversions_by_conversion_date (float): - The value of conversions divided by the number of - conversions. This only includes conversion actions which - include_in_conversions_metric attribute is set to true. If - you use conversion-based bidding, your bid strategies will - optimize for these conversions. When this column is selected - with date, the values in date column means the conversion - date. Details for the by_conversion_date columns are - available at - https://support.google.com/google-ads/answer/9549009. - value_per_current_model_attributed_conversion (float): - The value of current model attributed conversions divided by - the number of the conversions. This only includes conversion - actions which include_in_conversions_metric attribute is set - to true. If you use conversion-based bidding, your bid - strategies will optimize for these conversions. - video_quartile_p100_rate (float): - Percentage of impressions where the viewer - watched all of your video. - video_quartile_p25_rate (float): - Percentage of impressions where the viewer - watched 25% of your video. - video_quartile_p50_rate (float): - Percentage of impressions where the viewer - watched 50% of your video. - video_quartile_p75_rate (float): - Percentage of impressions where the viewer - watched 75% of your video. - video_view_rate (float): - The number of views your TrueView video ad - receives divided by its number of impressions, - including thumbnail impressions for TrueView in- - display ads. - video_views (int): - The number of times your video ads were - viewed. - view_through_conversions (int): - The total number of view-through conversions. - These happen when a customer sees an image or - rich media ad, then later completes a conversion - on your site without interacting with (e.g., - clicking on) another ad. - """ - - absolute_top_impression_percentage = proto.Field( - proto.DOUBLE, number=183, optional=True - ) - active_view_cpm = proto.Field(proto.DOUBLE, number=184, optional=True) - active_view_ctr = proto.Field(proto.DOUBLE, number=185, optional=True) - active_view_impressions = proto.Field( - proto.INT64, number=186, optional=True - ) - active_view_measurability = proto.Field( - proto.DOUBLE, number=187, optional=True - ) - active_view_measurable_cost_micros = proto.Field( - proto.INT64, number=188, optional=True - ) - active_view_measurable_impressions = proto.Field( - proto.INT64, number=189, optional=True - ) - active_view_viewability = proto.Field( - proto.DOUBLE, number=190, optional=True - ) - all_conversions_from_interactions_rate = proto.Field( - proto.DOUBLE, number=191, optional=True - ) - all_conversions_value = proto.Field(proto.DOUBLE, number=192, optional=True) - all_conversions_value_by_conversion_date = proto.Field( - proto.DOUBLE, number=240 - ) - all_conversions = proto.Field(proto.DOUBLE, number=193, optional=True) - all_conversions_by_conversion_date = proto.Field(proto.DOUBLE, number=241) - all_conversions_value_per_cost = proto.Field( - proto.DOUBLE, number=194, optional=True - ) - all_conversions_from_click_to_call = proto.Field( - proto.DOUBLE, number=195, optional=True - ) - all_conversions_from_directions = proto.Field( - proto.DOUBLE, number=196, optional=True - ) - all_conversions_from_interactions_value_per_interaction = proto.Field( - proto.DOUBLE, number=197, optional=True - ) - all_conversions_from_menu = proto.Field( - proto.DOUBLE, number=198, optional=True - ) - all_conversions_from_order = proto.Field( - proto.DOUBLE, number=199, optional=True - ) - all_conversions_from_other_engagement = proto.Field( - proto.DOUBLE, number=200, optional=True - ) - all_conversions_from_store_visit = proto.Field( - proto.DOUBLE, number=201, optional=True - ) - all_conversions_from_store_website = proto.Field( - proto.DOUBLE, number=202, optional=True - ) - average_cost = proto.Field(proto.DOUBLE, number=203, optional=True) - average_cpc = proto.Field(proto.DOUBLE, number=204, optional=True) - average_cpe = proto.Field(proto.DOUBLE, number=205, optional=True) - average_cpm = proto.Field(proto.DOUBLE, number=206, optional=True) - average_cpv = proto.Field(proto.DOUBLE, number=207, optional=True) - average_page_views = proto.Field(proto.DOUBLE, number=208, optional=True) - average_time_on_site = proto.Field(proto.DOUBLE, number=209, optional=True) - benchmark_average_max_cpc = proto.Field( - proto.DOUBLE, number=210, optional=True - ) - benchmark_ctr = proto.Field(proto.DOUBLE, number=211, optional=True) - bounce_rate = proto.Field(proto.DOUBLE, number=212, optional=True) - clicks = proto.Field(proto.INT64, number=131, optional=True) - combined_clicks = proto.Field(proto.INT64, number=156, optional=True) - combined_clicks_per_query = proto.Field( - proto.DOUBLE, number=157, optional=True - ) - combined_queries = proto.Field(proto.INT64, number=158, optional=True) - content_budget_lost_impression_share = proto.Field( - proto.DOUBLE, number=159, optional=True - ) - content_impression_share = proto.Field( - proto.DOUBLE, number=160, optional=True - ) - conversion_last_received_request_date_time = proto.Field( - proto.STRING, number=161, optional=True - ) - conversion_last_conversion_date = proto.Field( - proto.STRING, number=162, optional=True - ) - content_rank_lost_impression_share = proto.Field( - proto.DOUBLE, number=163, optional=True - ) - conversions_from_interactions_rate = proto.Field( - proto.DOUBLE, number=164, optional=True - ) - conversions_value = proto.Field(proto.DOUBLE, number=165, optional=True) - conversions_value_by_conversion_date = proto.Field(proto.DOUBLE, number=242) - conversions_value_per_cost = proto.Field( - proto.DOUBLE, number=166, optional=True - ) - conversions_from_interactions_value_per_interaction = proto.Field( - proto.DOUBLE, number=167, optional=True - ) - conversions = proto.Field(proto.DOUBLE, number=168, optional=True) - conversions_by_conversion_date = proto.Field(proto.DOUBLE, number=243) - cost_micros = proto.Field(proto.INT64, number=169, optional=True) - cost_per_all_conversions = proto.Field( - proto.DOUBLE, number=170, optional=True - ) - cost_per_conversion = proto.Field(proto.DOUBLE, number=171, optional=True) - cost_per_current_model_attributed_conversion = proto.Field( - proto.DOUBLE, number=172, optional=True - ) - cross_device_conversions = proto.Field( - proto.DOUBLE, number=173, optional=True - ) - ctr = proto.Field(proto.DOUBLE, number=174, optional=True) - current_model_attributed_conversions = proto.Field( - proto.DOUBLE, number=175, optional=True - ) - current_model_attributed_conversions_from_interactions_rate = proto.Field( - proto.DOUBLE, number=176, optional=True - ) - current_model_attributed_conversions_from_interactions_value_per_interaction = proto.Field( - proto.DOUBLE, number=177, optional=True - ) - current_model_attributed_conversions_value = proto.Field( - proto.DOUBLE, number=178, optional=True - ) - current_model_attributed_conversions_value_per_cost = proto.Field( - proto.DOUBLE, number=179, optional=True - ) - engagement_rate = proto.Field(proto.DOUBLE, number=180, optional=True) - engagements = proto.Field(proto.INT64, number=181, optional=True) - hotel_average_lead_value_micros = proto.Field( - proto.DOUBLE, number=213, optional=True - ) - hotel_price_difference_percentage = proto.Field( - proto.DOUBLE, number=214, optional=True - ) - hotel_eligible_impressions = proto.Field( - proto.INT64, number=215, optional=True - ) - historical_creative_quality_score = proto.Field( - proto.ENUM, - number=80, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - historical_landing_page_quality_score = proto.Field( - proto.ENUM, - number=81, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - historical_quality_score = proto.Field( - proto.INT64, number=216, optional=True - ) - historical_search_predicted_ctr = proto.Field( - proto.ENUM, - number=83, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - gmail_forwards = proto.Field(proto.INT64, number=217, optional=True) - gmail_saves = proto.Field(proto.INT64, number=218, optional=True) - gmail_secondary_clicks = proto.Field(proto.INT64, number=219, optional=True) - impressions_from_store_reach = proto.Field( - proto.INT64, number=220, optional=True - ) - impressions = proto.Field(proto.INT64, number=221, optional=True) - interaction_rate = proto.Field(proto.DOUBLE, number=222, optional=True) - interactions = proto.Field(proto.INT64, number=223, optional=True) - interaction_event_types = proto.RepeatedField( - proto.ENUM, - number=100, - enum=interaction_event_type.InteractionEventTypeEnum.InteractionEventType, - ) - invalid_click_rate = proto.Field(proto.DOUBLE, number=224, optional=True) - invalid_clicks = proto.Field(proto.INT64, number=225, optional=True) - message_chats = proto.Field(proto.INT64, number=226, optional=True) - message_impressions = proto.Field(proto.INT64, number=227, optional=True) - message_chat_rate = proto.Field(proto.DOUBLE, number=228, optional=True) - mobile_friendly_clicks_percentage = proto.Field( - proto.DOUBLE, number=229, optional=True - ) - organic_clicks = proto.Field(proto.INT64, number=230, optional=True) - organic_clicks_per_query = proto.Field( - proto.DOUBLE, number=231, optional=True - ) - organic_impressions = proto.Field(proto.INT64, number=232, optional=True) - organic_impressions_per_query = proto.Field( - proto.DOUBLE, number=233, optional=True - ) - organic_queries = proto.Field(proto.INT64, number=234, optional=True) - percent_new_visitors = proto.Field(proto.DOUBLE, number=235, optional=True) - phone_calls = proto.Field(proto.INT64, number=236, optional=True) - phone_impressions = proto.Field(proto.INT64, number=237, optional=True) - phone_through_rate = proto.Field(proto.DOUBLE, number=238, optional=True) - relative_ctr = proto.Field(proto.DOUBLE, number=239, optional=True) - search_absolute_top_impression_share = proto.Field( - proto.DOUBLE, number=136, optional=True - ) - search_budget_lost_absolute_top_impression_share = proto.Field( - proto.DOUBLE, number=137, optional=True - ) - search_budget_lost_impression_share = proto.Field( - proto.DOUBLE, number=138, optional=True - ) - search_budget_lost_top_impression_share = proto.Field( - proto.DOUBLE, number=139, optional=True - ) - search_click_share = proto.Field(proto.DOUBLE, number=140, optional=True) - search_exact_match_impression_share = proto.Field( - proto.DOUBLE, number=141, optional=True - ) - search_impression_share = proto.Field( - proto.DOUBLE, number=142, optional=True - ) - search_rank_lost_absolute_top_impression_share = proto.Field( - proto.DOUBLE, number=143, optional=True - ) - search_rank_lost_impression_share = proto.Field( - proto.DOUBLE, number=144, optional=True - ) - search_rank_lost_top_impression_share = proto.Field( - proto.DOUBLE, number=145, optional=True - ) - search_top_impression_share = proto.Field( - proto.DOUBLE, number=146, optional=True - ) - speed_score = proto.Field(proto.INT64, number=147, optional=True) - top_impression_percentage = proto.Field( - proto.DOUBLE, number=148, optional=True - ) - valid_accelerated_mobile_pages_clicks_percentage = proto.Field( - proto.DOUBLE, number=149, optional=True - ) - value_per_all_conversions = proto.Field( - proto.DOUBLE, number=150, optional=True - ) - value_per_all_conversions_by_conversion_date = proto.Field( - proto.DOUBLE, number=244, optional=True - ) - value_per_conversion = proto.Field(proto.DOUBLE, number=151, optional=True) - value_per_conversions_by_conversion_date = proto.Field( - proto.DOUBLE, number=245, optional=True - ) - value_per_current_model_attributed_conversion = proto.Field( - proto.DOUBLE, number=152, optional=True - ) - video_quartile_p100_rate = proto.Field( - proto.DOUBLE, number=132, optional=True - ) - video_quartile_p25_rate = proto.Field( - proto.DOUBLE, number=133, optional=True - ) - video_quartile_p50_rate = proto.Field( - proto.DOUBLE, number=134, optional=True - ) - video_quartile_p75_rate = proto.Field( - proto.DOUBLE, number=135, optional=True - ) - video_view_rate = proto.Field(proto.DOUBLE, number=153, optional=True) - video_views = proto.Field(proto.INT64, number=154, optional=True) - view_through_conversions = proto.Field( - proto.INT64, number=155, optional=True - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/offline_user_data.py b/google/ads/googleads/v6/common/types/offline_user_data.py deleted file mode 100644 index 6a981b026..000000000 --- a/google/ads/googleads/v6/common/types/offline_user_data.py +++ /dev/null @@ -1,327 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - user_identifier_source as gage_user_identifier_source, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "OfflineUserAddressInfo", - "UserIdentifier", - "TransactionAttribute", - "StoreAttribute", - "UserData", - "UserAttribute", - "CustomerMatchUserListMetadata", - "StoreSalesMetadata", - "StoreSalesThirdPartyMetadata", - }, -) - - -class OfflineUserAddressInfo(proto.Message): - r"""Address identifier of offline data. - - Attributes: - hashed_first_name (str): - First name of the user, which is hashed as - SHA-256 after normalized (Lowercase all - characters; Remove any extra spaces before, - after, and in between). - hashed_last_name (str): - Last name of the user, which is hashed as - SHA-256 after normalized (lower case only and no - punctuation). - city (str): - City of the address. Only accepted for Store - Sales Direct data. - state (str): - State code of the address. Only accepted for - Store Sales Direct data. - country_code (str): - 2-letter country code in ISO-3166-1 alpha-2 - of the user's address. - postal_code (str): - Postal code of the user's address. - """ - - hashed_first_name = proto.Field(proto.STRING, number=7, optional=True) - hashed_last_name = proto.Field(proto.STRING, number=8, optional=True) - city = proto.Field(proto.STRING, number=9, optional=True) - state = proto.Field(proto.STRING, number=10, optional=True) - country_code = proto.Field(proto.STRING, number=11, optional=True) - postal_code = proto.Field(proto.STRING, number=12, optional=True) - - -class UserIdentifier(proto.Message): - r"""Hashed user identifying information. - - Attributes: - user_identifier_source (google.ads.googleads.v6.enums.types.UserIdentifierSourceEnum.UserIdentifierSource): - Source of the user identifier when the upload - is from Store Sales third party partners. - hashed_email (str): - Hashed email address using SHA-256 hash - function after normalization. - hashed_phone_number (str): - Hashed phone number using SHA-256 hash - function after normalization (E164 standard). - mobile_id (str): - Mobile device ID (advertising ID/IDFA). - third_party_user_id (str): - Advertiser-assigned user ID for Customer - Match upload, or third-party-assigned user ID - for SSD. - address_info (google.ads.googleads.v6.common.types.OfflineUserAddressInfo): - Address information. - """ - - user_identifier_source = proto.Field( - proto.ENUM, - number=6, - enum=gage_user_identifier_source.UserIdentifierSourceEnum.UserIdentifierSource, - ) - hashed_email = proto.Field(proto.STRING, number=7, oneof="identifier") - hashed_phone_number = proto.Field( - proto.STRING, number=8, oneof="identifier" - ) - mobile_id = proto.Field(proto.STRING, number=9, oneof="identifier") - third_party_user_id = proto.Field( - proto.STRING, number=10, oneof="identifier" - ) - address_info = proto.Field( - proto.MESSAGE, - number=5, - oneof="identifier", - message="OfflineUserAddressInfo", - ) - - -class TransactionAttribute(proto.Message): - r"""Attribute of the store sales transaction. - - Attributes: - transaction_date_time (str): - Timestamp when transaction occurred. Required. The format is - "YYYY-MM-DD HH:MM:SS[+/-HH:MM]", where [+/-HH:MM] is an - optional timezone offset from UTC. If the offset is absent, - the API will use the account's timezone as default. - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30+03:00". - transaction_amount_micros (float): - Transaction amount in micros. Required. - currency_code (str): - Transaction currency code. ISO 4217 three- - etter code is used. Required. - conversion_action (str): - The resource name of conversion action to - report conversions to. Required. - order_id (str): - Transaction order id. - Accessible only to customers on the allow-list. - store_attribute (google.ads.googleads.v6.common.types.StoreAttribute): - Store attributes of the transaction. - Accessible only to customers on the allow-list. - custom_value (str): - Value of the custom variable for each - transaction. Accessible only to customers on the - allow-list. - """ - - transaction_date_time = proto.Field(proto.STRING, number=8, optional=True) - transaction_amount_micros = proto.Field( - proto.DOUBLE, number=9, optional=True - ) - currency_code = proto.Field(proto.STRING, number=10, optional=True) - conversion_action = proto.Field(proto.STRING, number=11, optional=True) - order_id = proto.Field(proto.STRING, number=12, optional=True) - store_attribute = proto.Field( - proto.MESSAGE, number=6, message="StoreAttribute", - ) - custom_value = proto.Field(proto.STRING, number=13, optional=True) - - -class StoreAttribute(proto.Message): - r"""Store attributes of the transaction. - - Attributes: - store_code (str): - Store code from - https://support.google.com/business/answer/3370250#storecode - """ - - store_code = proto.Field(proto.STRING, number=2, optional=True) - - -class UserData(proto.Message): - r"""User data holding user identifiers and attributes. - - Attributes: - user_identifiers (Sequence[google.ads.googleads.v6.common.types.UserIdentifier]): - User identification info. Required. - transaction_attribute (google.ads.googleads.v6.common.types.TransactionAttribute): - Additional transactions/attributes associated - with the user. Required when updating store - sales data. - user_attribute (google.ads.googleads.v6.common.types.UserAttribute): - Additional attributes associated with the - user. Required when updating customer match - attributes. These have an expiration of 540 - days. - """ - - user_identifiers = proto.RepeatedField( - proto.MESSAGE, number=1, message="UserIdentifier", - ) - transaction_attribute = proto.Field( - proto.MESSAGE, number=2, message="TransactionAttribute", - ) - user_attribute = proto.Field( - proto.MESSAGE, number=3, message="UserAttribute", - ) - - -class UserAttribute(proto.Message): - r"""User attribute, can only be used with CUSTOMER_MATCH_WITH_ATTRIBUTES - job type. - - Attributes: - lifetime_value_micros (int): - Advertiser defined lifetime value for the - user. - lifetime_value_bucket (int): - Advertiser defined lifetime value bucket for - the user. The valid range for a lifetime value - bucket is from 1 (low) to 10 (high), except for - remove operation where 0 will also be accepted. - """ - - lifetime_value_micros = proto.Field(proto.INT64, number=1, optional=True) - lifetime_value_bucket = proto.Field(proto.INT32, number=2, optional=True) - - -class CustomerMatchUserListMetadata(proto.Message): - r"""Metadata for customer match user list. - - Attributes: - user_list (str): - The resource name of remarketing list to update data. - Required for job of CUSTOMER_MATCH_USER_LIST type. - """ - - user_list = proto.Field(proto.STRING, number=2, optional=True) - - -class StoreSalesMetadata(proto.Message): - r"""Metadata for Store Sales Direct. - - Attributes: - loyalty_fraction (float): - This is the fraction of all transactions that - are identifiable (i.e., associated with any form - of customer information). Required. - The fraction needs to be between 0 and 1 - (excluding 0). - transaction_upload_fraction (float): - This is the ratio of sales being uploaded - compared to the overall sales that can be - associated with a customer. Required. The - fraction needs to be between 0 and 1 (excluding - 0). For example, if you upload half the sales - that you are able to associate with a customer, - this would be 0.5. - custom_key (str): - Name of the store sales custom variable key. - A predefined key that can be applied to the - transaction and then later used for custom - segmentation in reporting. - Accessible only to customers on the allow-list. - third_party_metadata (google.ads.googleads.v6.common.types.StoreSalesThirdPartyMetadata): - Metadata for a third party Store Sales - upload. - """ - - loyalty_fraction = proto.Field(proto.DOUBLE, number=5, optional=True) - transaction_upload_fraction = proto.Field( - proto.DOUBLE, number=6, optional=True - ) - custom_key = proto.Field(proto.STRING, number=7, optional=True) - third_party_metadata = proto.Field( - proto.MESSAGE, number=3, message="StoreSalesThirdPartyMetadata", - ) - - -class StoreSalesThirdPartyMetadata(proto.Message): - r"""Metadata for a third party Store Sales. - This product is only for customers on the allow-list. Please - contact your Google business development representative for - details on the upload configuration. - - Attributes: - advertiser_upload_date_time (str): - Time the advertiser uploaded the data to the - partner. Required. The format is "YYYY-MM-DD - HH:MM:SS". Examples: "2018-03-05 09:15:00" or - "2018-02-01 14:34:30". - valid_transaction_fraction (float): - The fraction of transactions that are valid. - Invalid transactions may include invalid formats - or values. Required. - The fraction needs to be between 0 and 1 - (excluding 0). - partner_match_fraction (float): - The fraction of valid transactions that are - matched to a third party assigned user ID on the - partner side. Required. - The fraction needs to be between 0 and 1 - (excluding 0). - partner_upload_fraction (float): - The fraction of valid transactions that are - uploaded by the partner to Google. - Required. - The fraction needs to be between 0 and 1 - (excluding 0). - bridge_map_version_id (str): - Version of partner IDs to be used for - uploads. Required. - partner_id (int): - ID of the third party partner updating the - transaction feed. - """ - - advertiser_upload_date_time = proto.Field( - proto.STRING, number=7, optional=True - ) - valid_transaction_fraction = proto.Field( - proto.DOUBLE, number=8, optional=True - ) - partner_match_fraction = proto.Field(proto.DOUBLE, number=9, optional=True) - partner_upload_fraction = proto.Field( - proto.DOUBLE, number=10, optional=True - ) - bridge_map_version_id = proto.Field(proto.STRING, number=11, optional=True) - partner_id = proto.Field(proto.INT64, number=12, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/policy.py b/google/ads/googleads/v6/common/types/policy.py deleted file mode 100644 index 0358c0019..000000000 --- a/google/ads/googleads/v6/common/types/policy.py +++ /dev/null @@ -1,344 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import policy_topic_entry_type -from google.ads.googleads.v6.enums.types import ( - policy_topic_evidence_destination_mismatch_url_type, -) -from google.ads.googleads.v6.enums.types import ( - policy_topic_evidence_destination_not_working_device, -) -from google.ads.googleads.v6.enums.types import ( - policy_topic_evidence_destination_not_working_dns_error_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "PolicyViolationKey", - "PolicyValidationParameter", - "PolicyTopicEntry", - "PolicyTopicEvidence", - "PolicyTopicConstraint", - }, -) - - -class PolicyViolationKey(proto.Message): - r"""Key of the violation. The key is used for referring to a - violation when filing an exemption request. - - Attributes: - policy_name (str): - Unique ID of the violated policy. - violating_text (str): - The text that violates the policy if - specified. Otherwise, refers to the policy in - general (e.g., when requesting to be exempt from - the whole policy). If not specified for - criterion exemptions, the whole policy is - implied. Must be specified for ad exemptions. - """ - - policy_name = proto.Field(proto.STRING, number=3, optional=True) - violating_text = proto.Field(proto.STRING, number=4, optional=True) - - -class PolicyValidationParameter(proto.Message): - r"""Parameter for controlling how policy exemption is done. - - Attributes: - ignorable_policy_topics (Sequence[str]): - The list of policy topics that should not - cause a PolicyFindingError to be reported. This - field is currently only compatible with Enhanced - Text Ad. It corresponds to the - PolicyTopicEntry.topic field. - Resources violating these policies will be - saved, but will not be eligible to serve. They - may begin serving at a later time due to a - change in policies, re-review of the resource, - or a change in advertiser certificates. - exempt_policy_violation_keys (Sequence[google.ads.googleads.v6.common.types.PolicyViolationKey]): - The list of policy violation keys that should not cause a - PolicyViolationError to be reported. Not all policy - violations are exemptable, please refer to the is_exemptible - field in the returned PolicyViolationError. - - Resources violating these polices will be saved, but will - not be eligible to serve. They may begin serving at a later - time due to a change in policies, re-review of the resource, - or a change in advertiser certificates. - """ - - ignorable_policy_topics = proto.RepeatedField(proto.STRING, number=3) - exempt_policy_violation_keys = proto.RepeatedField( - proto.MESSAGE, number=2, message="PolicyViolationKey", - ) - - -class PolicyTopicEntry(proto.Message): - r"""Policy finding attached to a resource (e.g. alcohol policy - associated with a site that sells alcohol). - - Each PolicyTopicEntry has a topic that indicates the specific - ads policy the entry is about and a type to indicate the effect - that the entry will have on serving. It may optionally have one - or more evidences that indicate the reason for the finding. It - may also optionally have one or more constraints that provide - details about how serving may be restricted. - - Attributes: - topic (str): - Policy topic this finding refers to. For example, "ALCOHOL", - "TRADEMARKS_IN_AD_TEXT", or "DESTINATION_NOT_WORKING". The - set of possible policy topics is not fixed for a particular - API version and may change at any time. - type_ (google.ads.googleads.v6.enums.types.PolicyTopicEntryTypeEnum.PolicyTopicEntryType): - Describes the negative or positive effect - this policy will have on serving. - evidences (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEvidence]): - Additional information that explains policy - finding (e.g. the brand name for a trademark - finding). - constraints (Sequence[google.ads.googleads.v6.common.types.PolicyTopicConstraint]): - Indicates how serving of this resource may be - affected (e.g. not serving in a country). - """ - - topic = proto.Field(proto.STRING, number=5, optional=True) - type_ = proto.Field( - proto.ENUM, - number=2, - enum=policy_topic_entry_type.PolicyTopicEntryTypeEnum.PolicyTopicEntryType, - ) - evidences = proto.RepeatedField( - proto.MESSAGE, number=3, message="PolicyTopicEvidence", - ) - constraints = proto.RepeatedField( - proto.MESSAGE, number=4, message="PolicyTopicConstraint", - ) - - -class PolicyTopicEvidence(proto.Message): - r"""Additional information that explains a policy finding. - - Attributes: - website_list (google.ads.googleads.v6.common.types.PolicyTopicEvidence.WebsiteList): - List of websites linked with this resource. - text_list (google.ads.googleads.v6.common.types.PolicyTopicEvidence.TextList): - List of evidence found in the text of a - resource. - language_code (str): - The language the resource was detected to be - written in. This is an IETF language tag such as - "en-US". - destination_text_list (google.ads.googleads.v6.common.types.PolicyTopicEvidence.DestinationTextList): - The text in the destination of the resource - that is causing a policy finding. - destination_mismatch (google.ads.googleads.v6.common.types.PolicyTopicEvidence.DestinationMismatch): - Mismatch between the destinations of a - resource's URLs. - destination_not_working (google.ads.googleads.v6.common.types.PolicyTopicEvidence.DestinationNotWorking): - Details when the destination is returning an - HTTP error code or isn't functional in all - locations for commonly used devices. - """ - - class TextList(proto.Message): - r"""A list of fragments of text that violated a policy. - - Attributes: - texts (Sequence[str]): - The fragments of text from the resource that - caused the policy finding. - """ - - texts = proto.RepeatedField(proto.STRING, number=2) - - class WebsiteList(proto.Message): - r"""A list of websites that caused a policy finding. Used for - ONE_WEBSITE_PER_AD_GROUP policy topic, for example. In case there - are more than five websites, only the top five (those that appear in - resources the most) will be listed here. - - Attributes: - websites (Sequence[str]): - Websites that caused the policy finding. - """ - - websites = proto.RepeatedField(proto.STRING, number=2) - - class DestinationTextList(proto.Message): - r"""A list of strings found in a destination page that caused a - policy finding. - - Attributes: - destination_texts (Sequence[str]): - List of text found in the resource's - destination page. - """ - - destination_texts = proto.RepeatedField(proto.STRING, number=2) - - class DestinationMismatch(proto.Message): - r"""Evidence of mismatches between the URLs of a resource. - - Attributes: - url_types (Sequence[google.ads.googleads.v6.enums.types.PolicyTopicEvidenceDestinationMismatchUrlTypeEnum.PolicyTopicEvidenceDestinationMismatchUrlType]): - The set of URLs that did not match each - other. - """ - - url_types = proto.RepeatedField( - proto.ENUM, - number=1, - enum=policy_topic_evidence_destination_mismatch_url_type.PolicyTopicEvidenceDestinationMismatchUrlTypeEnum.PolicyTopicEvidenceDestinationMismatchUrlType, - ) - - class DestinationNotWorking(proto.Message): - r"""Evidence details when the destination is returning an HTTP - error code or isn't functional in all locations for commonly - used devices. - - Attributes: - expanded_url (str): - The full URL that didn't work. - device (google.ads.googleads.v6.enums.types.PolicyTopicEvidenceDestinationNotWorkingDeviceEnum.PolicyTopicEvidenceDestinationNotWorkingDevice): - The type of device that failed to load the - URL. - last_checked_date_time (str): - The time the URL was last checked. - The format is "YYYY-MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - dns_error_type (google.ads.googleads.v6.enums.types.PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum.PolicyTopicEvidenceDestinationNotWorkingDnsErrorType): - The type of DNS error. - http_error_code (int): - The HTTP error code. - """ - - expanded_url = proto.Field(proto.STRING, number=7, optional=True) - device = proto.Field( - proto.ENUM, - number=4, - enum=policy_topic_evidence_destination_not_working_device.PolicyTopicEvidenceDestinationNotWorkingDeviceEnum.PolicyTopicEvidenceDestinationNotWorkingDevice, - ) - last_checked_date_time = proto.Field( - proto.STRING, number=8, optional=True - ) - dns_error_type = proto.Field( - proto.ENUM, - number=1, - oneof="reason", - enum=policy_topic_evidence_destination_not_working_dns_error_type.PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum.PolicyTopicEvidenceDestinationNotWorkingDnsErrorType, - ) - http_error_code = proto.Field(proto.INT64, number=6, oneof="reason") - - website_list = proto.Field( - proto.MESSAGE, number=3, oneof="value", message=WebsiteList, - ) - text_list = proto.Field( - proto.MESSAGE, number=4, oneof="value", message=TextList, - ) - language_code = proto.Field(proto.STRING, number=9, oneof="value") - destination_text_list = proto.Field( - proto.MESSAGE, number=6, oneof="value", message=DestinationTextList, - ) - destination_mismatch = proto.Field( - proto.MESSAGE, number=7, oneof="value", message=DestinationMismatch, - ) - destination_not_working = proto.Field( - proto.MESSAGE, number=8, oneof="value", message=DestinationNotWorking, - ) - - -class PolicyTopicConstraint(proto.Message): - r"""Describes the effect on serving that a policy topic entry - will have. - - Attributes: - country_constraint_list (google.ads.googleads.v6.common.types.PolicyTopicConstraint.CountryConstraintList): - Countries where the resource cannot serve. - reseller_constraint (google.ads.googleads.v6.common.types.PolicyTopicConstraint.ResellerConstraint): - Reseller constraint. - certificate_missing_in_country_list (google.ads.googleads.v6.common.types.PolicyTopicConstraint.CountryConstraintList): - Countries where a certificate is required for - serving. - certificate_domain_mismatch_in_country_list (google.ads.googleads.v6.common.types.PolicyTopicConstraint.CountryConstraintList): - Countries where the resource's domain is not - covered by the certificates associated with it. - """ - - class CountryConstraintList(proto.Message): - r"""A list of countries where a resource's serving is - constrained. - - Attributes: - total_targeted_countries (int): - Total number of countries targeted by the - resource. - countries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicConstraint.CountryConstraint]): - Countries in which serving is restricted. - """ - - total_targeted_countries = proto.Field( - proto.INT32, number=3, optional=True - ) - countries = proto.RepeatedField( - proto.MESSAGE, - number=2, - message="PolicyTopicConstraint.CountryConstraint", - ) - - class ResellerConstraint(proto.Message): - r"""Indicates that a policy topic was constrained due to - disapproval of the website for reseller purposes. - """ - - class CountryConstraint(proto.Message): - r"""Indicates that a resource's ability to serve in a particular - country is constrained. - - Attributes: - country_criterion (str): - Geo target constant resource name of the - country in which serving is constrained. - """ - - country_criterion = proto.Field(proto.STRING, number=2, optional=True) - - country_constraint_list = proto.Field( - proto.MESSAGE, number=1, oneof="value", message=CountryConstraintList, - ) - reseller_constraint = proto.Field( - proto.MESSAGE, number=2, oneof="value", message=ResellerConstraint, - ) - certificate_missing_in_country_list = proto.Field( - proto.MESSAGE, number=3, oneof="value", message=CountryConstraintList, - ) - certificate_domain_mismatch_in_country_list = proto.Field( - proto.MESSAGE, number=4, oneof="value", message=CountryConstraintList, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/real_time_bidding_setting.py b/google/ads/googleads/v6/common/types/real_time_bidding_setting.py deleted file mode 100644 index 4df0355cc..000000000 --- a/google/ads/googleads/v6/common/types/real_time_bidding_setting.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"RealTimeBiddingSetting",}, -) - - -class RealTimeBiddingSetting(proto.Message): - r"""Settings for Real-Time Bidding, a feature only available for - campaigns targeting the Ad Exchange network. - - Attributes: - opt_in (bool): - Whether the campaign is opted in to real-time - bidding. - """ - - opt_in = proto.Field(proto.BOOL, number=2, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/segments.py b/google/ads/googleads/v6/common/types/segments.py deleted file mode 100644 index e9aeea36e..000000000 --- a/google/ads/googleads/v6/common/types/segments.py +++ /dev/null @@ -1,515 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import ( - ad_destination_type as gage_ad_destination_type, -) -from google.ads.googleads.v6.enums.types import ( - ad_network_type as gage_ad_network_type, -) -from google.ads.googleads.v6.enums.types import ( - budget_campaign_association_status as gage_budget_campaign_association_status, -) -from google.ads.googleads.v6.enums.types import click_type as gage_click_type -from google.ads.googleads.v6.enums.types import ( - conversion_action_category as gage_conversion_action_category, -) -from google.ads.googleads.v6.enums.types import ( - conversion_attribution_event_type as gage_conversion_attribution_event_type, -) -from google.ads.googleads.v6.enums.types import ( - conversion_lag_bucket as gage_conversion_lag_bucket, -) -from google.ads.googleads.v6.enums.types import ( - conversion_or_adjustment_lag_bucket as gage_conversion_or_adjustment_lag_bucket, -) -from google.ads.googleads.v6.enums.types import day_of_week as gage_day_of_week -from google.ads.googleads.v6.enums.types import device as gage_device -from google.ads.googleads.v6.enums.types import ( - external_conversion_source as gage_external_conversion_source, -) -from google.ads.googleads.v6.enums.types import ( - hotel_date_selection_type as gage_hotel_date_selection_type, -) -from google.ads.googleads.v6.enums.types import ( - hotel_price_bucket as gage_hotel_price_bucket, -) -from google.ads.googleads.v6.enums.types import ( - hotel_rate_type as gage_hotel_rate_type, -) -from google.ads.googleads.v6.enums.types import ( - month_of_year as gage_month_of_year, -) -from google.ads.googleads.v6.enums.types import ( - placeholder_type as gage_placeholder_type, -) -from google.ads.googleads.v6.enums.types import ( - product_channel as gage_product_channel, -) -from google.ads.googleads.v6.enums.types import ( - product_channel_exclusivity as gage_product_channel_exclusivity, -) -from google.ads.googleads.v6.enums.types import ( - product_condition as gage_product_condition, -) -from google.ads.googleads.v6.enums.types import ( - search_engine_results_page_type as gage_search_engine_results_page_type, -) -from google.ads.googleads.v6.enums.types import ( - search_term_match_type as gage_search_term_match_type, -) -from google.ads.googleads.v6.enums.types import slot as gage_slot - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"Segments", "Keyword", "BudgetCampaignAssociationStatus",}, -) - - -class Segments(proto.Message): - r"""Segment only fields. - - Attributes: - ad_destination_type (google.ads.googleads.v6.enums.types.AdDestinationTypeEnum.AdDestinationType): - Ad Destination type. - ad_network_type (google.ads.googleads.v6.enums.types.AdNetworkTypeEnum.AdNetworkType): - Ad network type. - budget_campaign_association_status (google.ads.googleads.v6.common.types.BudgetCampaignAssociationStatus): - Budget campaign association status. - click_type (google.ads.googleads.v6.enums.types.ClickTypeEnum.ClickType): - Click type. - conversion_action (str): - Resource name of the conversion action. - conversion_action_category (google.ads.googleads.v6.enums.types.ConversionActionCategoryEnum.ConversionActionCategory): - Conversion action category. - conversion_action_name (str): - Conversion action name. - conversion_adjustment (bool): - This segments your conversion columns by the - original conversion and conversion value vs. the - delta if conversions were adjusted. False row - has the data as originally stated; While true - row has the delta between data now and the data - as originally stated. Summing the two together - results post-adjustment data. - conversion_attribution_event_type (google.ads.googleads.v6.enums.types.ConversionAttributionEventTypeEnum.ConversionAttributionEventType): - Conversion attribution event type. - conversion_lag_bucket (google.ads.googleads.v6.enums.types.ConversionLagBucketEnum.ConversionLagBucket): - An enum value representing the number of days - between the impression and the conversion. - conversion_or_adjustment_lag_bucket (google.ads.googleads.v6.enums.types.ConversionOrAdjustmentLagBucketEnum.ConversionOrAdjustmentLagBucket): - An enum value representing the number of days - between the impression and the conversion or - between the impression and adjustments to the - conversion. - date (str): - Date to which metrics apply. - yyyy-MM-dd format, e.g., 2018-04-17. - day_of_week (google.ads.googleads.v6.enums.types.DayOfWeekEnum.DayOfWeek): - Day of the week, e.g., MONDAY. - device (google.ads.googleads.v6.enums.types.DeviceEnum.Device): - Device to which metrics apply. - external_conversion_source (google.ads.googleads.v6.enums.types.ExternalConversionSourceEnum.ExternalConversionSource): - External conversion source. - geo_target_airport (str): - Resource name of the geo target constant that - represents an airport. - geo_target_canton (str): - Resource name of the geo target constant that - represents a canton. - geo_target_city (str): - Resource name of the geo target constant that - represents a city. - geo_target_country (str): - Resource name of the geo target constant that - represents a country. - geo_target_county (str): - Resource name of the geo target constant that - represents a county. - geo_target_district (str): - Resource name of the geo target constant that - represents a district. - geo_target_metro (str): - Resource name of the geo target constant that - represents a metro. - geo_target_most_specific_location (str): - Resource name of the geo target constant that - represents the most specific location. - geo_target_postal_code (str): - Resource name of the geo target constant that - represents a postal code. - geo_target_province (str): - Resource name of the geo target constant that - represents a province. - geo_target_region (str): - Resource name of the geo target constant that - represents a region. - geo_target_state (str): - Resource name of the geo target constant that - represents a state. - hotel_booking_window_days (int): - Hotel booking window in days. - hotel_center_id (int): - Hotel center ID. - hotel_check_in_date (str): - Hotel check-in date. Formatted as yyyy-MM-dd. - hotel_check_in_day_of_week (google.ads.googleads.v6.enums.types.DayOfWeekEnum.DayOfWeek): - Hotel check-in day of week. - hotel_city (str): - Hotel city. - hotel_class (int): - Hotel class. - hotel_country (str): - Hotel country. - hotel_date_selection_type (google.ads.googleads.v6.enums.types.HotelDateSelectionTypeEnum.HotelDateSelectionType): - Hotel date selection type. - hotel_length_of_stay (int): - Hotel length of stay. - hotel_rate_rule_id (str): - Hotel rate rule ID. - hotel_rate_type (google.ads.googleads.v6.enums.types.HotelRateTypeEnum.HotelRateType): - Hotel rate type. - hotel_price_bucket (google.ads.googleads.v6.enums.types.HotelPriceBucketEnum.HotelPriceBucket): - Hotel price bucket. - hotel_state (str): - Hotel state. - hour (int): - Hour of day as a number between 0 and 23, - inclusive. - interaction_on_this_extension (bool): - Only used with feed item metrics. - Indicates whether the interaction metrics - occurred on the feed item itself or a different - extension or ad unit. - keyword (google.ads.googleads.v6.common.types.Keyword): - Keyword criterion. - month (str): - Month as represented by the date of the first - day of a month. Formatted as yyyy-MM-dd. - month_of_year (google.ads.googleads.v6.enums.types.MonthOfYearEnum.MonthOfYear): - Month of the year, e.g., January. - partner_hotel_id (str): - Partner hotel ID. - placeholder_type (google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType): - Placeholder type. This is only used with feed - item metrics. - product_aggregator_id (int): - Aggregator ID of the product. - product_bidding_category_level1 (str): - Bidding category (level 1) of the product. - product_bidding_category_level2 (str): - Bidding category (level 2) of the product. - product_bidding_category_level3 (str): - Bidding category (level 3) of the product. - product_bidding_category_level4 (str): - Bidding category (level 4) of the product. - product_bidding_category_level5 (str): - Bidding category (level 5) of the product. - product_brand (str): - Brand of the product. - product_channel (google.ads.googleads.v6.enums.types.ProductChannelEnum.ProductChannel): - Channel of the product. - product_channel_exclusivity (google.ads.googleads.v6.enums.types.ProductChannelExclusivityEnum.ProductChannelExclusivity): - Channel exclusivity of the product. - product_condition (google.ads.googleads.v6.enums.types.ProductConditionEnum.ProductCondition): - Condition of the product. - product_country (str): - Resource name of the geo target constant for - the country of sale of the product. - product_custom_attribute0 (str): - Custom attribute 0 of the product. - product_custom_attribute1 (str): - Custom attribute 1 of the product. - product_custom_attribute2 (str): - Custom attribute 2 of the product. - product_custom_attribute3 (str): - Custom attribute 3 of the product. - product_custom_attribute4 (str): - Custom attribute 4 of the product. - product_item_id (str): - Item ID of the product. - product_language (str): - Resource name of the language constant for - the language of the product. - product_merchant_id (int): - Merchant ID of the product. - product_store_id (str): - Store ID of the product. - product_title (str): - Title of the product. - product_type_l1 (str): - Type (level 1) of the product. - product_type_l2 (str): - Type (level 2) of the product. - product_type_l3 (str): - Type (level 3) of the product. - product_type_l4 (str): - Type (level 4) of the product. - product_type_l5 (str): - Type (level 5) of the product. - quarter (str): - Quarter as represented by the date of the - first day of a quarter. Uses the calendar year - for quarters, e.g., the second quarter of 2018 - starts on 2018-04-01. Formatted as yyyy-MM-dd. - search_engine_results_page_type (google.ads.googleads.v6.enums.types.SearchEngineResultsPageTypeEnum.SearchEngineResultsPageType): - Type of the search engine results page. - search_term_match_type (google.ads.googleads.v6.enums.types.SearchTermMatchTypeEnum.SearchTermMatchType): - Match type of the keyword that triggered the - ad, including variants. - slot (google.ads.googleads.v6.enums.types.SlotEnum.Slot): - Position of the ad. - webpage (str): - Resource name of the ad group criterion that - represents webpage criterion. - week (str): - Week as defined as Monday through Sunday, and - represented by the date of Monday. Formatted as - yyyy-MM-dd. - year (int): - Year, formatted as yyyy. - """ - - ad_destination_type = proto.Field( - proto.ENUM, - number=136, - enum=gage_ad_destination_type.AdDestinationTypeEnum.AdDestinationType, - ) - ad_network_type = proto.Field( - proto.ENUM, - number=3, - enum=gage_ad_network_type.AdNetworkTypeEnum.AdNetworkType, - ) - budget_campaign_association_status = proto.Field( - proto.MESSAGE, number=134, message="BudgetCampaignAssociationStatus", - ) - click_type = proto.Field( - proto.ENUM, number=26, enum=gage_click_type.ClickTypeEnum.ClickType, - ) - conversion_action = proto.Field(proto.STRING, number=113, optional=True) - conversion_action_category = proto.Field( - proto.ENUM, - number=53, - enum=gage_conversion_action_category.ConversionActionCategoryEnum.ConversionActionCategory, - ) - conversion_action_name = proto.Field( - proto.STRING, number=114, optional=True - ) - conversion_adjustment = proto.Field(proto.BOOL, number=115, optional=True) - conversion_attribution_event_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_conversion_attribution_event_type.ConversionAttributionEventTypeEnum.ConversionAttributionEventType, - ) - conversion_lag_bucket = proto.Field( - proto.ENUM, - number=50, - enum=gage_conversion_lag_bucket.ConversionLagBucketEnum.ConversionLagBucket, - ) - conversion_or_adjustment_lag_bucket = proto.Field( - proto.ENUM, - number=51, - enum=gage_conversion_or_adjustment_lag_bucket.ConversionOrAdjustmentLagBucketEnum.ConversionOrAdjustmentLagBucket, - ) - date = proto.Field(proto.STRING, number=79, optional=True) - day_of_week = proto.Field( - proto.ENUM, number=5, enum=gage_day_of_week.DayOfWeekEnum.DayOfWeek, - ) - device = proto.Field( - proto.ENUM, number=1, enum=gage_device.DeviceEnum.Device, - ) - external_conversion_source = proto.Field( - proto.ENUM, - number=55, - enum=gage_external_conversion_source.ExternalConversionSourceEnum.ExternalConversionSource, - ) - geo_target_airport = proto.Field(proto.STRING, number=116, optional=True) - geo_target_canton = proto.Field(proto.STRING, number=117, optional=True) - geo_target_city = proto.Field(proto.STRING, number=118, optional=True) - geo_target_country = proto.Field(proto.STRING, number=119, optional=True) - geo_target_county = proto.Field(proto.STRING, number=120, optional=True) - geo_target_district = proto.Field(proto.STRING, number=121, optional=True) - geo_target_metro = proto.Field(proto.STRING, number=122, optional=True) - geo_target_most_specific_location = proto.Field( - proto.STRING, number=123, optional=True - ) - geo_target_postal_code = proto.Field( - proto.STRING, number=124, optional=True - ) - geo_target_province = proto.Field(proto.STRING, number=125, optional=True) - geo_target_region = proto.Field(proto.STRING, number=126, optional=True) - geo_target_state = proto.Field(proto.STRING, number=127, optional=True) - hotel_booking_window_days = proto.Field( - proto.INT64, number=135, optional=True - ) - hotel_center_id = proto.Field(proto.INT64, number=80, optional=True) - hotel_check_in_date = proto.Field(proto.STRING, number=81, optional=True) - hotel_check_in_day_of_week = proto.Field( - proto.ENUM, number=9, enum=gage_day_of_week.DayOfWeekEnum.DayOfWeek, - ) - hotel_city = proto.Field(proto.STRING, number=82, optional=True) - hotel_class = proto.Field(proto.INT32, number=83, optional=True) - hotel_country = proto.Field(proto.STRING, number=84, optional=True) - hotel_date_selection_type = proto.Field( - proto.ENUM, - number=13, - enum=gage_hotel_date_selection_type.HotelDateSelectionTypeEnum.HotelDateSelectionType, - ) - hotel_length_of_stay = proto.Field(proto.INT32, number=85, optional=True) - hotel_rate_rule_id = proto.Field(proto.STRING, number=86, optional=True) - hotel_rate_type = proto.Field( - proto.ENUM, - number=74, - enum=gage_hotel_rate_type.HotelRateTypeEnum.HotelRateType, - ) - hotel_price_bucket = proto.Field( - proto.ENUM, - number=78, - enum=gage_hotel_price_bucket.HotelPriceBucketEnum.HotelPriceBucket, - ) - hotel_state = proto.Field(proto.STRING, number=87, optional=True) - hour = proto.Field(proto.INT32, number=88, optional=True) - interaction_on_this_extension = proto.Field( - proto.BOOL, number=89, optional=True - ) - keyword = proto.Field(proto.MESSAGE, number=61, message="Keyword",) - month = proto.Field(proto.STRING, number=90, optional=True) - month_of_year = proto.Field( - proto.ENUM, - number=18, - enum=gage_month_of_year.MonthOfYearEnum.MonthOfYear, - ) - partner_hotel_id = proto.Field(proto.STRING, number=91, optional=True) - placeholder_type = proto.Field( - proto.ENUM, - number=20, - enum=gage_placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - product_aggregator_id = proto.Field(proto.INT64, number=132, optional=True) - product_bidding_category_level1 = proto.Field( - proto.STRING, number=92, optional=True - ) - product_bidding_category_level2 = proto.Field( - proto.STRING, number=93, optional=True - ) - product_bidding_category_level3 = proto.Field( - proto.STRING, number=94, optional=True - ) - product_bidding_category_level4 = proto.Field( - proto.STRING, number=95, optional=True - ) - product_bidding_category_level5 = proto.Field( - proto.STRING, number=96, optional=True - ) - product_brand = proto.Field(proto.STRING, number=97, optional=True) - product_channel = proto.Field( - proto.ENUM, - number=30, - enum=gage_product_channel.ProductChannelEnum.ProductChannel, - ) - product_channel_exclusivity = proto.Field( - proto.ENUM, - number=31, - enum=gage_product_channel_exclusivity.ProductChannelExclusivityEnum.ProductChannelExclusivity, - ) - product_condition = proto.Field( - proto.ENUM, - number=32, - enum=gage_product_condition.ProductConditionEnum.ProductCondition, - ) - product_country = proto.Field(proto.STRING, number=98, optional=True) - product_custom_attribute0 = proto.Field( - proto.STRING, number=99, optional=True - ) - product_custom_attribute1 = proto.Field( - proto.STRING, number=100, optional=True - ) - product_custom_attribute2 = proto.Field( - proto.STRING, number=101, optional=True - ) - product_custom_attribute3 = proto.Field( - proto.STRING, number=102, optional=True - ) - product_custom_attribute4 = proto.Field( - proto.STRING, number=103, optional=True - ) - product_item_id = proto.Field(proto.STRING, number=104, optional=True) - product_language = proto.Field(proto.STRING, number=105, optional=True) - product_merchant_id = proto.Field(proto.INT64, number=133, optional=True) - product_store_id = proto.Field(proto.STRING, number=106, optional=True) - product_title = proto.Field(proto.STRING, number=107, optional=True) - product_type_l1 = proto.Field(proto.STRING, number=108, optional=True) - product_type_l2 = proto.Field(proto.STRING, number=109, optional=True) - product_type_l3 = proto.Field(proto.STRING, number=110, optional=True) - product_type_l4 = proto.Field(proto.STRING, number=111, optional=True) - product_type_l5 = proto.Field(proto.STRING, number=112, optional=True) - quarter = proto.Field(proto.STRING, number=128, optional=True) - search_engine_results_page_type = proto.Field( - proto.ENUM, - number=70, - enum=gage_search_engine_results_page_type.SearchEngineResultsPageTypeEnum.SearchEngineResultsPageType, - ) - search_term_match_type = proto.Field( - proto.ENUM, - number=22, - enum=gage_search_term_match_type.SearchTermMatchTypeEnum.SearchTermMatchType, - ) - slot = proto.Field(proto.ENUM, number=23, enum=gage_slot.SlotEnum.Slot,) - webpage = proto.Field(proto.STRING, number=129, optional=True) - week = proto.Field(proto.STRING, number=130, optional=True) - year = proto.Field(proto.INT32, number=131, optional=True) - - -class Keyword(proto.Message): - r"""A Keyword criterion segment. - - Attributes: - ad_group_criterion (str): - The AdGroupCriterion resource name. - info (google.ads.googleads.v6.common.types.KeywordInfo): - Keyword info. - """ - - ad_group_criterion = proto.Field(proto.STRING, number=3, optional=True) - info = proto.Field(proto.MESSAGE, number=2, message=criteria.KeywordInfo,) - - -class BudgetCampaignAssociationStatus(proto.Message): - r"""A BudgetCampaignAssociationStatus segment. - - Attributes: - campaign (str): - The campaign resource name. - status (google.ads.googleads.v6.enums.types.BudgetCampaignAssociationStatusEnum.BudgetCampaignAssociationStatus): - Budget campaign association status. - """ - - campaign = proto.Field(proto.STRING, number=1, optional=True) - status = proto.Field( - proto.ENUM, - number=2, - enum=gage_budget_campaign_association_status.BudgetCampaignAssociationStatusEnum.BudgetCampaignAssociationStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/simulation.py b/google/ads/googleads/v6/common/types/simulation.py deleted file mode 100644 index 7f632bcb5..000000000 --- a/google/ads/googleads/v6/common/types/simulation.py +++ /dev/null @@ -1,369 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "BidModifierSimulationPointList", - "CpcBidSimulationPointList", - "CpvBidSimulationPointList", - "TargetCpaSimulationPointList", - "TargetRoasSimulationPointList", - "PercentCpcBidSimulationPointList", - "BidModifierSimulationPoint", - "CpcBidSimulationPoint", - "CpvBidSimulationPoint", - "TargetCpaSimulationPoint", - "TargetRoasSimulationPoint", - "PercentCpcBidSimulationPoint", - }, -) - - -class BidModifierSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type - BID_MODIFIER. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.BidModifierSimulationPoint]): - Projected metrics for a series of bid - modifier amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="BidModifierSimulationPoint", - ) - - -class CpcBidSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type CPC_BID. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.CpcBidSimulationPoint]): - Projected metrics for a series of CPC bid - amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="CpcBidSimulationPoint", - ) - - -class CpvBidSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type CPV_BID. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.CpvBidSimulationPoint]): - Projected metrics for a series of CPV bid - amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="CpvBidSimulationPoint", - ) - - -class TargetCpaSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type - TARGET_CPA. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.TargetCpaSimulationPoint]): - Projected metrics for a series of target CPA - amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="TargetCpaSimulationPoint", - ) - - -class TargetRoasSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type - TARGET_ROAS. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.TargetRoasSimulationPoint]): - Projected metrics for a series of target ROAS - amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="TargetRoasSimulationPoint", - ) - - -class PercentCpcBidSimulationPointList(proto.Message): - r"""A container for simulation points for simulations of type - PERCENT_CPC_BID. - - Attributes: - points (Sequence[google.ads.googleads.v6.common.types.PercentCpcBidSimulationPoint]): - Projected metrics for a series of percent CPC - bid amounts. - """ - - points = proto.RepeatedField( - proto.MESSAGE, number=1, message="PercentCpcBidSimulationPoint", - ) - - -class BidModifierSimulationPoint(proto.Message): - r"""Projected metrics for a specific bid modifier amount. - - Attributes: - bid_modifier (float): - The simulated bid modifier upon which - projected metrics are based. - biddable_conversions (float): - Projected number of biddable conversions. - Only search advertising channel type supports - this field. - biddable_conversions_value (float): - Projected total value of biddable - conversions. Only search advertising channel - type supports this field. - clicks (int): - Projected number of clicks. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - top_slot_impressions (int): - Projected number of top slot impressions. - Only search advertising channel type supports - this field. - parent_biddable_conversions (float): - Projected number of biddable conversions for - the parent resource. Only search advertising - channel type supports this field. - parent_biddable_conversions_value (float): - Projected total value of biddable conversions - for the parent resource. Only search advertising - channel type supports this field. - parent_clicks (int): - Projected number of clicks for the parent - resource. - parent_cost_micros (int): - Projected cost in micros for the parent - resource. - parent_impressions (int): - Projected number of impressions for the - parent resource. - parent_top_slot_impressions (int): - Projected number of top slot impressions for - the parent resource. Only search advertising - channel type supports this field. - parent_required_budget_micros (int): - Projected minimum daily budget that must be - available to the parent resource to realize this - simulation. - """ - - bid_modifier = proto.Field(proto.DOUBLE, number=15, optional=True) - biddable_conversions = proto.Field(proto.DOUBLE, number=16, optional=True) - biddable_conversions_value = proto.Field( - proto.DOUBLE, number=17, optional=True - ) - clicks = proto.Field(proto.INT64, number=18, optional=True) - cost_micros = proto.Field(proto.INT64, number=19, optional=True) - impressions = proto.Field(proto.INT64, number=20, optional=True) - top_slot_impressions = proto.Field(proto.INT64, number=21, optional=True) - parent_biddable_conversions = proto.Field( - proto.DOUBLE, number=22, optional=True - ) - parent_biddable_conversions_value = proto.Field( - proto.DOUBLE, number=23, optional=True - ) - parent_clicks = proto.Field(proto.INT64, number=24, optional=True) - parent_cost_micros = proto.Field(proto.INT64, number=25, optional=True) - parent_impressions = proto.Field(proto.INT64, number=26, optional=True) - parent_top_slot_impressions = proto.Field( - proto.INT64, number=27, optional=True - ) - parent_required_budget_micros = proto.Field( - proto.INT64, number=28, optional=True - ) - - -class CpcBidSimulationPoint(proto.Message): - r"""Projected metrics for a specific CPC bid amount. - - Attributes: - cpc_bid_micros (int): - The simulated CPC bid upon which projected - metrics are based. - biddable_conversions (float): - Projected number of biddable conversions. - biddable_conversions_value (float): - Projected total value of biddable - conversions. - clicks (int): - Projected number of clicks. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - top_slot_impressions (int): - Projected number of top slot impressions. - Only search advertising channel type supports - this field. - """ - - cpc_bid_micros = proto.Field(proto.INT64, number=8, optional=True) - biddable_conversions = proto.Field(proto.DOUBLE, number=9, optional=True) - biddable_conversions_value = proto.Field( - proto.DOUBLE, number=10, optional=True - ) - clicks = proto.Field(proto.INT64, number=11, optional=True) - cost_micros = proto.Field(proto.INT64, number=12, optional=True) - impressions = proto.Field(proto.INT64, number=13, optional=True) - top_slot_impressions = proto.Field(proto.INT64, number=14, optional=True) - - -class CpvBidSimulationPoint(proto.Message): - r"""Projected metrics for a specific CPV bid amount. - - Attributes: - cpv_bid_micros (int): - The simulated CPV bid upon which projected - metrics are based. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - views (int): - Projected number of views. - """ - - cpv_bid_micros = proto.Field(proto.INT64, number=5, optional=True) - cost_micros = proto.Field(proto.INT64, number=6, optional=True) - impressions = proto.Field(proto.INT64, number=7, optional=True) - views = proto.Field(proto.INT64, number=8, optional=True) - - -class TargetCpaSimulationPoint(proto.Message): - r"""Projected metrics for a specific target CPA amount. - - Attributes: - target_cpa_micros (int): - The simulated target CPA upon which projected - metrics are based. - biddable_conversions (float): - Projected number of biddable conversions. - biddable_conversions_value (float): - Projected total value of biddable - conversions. - clicks (int): - Projected number of clicks. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - top_slot_impressions (int): - Projected number of top slot impressions. - Only search advertising channel type supports - this field. - """ - - target_cpa_micros = proto.Field(proto.INT64, number=8, optional=True) - biddable_conversions = proto.Field(proto.DOUBLE, number=9, optional=True) - biddable_conversions_value = proto.Field( - proto.DOUBLE, number=10, optional=True - ) - clicks = proto.Field(proto.INT64, number=11, optional=True) - cost_micros = proto.Field(proto.INT64, number=12, optional=True) - impressions = proto.Field(proto.INT64, number=13, optional=True) - top_slot_impressions = proto.Field(proto.INT64, number=14, optional=True) - - -class TargetRoasSimulationPoint(proto.Message): - r"""Projected metrics for a specific target ROAS amount. - - Attributes: - target_roas (float): - The simulated target ROAS upon which - projected metrics are based. - biddable_conversions (float): - Projected number of biddable conversions. - biddable_conversions_value (float): - Projected total value of biddable - conversions. - clicks (int): - Projected number of clicks. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - top_slot_impressions (int): - Projected number of top slot impressions. - Only Search advertising channel type supports - this field. - """ - - target_roas = proto.Field(proto.DOUBLE, number=8, optional=True) - biddable_conversions = proto.Field(proto.DOUBLE, number=9, optional=True) - biddable_conversions_value = proto.Field( - proto.DOUBLE, number=10, optional=True - ) - clicks = proto.Field(proto.INT64, number=11, optional=True) - cost_micros = proto.Field(proto.INT64, number=12, optional=True) - impressions = proto.Field(proto.INT64, number=13, optional=True) - top_slot_impressions = proto.Field(proto.INT64, number=14, optional=True) - - -class PercentCpcBidSimulationPoint(proto.Message): - r"""Projected metrics for a specific percent CPC amount. Only - Hotel advertising channel type supports this field. - - Attributes: - percent_cpc_bid_micros (int): - The simulated percent CPC upon which projected metrics are - based. Percent CPC expressed as fraction of the advertised - price for some good or service. The value stored here is - 1,000,000 \* [fraction]. - biddable_conversions (float): - Projected number of biddable conversions. - biddable_conversions_value (float): - Projected total value of biddable conversions - in local currency. - clicks (int): - Projected number of clicks. - cost_micros (int): - Projected cost in micros. - impressions (int): - Projected number of impressions. - top_slot_impressions (int): - Projected number of top slot impressions. - """ - - percent_cpc_bid_micros = proto.Field(proto.INT64, number=1, optional=True) - biddable_conversions = proto.Field(proto.DOUBLE, number=2, optional=True) - biddable_conversions_value = proto.Field( - proto.DOUBLE, number=3, optional=True - ) - clicks = proto.Field(proto.INT64, number=4, optional=True) - cost_micros = proto.Field(proto.INT64, number=5, optional=True) - impressions = proto.Field(proto.INT64, number=6, optional=True) - top_slot_impressions = proto.Field(proto.INT64, number=7, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/tag_snippet.py b/google/ads/googleads/v6/common/types/tag_snippet.py deleted file mode 100644 index df5990d0b..000000000 --- a/google/ads/googleads/v6/common/types/tag_snippet.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import tracking_code_page_format -from google.ads.googleads.v6.enums.types import tracking_code_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"TagSnippet",}, -) - - -class TagSnippet(proto.Message): - r"""The site tag and event snippet pair for a TrackingCodeType. - - Attributes: - type_ (google.ads.googleads.v6.enums.types.TrackingCodeTypeEnum.TrackingCodeType): - The type of the generated tag snippets for - tracking conversions. - page_format (google.ads.googleads.v6.enums.types.TrackingCodePageFormatEnum.TrackingCodePageFormat): - The format of the web page where the tracking - tag and snippet will be installed, e.g. HTML. - global_site_tag (str): - The site tag that adds visitors to your basic - remarketing lists and sets new cookies on your - domain. - event_snippet (str): - The event snippet that works with the site - tag to track actions that should be counted as - conversions. - """ - - type_ = proto.Field( - proto.ENUM, - number=1, - enum=tracking_code_type.TrackingCodeTypeEnum.TrackingCodeType, - ) - page_format = proto.Field( - proto.ENUM, - number=2, - enum=tracking_code_page_format.TrackingCodePageFormatEnum.TrackingCodePageFormat, - ) - global_site_tag = proto.Field(proto.STRING, number=5, optional=True) - event_snippet = proto.Field(proto.STRING, number=6, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/targeting_setting.py b/google/ads/googleads/v6/common/types/targeting_setting.py deleted file mode 100644 index 5dfdcf35f..000000000 --- a/google/ads/googleads/v6/common/types/targeting_setting.py +++ /dev/null @@ -1,113 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - targeting_dimension as gage_targeting_dimension, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "TargetingSetting", - "TargetRestriction", - "TargetRestrictionOperation", - }, -) - - -class TargetingSetting(proto.Message): - r"""Settings for the targeting-related features, at the campaign - and ad group levels. For more details about the targeting - setting, visit https://support.google.com/google- - ads/answer/7365594 - - Attributes: - target_restrictions (Sequence[google.ads.googleads.v6.common.types.TargetRestriction]): - The per-targeting-dimension setting to - restrict the reach of your campaign or ad group. - target_restriction_operations (Sequence[google.ads.googleads.v6.common.types.TargetRestrictionOperation]): - The list of operations changing the target - restrictions. - Adding a target restriction with a targeting - dimension that already exists causes the - existing target restriction to be replaced with - the new value. - """ - - target_restrictions = proto.RepeatedField( - proto.MESSAGE, number=1, message="TargetRestriction", - ) - target_restriction_operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="TargetRestrictionOperation", - ) - - -class TargetRestriction(proto.Message): - r"""The list of per-targeting-dimension targeting settings. - - Attributes: - targeting_dimension (google.ads.googleads.v6.enums.types.TargetingDimensionEnum.TargetingDimension): - The targeting dimension that these settings - apply to. - bid_only (bool): - Indicates whether to restrict your ads to show only for the - criteria you have selected for this targeting_dimension, or - to target all values for this targeting_dimension and show - ads based on your targeting in other TargetingDimensions. A - value of ``true`` means that these criteria will only apply - bid modifiers, and not affect targeting. A value of - ``false`` means that these criteria will restrict targeting - as well as applying bid modifiers. - """ - - targeting_dimension = proto.Field( - proto.ENUM, - number=1, - enum=gage_targeting_dimension.TargetingDimensionEnum.TargetingDimension, - ) - bid_only = proto.Field(proto.BOOL, number=3, optional=True) - - -class TargetRestrictionOperation(proto.Message): - r"""Operation to be performed on a target restriction list in a - mutate. - - Attributes: - operator (google.ads.googleads.v6.common.types.TargetRestrictionOperation.Operator): - Type of list operation to perform. - value (google.ads.googleads.v6.common.types.TargetRestriction): - The target restriction being added to or - removed from the list. - """ - - class Operator(proto.Enum): - r"""The operator.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ADD = 2 - REMOVE = 3 - - operator = proto.Field(proto.ENUM, number=1, enum=Operator,) - value = proto.Field(proto.MESSAGE, number=2, message="TargetRestriction",) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/text_label.py b/google/ads/googleads/v6/common/types/text_label.py deleted file mode 100644 index 3e1854c5a..000000000 --- a/google/ads/googleads/v6/common/types/text_label.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"TextLabel",}, -) - - -class TextLabel(proto.Message): - r"""A type of label displaying text on a colored background. - - Attributes: - background_color (str): - Background color of the label in RGB format. This string - must match the regular expression - '^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$'. Note: The background - color may not be visible for manager accounts. - description (str): - A short description of the label. The length - must be no more than 200 characters. - """ - - background_color = proto.Field(proto.STRING, number=3, optional=True) - description = proto.Field(proto.STRING, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/url_collection.py b/google/ads/googleads/v6/common/types/url_collection.py deleted file mode 100644 index 90a58c193..000000000 --- a/google/ads/googleads/v6/common/types/url_collection.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"UrlCollection",}, -) - - -class UrlCollection(proto.Message): - r"""Collection of urls that is tagged with a unique identifier. - - Attributes: - url_collection_id (str): - Unique identifier for this UrlCollection - instance. - final_urls (Sequence[str]): - A list of possible final URLs. - final_mobile_urls (Sequence[str]): - A list of possible final mobile URLs. - tracking_url_template (str): - URL template for constructing a tracking URL. - """ - - url_collection_id = proto.Field(proto.STRING, number=5, optional=True) - final_urls = proto.RepeatedField(proto.STRING, number=6) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=7) - tracking_url_template = proto.Field(proto.STRING, number=8, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/user_lists.py b/google/ads/googleads/v6/common/types/user_lists.py deleted file mode 100644 index 8a45b2dba..000000000 --- a/google/ads/googleads/v6/common/types/user_lists.py +++ /dev/null @@ -1,506 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import customer_match_upload_key_type -from google.ads.googleads.v6.enums.types import user_list_combined_rule_operator -from google.ads.googleads.v6.enums.types import user_list_crm_data_source_type -from google.ads.googleads.v6.enums.types import ( - user_list_date_rule_item_operator, -) -from google.ads.googleads.v6.enums.types import user_list_logical_rule_operator -from google.ads.googleads.v6.enums.types import ( - user_list_number_rule_item_operator, -) -from google.ads.googleads.v6.enums.types import user_list_prepopulation_status -from google.ads.googleads.v6.enums.types import user_list_rule_type -from google.ads.googleads.v6.enums.types import ( - user_list_string_rule_item_operator, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={ - "SimilarUserListInfo", - "CrmBasedUserListInfo", - "UserListRuleInfo", - "UserListRuleItemGroupInfo", - "UserListRuleItemInfo", - "UserListDateRuleItemInfo", - "UserListNumberRuleItemInfo", - "UserListStringRuleItemInfo", - "CombinedRuleUserListInfo", - "DateSpecificRuleUserListInfo", - "ExpressionRuleUserListInfo", - "RuleBasedUserListInfo", - "LogicalUserListInfo", - "UserListLogicalRuleInfo", - "LogicalUserListOperandInfo", - "BasicUserListInfo", - "UserListActionInfo", - }, -) - - -class SimilarUserListInfo(proto.Message): - r"""SimilarUserList is a list of users which are similar to users - from another UserList. These lists are read-only and - automatically created by Google. - - Attributes: - seed_user_list (str): - Seed UserList from which this list is - derived. - """ - - seed_user_list = proto.Field(proto.STRING, number=2, optional=True) - - -class CrmBasedUserListInfo(proto.Message): - r"""UserList of CRM users provided by the advertiser. - - Attributes: - app_id (str): - A string that uniquely identifies a mobile - application from which the data was collected to - the Google Ads API. For iOS, the ID string is - the 9 digit string that appears at the end of an - App Store URL (e.g., "476943146" for "Flood-It! - 2" whose App Store link is - http://itunes.apple.com/us/app/flood- - it!-2/id476943146). For Android, the ID string - is the application's package name (e.g., - "com.labpixies.colordrips" for "Color Drips" - given Google Play link - https://play.google.com/store/apps/details?id=com.labpixies.colordrips). - Required when creating CrmBasedUserList for - uploading mobile advertising IDs. - upload_key_type (google.ads.googleads.v6.enums.types.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType): - Matching key type of the list. - Mixed data types are not allowed on the same - list. This field is required for an ADD - operation. - data_source_type (google.ads.googleads.v6.enums.types.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType): - Data source of the list. Default value is FIRST_PARTY. Only - customers on the allow-list can create third-party sourced - CRM lists. - """ - - app_id = proto.Field(proto.STRING, number=4, optional=True) - upload_key_type = proto.Field( - proto.ENUM, - number=2, - enum=customer_match_upload_key_type.CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType, - ) - data_source_type = proto.Field( - proto.ENUM, - number=3, - enum=user_list_crm_data_source_type.UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType, - ) - - -class UserListRuleInfo(proto.Message): - r"""A client defined rule based on custom parameters sent by web - sites or uploaded by the advertiser. - - Attributes: - rule_type (google.ads.googleads.v6.enums.types.UserListRuleTypeEnum.UserListRuleType): - Rule type is used to determine how to group - rule items. - The default is OR of ANDs (disjunctive normal - form). That is, rule items will be ANDed - together within rule item groups and the groups - themselves will be ORed together. - - Currently AND of ORs (conjunctive normal form) - is only supported for ExpressionRuleUserList. - rule_item_groups (Sequence[google.ads.googleads.v6.common.types.UserListRuleItemGroupInfo]): - List of rule item groups that defines this rule. Rule item - groups are grouped together based on rule_type. - """ - - rule_type = proto.Field( - proto.ENUM, - number=1, - enum=user_list_rule_type.UserListRuleTypeEnum.UserListRuleType, - ) - rule_item_groups = proto.RepeatedField( - proto.MESSAGE, number=2, message="UserListRuleItemGroupInfo", - ) - - -class UserListRuleItemGroupInfo(proto.Message): - r"""A group of rule items. - - Attributes: - rule_items (Sequence[google.ads.googleads.v6.common.types.UserListRuleItemInfo]): - Rule items that will be grouped together based on rule_type. - """ - - rule_items = proto.RepeatedField( - proto.MESSAGE, number=1, message="UserListRuleItemInfo", - ) - - -class UserListRuleItemInfo(proto.Message): - r"""An atomic rule item. - - Attributes: - name (str): - Rule variable name. It should match the corresponding key - name fired by the pixel. A name must begin with US-ascii - letters or underscore or UTF8 code that is greater than 127 - and consist of US-ascii letters or digits or underscore or - UTF8 code that is greater than 127. For websites, there are - two built-in variable URL (name = 'url__') and referrer URL - (name = 'ref_url__'). This field must be populated when - creating a new rule item. - number_rule_item (google.ads.googleads.v6.common.types.UserListNumberRuleItemInfo): - An atomic rule item composed of a number - operation. - string_rule_item (google.ads.googleads.v6.common.types.UserListStringRuleItemInfo): - An atomic rule item composed of a string - operation. - date_rule_item (google.ads.googleads.v6.common.types.UserListDateRuleItemInfo): - An atomic rule item composed of a date - operation. - """ - - name = proto.Field(proto.STRING, number=5, optional=True) - number_rule_item = proto.Field( - proto.MESSAGE, - number=2, - oneof="rule_item", - message="UserListNumberRuleItemInfo", - ) - string_rule_item = proto.Field( - proto.MESSAGE, - number=3, - oneof="rule_item", - message="UserListStringRuleItemInfo", - ) - date_rule_item = proto.Field( - proto.MESSAGE, - number=4, - oneof="rule_item", - message="UserListDateRuleItemInfo", - ) - - -class UserListDateRuleItemInfo(proto.Message): - r"""A rule item composed of a date operation. - - Attributes: - operator (google.ads.googleads.v6.enums.types.UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator): - Date comparison operator. - This field is required and must be populated - when creating new date rule item. - value (str): - String representing date value to be compared - with the rule variable. Supported date format is - YYYY-MM-DD. Times are reported in the customer's - time zone. - offset_in_days (int): - The relative date value of the right hand - side denoted by number of days offset from now. - The value field will override this field when - both are present. - """ - - operator = proto.Field( - proto.ENUM, - number=1, - enum=user_list_date_rule_item_operator.UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator, - ) - value = proto.Field(proto.STRING, number=4, optional=True) - offset_in_days = proto.Field(proto.INT64, number=5, optional=True) - - -class UserListNumberRuleItemInfo(proto.Message): - r"""A rule item composed of a number operation. - - Attributes: - operator (google.ads.googleads.v6.enums.types.UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator): - Number comparison operator. - This field is required and must be populated - when creating a new number rule item. - value (float): - Number value to be compared with the - variable. This field is required and must be - populated when creating a new number rule item. - """ - - operator = proto.Field( - proto.ENUM, - number=1, - enum=user_list_number_rule_item_operator.UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator, - ) - value = proto.Field(proto.DOUBLE, number=3, optional=True) - - -class UserListStringRuleItemInfo(proto.Message): - r"""A rule item composed of a string operation. - - Attributes: - operator (google.ads.googleads.v6.enums.types.UserListStringRuleItemOperatorEnum.UserListStringRuleItemOperator): - String comparison operator. - This field is required and must be populated - when creating a new string rule item. - value (str): - The right hand side of the string rule item. - For URLs or referrer URLs, the value can not - contain illegal URL chars such as newlines, - quotes, tabs, or parentheses. This field is - required and must be populated when creating a - new string rule item. - """ - - operator = proto.Field( - proto.ENUM, - number=1, - enum=user_list_string_rule_item_operator.UserListStringRuleItemOperatorEnum.UserListStringRuleItemOperator, - ) - value = proto.Field(proto.STRING, number=3, optional=True) - - -class CombinedRuleUserListInfo(proto.Message): - r"""User lists defined by combining two rules, left operand and right - operand. There are two operators: AND where left operand and right - operand have to be true; AND_NOT where left operand is true but - right operand is false. - - Attributes: - left_operand (google.ads.googleads.v6.common.types.UserListRuleInfo): - Left operand of the combined rule. - This field is required and must be populated - when creating new combined rule based user list. - right_operand (google.ads.googleads.v6.common.types.UserListRuleInfo): - Right operand of the combined rule. - This field is required and must be populated - when creating new combined rule based user list. - rule_operator (google.ads.googleads.v6.enums.types.UserListCombinedRuleOperatorEnum.UserListCombinedRuleOperator): - Operator to connect the two operands. - Required for creating a combined rule user list. - """ - - left_operand = proto.Field( - proto.MESSAGE, number=1, message="UserListRuleInfo", - ) - right_operand = proto.Field( - proto.MESSAGE, number=2, message="UserListRuleInfo", - ) - rule_operator = proto.Field( - proto.ENUM, - number=3, - enum=user_list_combined_rule_operator.UserListCombinedRuleOperatorEnum.UserListCombinedRuleOperator, - ) - - -class DateSpecificRuleUserListInfo(proto.Message): - r"""Visitors of a page during specific dates. - - Attributes: - rule (google.ads.googleads.v6.common.types.UserListRuleInfo): - Boolean rule that defines visitor of a page. - Required for creating a date specific rule user - list. - start_date (str): - Start date of users visit. If set to 2000-01-01, then the - list includes all users before end_date. The date's format - should be YYYY-MM-DD. - - Required for creating a data specific rule user list. - end_date (str): - Last date of users visit. If set to 2037-12-30, then the - list includes all users after start_date. The date's format - should be YYYY-MM-DD. - - Required for creating a data specific rule user list. - """ - - rule = proto.Field(proto.MESSAGE, number=1, message="UserListRuleInfo",) - start_date = proto.Field(proto.STRING, number=4, optional=True) - end_date = proto.Field(proto.STRING, number=5, optional=True) - - -class ExpressionRuleUserListInfo(proto.Message): - r"""Visitors of a page. The page visit is defined by one boolean - rule expression. - - Attributes: - rule (google.ads.googleads.v6.common.types.UserListRuleInfo): - Boolean rule that defines this user list. The rule consists - of a list of rule item groups and each rule item group - consists of a list of rule items. All the rule item groups - are ORed or ANDed together for evaluation based on - rule.rule_type. - - Required for creating an expression rule user list. - """ - - rule = proto.Field(proto.MESSAGE, number=1, message="UserListRuleInfo",) - - -class RuleBasedUserListInfo(proto.Message): - r"""Representation of a userlist that is generated by a rule. - - Attributes: - prepopulation_status (google.ads.googleads.v6.enums.types.UserListPrepopulationStatusEnum.UserListPrepopulationStatus): - The status of pre-population. The field is - default to NONE if not set which means the - previous users will not be considered. If set to - REQUESTED, past site visitors or app users who - match the list definition will be included in - the list (works on the Display Network only). - This will only add past users from within the - last 30 days, depending on the list's membership - duration and the date when the remarketing tag - is added. The status will be updated to FINISHED - once request is processed, or FAILED if the - request fails. - combined_rule_user_list (google.ads.googleads.v6.common.types.CombinedRuleUserListInfo): - User lists defined by combining two rules. There are two - operators: AND, where the left and right operands have to be - true; AND_NOT where left operand is true but right operand - is false. - date_specific_rule_user_list (google.ads.googleads.v6.common.types.DateSpecificRuleUserListInfo): - Visitors of a page during specific dates. The visiting - periods are defined as follows: Between start_date - (inclusive) and end_date (inclusive); Before end_date - (exclusive) with start_date = 2000-01-01; After start_date - (exclusive) with end_date = 2037-12-30. - expression_rule_user_list (google.ads.googleads.v6.common.types.ExpressionRuleUserListInfo): - Visitors of a page. The page visit is defined - by one boolean rule expression. - """ - - prepopulation_status = proto.Field( - proto.ENUM, - number=1, - enum=user_list_prepopulation_status.UserListPrepopulationStatusEnum.UserListPrepopulationStatus, - ) - combined_rule_user_list = proto.Field( - proto.MESSAGE, - number=2, - oneof="rule_based_user_list", - message="CombinedRuleUserListInfo", - ) - date_specific_rule_user_list = proto.Field( - proto.MESSAGE, - number=3, - oneof="rule_based_user_list", - message="DateSpecificRuleUserListInfo", - ) - expression_rule_user_list = proto.Field( - proto.MESSAGE, - number=4, - oneof="rule_based_user_list", - message="ExpressionRuleUserListInfo", - ) - - -class LogicalUserListInfo(proto.Message): - r"""Represents a user list that is a custom combination of user - lists. - - Attributes: - rules (Sequence[google.ads.googleads.v6.common.types.UserListLogicalRuleInfo]): - Logical list rules that define this user - list. The rules are defined as a logical - operator (ALL/ANY/NONE) and a list of user - lists. All the rules are ANDed when they are - evaluated. - - Required for creating a logical user list. - """ - - rules = proto.RepeatedField( - proto.MESSAGE, number=1, message="UserListLogicalRuleInfo", - ) - - -class UserListLogicalRuleInfo(proto.Message): - r"""A user list logical rule. A rule has a logical operator - (and/or/not) and a list of user lists as operands. - - Attributes: - operator (google.ads.googleads.v6.enums.types.UserListLogicalRuleOperatorEnum.UserListLogicalRuleOperator): - The logical operator of the rule. - rule_operands (Sequence[google.ads.googleads.v6.common.types.LogicalUserListOperandInfo]): - The list of operands of the rule. - """ - - operator = proto.Field( - proto.ENUM, - number=1, - enum=user_list_logical_rule_operator.UserListLogicalRuleOperatorEnum.UserListLogicalRuleOperator, - ) - rule_operands = proto.RepeatedField( - proto.MESSAGE, number=2, message="LogicalUserListOperandInfo", - ) - - -class LogicalUserListOperandInfo(proto.Message): - r"""Operand of logical user list that consists of a user list. - - Attributes: - user_list (str): - Resource name of a user list as an operand. - """ - - user_list = proto.Field(proto.STRING, number=2, optional=True) - - -class BasicUserListInfo(proto.Message): - r"""User list targeting as a collection of conversions or - remarketing actions. - - Attributes: - actions (Sequence[google.ads.googleads.v6.common.types.UserListActionInfo]): - Actions associated with this user list. - """ - - actions = proto.RepeatedField( - proto.MESSAGE, number=1, message="UserListActionInfo", - ) - - -class UserListActionInfo(proto.Message): - r"""Represents an action type used for building remarketing user - lists. - - Attributes: - conversion_action (str): - A conversion action that's not generated from - remarketing. - remarketing_action (str): - A remarketing action. - """ - - conversion_action = proto.Field( - proto.STRING, number=3, oneof="user_list_action" - ) - remarketing_action = proto.Field( - proto.STRING, number=4, oneof="user_list_action" - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/common/types/value.py b/google/ads/googleads/v6/common/types/value.py deleted file mode 100644 index da89c68b5..000000000 --- a/google/ads/googleads/v6/common/types/value.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.common", - marshal="google.ads.googleads.v6", - manifest={"Value",}, -) - - -class Value(proto.Message): - r"""A generic data container. - - Attributes: - boolean_value (bool): - A boolean. - int64_value (int): - An int64. - float_value (float): - A float. - double_value (float): - A double. - string_value (str): - A string. - """ - - boolean_value = proto.Field(proto.BOOL, number=1, oneof="value") - int64_value = proto.Field(proto.INT64, number=2, oneof="value") - float_value = proto.Field(proto.FLOAT, number=3, oneof="value") - double_value = proto.Field(proto.DOUBLE, number=4, oneof="value") - string_value = proto.Field(proto.STRING, number=5, oneof="value") - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/__init__.py b/google/ads/googleads/v6/enums/__init__.py deleted file mode 100644 index 03c04fb10..000000000 --- a/google/ads/googleads/v6/enums/__init__.py +++ /dev/null @@ -1,264 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - - -__all__ = ( - "AccessInvitationStatusEnum", - "AccessReasonEnum", - "AccessRoleEnum", - "AccountBudgetProposalStatusEnum", - "AccountBudgetProposalTypeEnum", - "AccountBudgetStatusEnum", - "AccountLinkStatusEnum", - "AdCustomizerPlaceholderFieldEnum", - "AdDestinationTypeEnum", - "AdGroupAdRotationModeEnum", - "AdGroupAdStatusEnum", - "AdGroupCriterionApprovalStatusEnum", - "AdGroupCriterionStatusEnum", - "AdGroupStatusEnum", - "AdGroupTypeEnum", - "AdNetworkTypeEnum", - "AdServingOptimizationStatusEnum", - "AdStrengthEnum", - "AdTypeEnum", - "AdvertisingChannelSubTypeEnum", - "AdvertisingChannelTypeEnum", - "AffiliateLocationFeedRelationshipTypeEnum", - "AffiliateLocationPlaceholderFieldEnum", - "AgeRangeTypeEnum", - "AppCampaignAppStoreEnum", - "AppCampaignBiddingStrategyGoalTypeEnum", - "AppPaymentModelTypeEnum", - "AppPlaceholderFieldEnum", - "AppStoreEnum", - "AppUrlOperatingSystemTypeEnum", - "AssetFieldTypeEnum", - "AssetLinkStatusEnum", - "AssetPerformanceLabelEnum", - "AssetTypeEnum", - "AttributionModelEnum", - "BatchJobStatusEnum", - "BidModifierSourceEnum", - "BiddingSourceEnum", - "BiddingStrategyStatusEnum", - "BiddingStrategyTypeEnum", - "BillingSetupStatusEnum", - "BrandSafetySuitabilityEnum", - "BudgetCampaignAssociationStatusEnum", - "BudgetDeliveryMethodEnum", - "BudgetPeriodEnum", - "BudgetStatusEnum", - "BudgetTypeEnum", - "CallConversionReportingStateEnum", - "CallPlaceholderFieldEnum", - "CallTrackingDisplayLocationEnum", - "CallTypeEnum", - "CalloutPlaceholderFieldEnum", - "CampaignCriterionStatusEnum", - "CampaignDraftStatusEnum", - "CampaignExperimentStatusEnum", - "CampaignExperimentTrafficSplitTypeEnum", - "CampaignExperimentTypeEnum", - "CampaignServingStatusEnum", - "CampaignSharedSetStatusEnum", - "CampaignStatusEnum", - "ChangeClientTypeEnum", - "ChangeEventResourceTypeEnum", - "ChangeStatusOperationEnum", - "ChangeStatusResourceTypeEnum", - "ClickTypeEnum", - "CombinedAudienceStatusEnum", - "ContentLabelTypeEnum", - "ConversionActionCategoryEnum", - "ConversionActionCountingTypeEnum", - "ConversionActionStatusEnum", - "ConversionActionTypeEnum", - "ConversionAdjustmentTypeEnum", - "ConversionAttributionEventTypeEnum", - "ConversionLagBucketEnum", - "ConversionOrAdjustmentLagBucketEnum", - "CriterionCategoryChannelAvailabilityModeEnum", - "CriterionCategoryLocaleAvailabilityModeEnum", - "CriterionSystemServingStatusEnum", - "CriterionTypeEnum", - "CustomAudienceMemberTypeEnum", - "CustomAudienceStatusEnum", - "CustomAudienceTypeEnum", - "CustomInterestMemberTypeEnum", - "CustomInterestStatusEnum", - "CustomInterestTypeEnum", - "CustomPlaceholderFieldEnum", - "CustomerMatchUploadKeyTypeEnum", - "CustomerPayPerConversionEligibilityFailureReasonEnum", - "DataDrivenModelStatusEnum", - "DayOfWeekEnum", - "DeviceEnum", - "DisplayAdFormatSettingEnum", - "DisplayUploadProductTypeEnum", - "DistanceBucketEnum", - "DsaPageFeedCriterionFieldEnum", - "EducationPlaceholderFieldEnum", - "ExtensionSettingDeviceEnum", - "ExtensionTypeEnum", - "ExternalConversionSourceEnum", - "FeedAttributeTypeEnum", - "FeedItemQualityApprovalStatusEnum", - "FeedItemQualityDisapprovalReasonEnum", - "FeedItemSetStatusEnum", - "FeedItemSetStringFilterTypeEnum", - "FeedItemStatusEnum", - "FeedItemTargetDeviceEnum", - "FeedItemTargetStatusEnum", - "FeedItemTargetTypeEnum", - "FeedItemValidationStatusEnum", - "FeedLinkStatusEnum", - "FeedMappingCriterionTypeEnum", - "FeedMappingStatusEnum", - "FeedOriginEnum", - "FeedStatusEnum", - "FlightPlaceholderFieldEnum", - "FrequencyCapEventTypeEnum", - "FrequencyCapLevelEnum", - "FrequencyCapTimeUnitEnum", - "GenderTypeEnum", - "GeoTargetConstantStatusEnum", - "GeoTargetingRestrictionEnum", - "GeoTargetingTypeEnum", - "GoogleAdsFieldCategoryEnum", - "GoogleAdsFieldDataTypeEnum", - "GoogleVoiceCallStatusEnum", - "HotelDateSelectionTypeEnum", - "HotelPlaceholderFieldEnum", - "HotelPriceBucketEnum", - "HotelRateTypeEnum", - "ImagePlaceholderFieldEnum", - "IncomeRangeTypeEnum", - "InteractionEventTypeEnum", - "InteractionTypeEnum", - "InvoiceTypeEnum", - "JobPlaceholderFieldEnum", - "KeywordMatchTypeEnum", - "KeywordPlanCompetitionLevelEnum", - "KeywordPlanForecastIntervalEnum", - "KeywordPlanNetworkEnum", - "LabelStatusEnum", - "LeadFormCallToActionTypeEnum", - "LeadFormDesiredIntentEnum", - "LeadFormFieldUserInputTypeEnum", - "LeadFormPostSubmitCallToActionTypeEnum", - "LegacyAppInstallAdAppStoreEnum", - "LinkedAccountTypeEnum", - "ListingGroupTypeEnum", - "LocalPlaceholderFieldEnum", - "LocationExtensionTargetingCriterionFieldEnum", - "LocationGroupRadiusUnitsEnum", - "LocationPlaceholderFieldEnum", - "LocationSourceTypeEnum", - "ManagerLinkStatusEnum", - "MatchingFunctionContextTypeEnum", - "MatchingFunctionOperatorEnum", - "MediaTypeEnum", - "MerchantCenterLinkStatusEnum", - "MessagePlaceholderFieldEnum", - "MimeTypeEnum", - "MinuteOfHourEnum", - "MobileAppVendorEnum", - "MobileDeviceTypeEnum", - "MonthOfYearEnum", - "NegativeGeoTargetTypeEnum", - "OfflineUserDataJobFailureReasonEnum", - "OfflineUserDataJobStatusEnum", - "OfflineUserDataJobTypeEnum", - "OperatingSystemVersionOperatorTypeEnum", - "OptimizationGoalTypeEnum", - "ParentalStatusTypeEnum", - "PaymentModeEnum", - "PlaceholderTypeEnum", - "PlacementTypeEnum", - "PolicyApprovalStatusEnum", - "PolicyReviewStatusEnum", - "PolicyTopicEvidenceDestinationMismatchUrlTypeEnum", - "PolicyTopicEvidenceDestinationNotWorkingDeviceEnum", - "PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum", - "PositiveGeoTargetTypeEnum", - "PreferredContentTypeEnum", - "PriceExtensionPriceQualifierEnum", - "PriceExtensionPriceUnitEnum", - "PriceExtensionTypeEnum", - "PricePlaceholderFieldEnum", - "ProductBiddingCategoryLevelEnum", - "ProductBiddingCategoryStatusEnum", - "ProductChannelEnum", - "ProductChannelExclusivityEnum", - "ProductConditionEnum", - "ProductCustomAttributeIndexEnum", - "ProductTypeLevelEnum", - "PromotionExtensionDiscountModifierEnum", - "PromotionExtensionOccasionEnum", - "PromotionPlaceholderFieldEnum", - "ProximityRadiusUnitsEnum", - "QualityScoreBucketEnum", - "ReachPlanAdLengthEnum", - "ReachPlanAgeRangeEnum", - "ReachPlanNetworkEnum", - "RealEstatePlaceholderFieldEnum", - "RecommendationTypeEnum", - "ResourceChangeOperationEnum", - "ResponseContentTypeEnum", - "SearchEngineResultsPageTypeEnum", - "SearchTermMatchTypeEnum", - "SearchTermTargetingStatusEnum", - "ServedAssetFieldTypeEnum", - "SharedSetStatusEnum", - "SharedSetTypeEnum", - "SimulationModificationMethodEnum", - "SimulationTypeEnum", - "SitelinkPlaceholderFieldEnum", - "SlotEnum", - "SpendingLimitTypeEnum", - "StructuredSnippetPlaceholderFieldEnum", - "SummaryRowSettingEnum", - "SystemManagedResourceSourceEnum", - "TargetCpaOptInRecommendationGoalEnum", - "TargetImpressionShareLocationEnum", - "TargetingDimensionEnum", - "TimeTypeEnum", - "TrackingCodePageFormatEnum", - "TrackingCodeTypeEnum", - "TravelPlaceholderFieldEnum", - "UserIdentifierSourceEnum", - "UserInterestTaxonomyTypeEnum", - "UserListAccessStatusEnum", - "UserListClosingReasonEnum", - "UserListCombinedRuleOperatorEnum", - "UserListCrmDataSourceTypeEnum", - "UserListDateRuleItemOperatorEnum", - "UserListLogicalRuleOperatorEnum", - "UserListMembershipStatusEnum", - "UserListNumberRuleItemOperatorEnum", - "UserListPrepopulationStatusEnum", - "UserListRuleTypeEnum", - "UserListSizeRangeEnum", - "UserListStringRuleItemOperatorEnum", - "UserListTypeEnum", - "VanityPharmaDisplayUrlModeEnum", - "VanityPharmaTextEnum", - "WebpageConditionOperandEnum", - "WebpageConditionOperatorEnum", - "PolicyTopicEntryTypeEnum", -) diff --git a/google/ads/googleads/v6/enums/types/access_invitation_status.py b/google/ads/googleads/v6/enums/types/access_invitation_status.py deleted file mode 100644 index 2e2b201e3..000000000 --- a/google/ads/googleads/v6/enums/types/access_invitation_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccessInvitationStatusEnum",}, -) - - -class AccessInvitationStatusEnum(proto.Message): - r"""Container for enum for identifying the status of access - invitation - """ - - class AccessInvitationStatus(proto.Enum): - r"""Possible access invitation status of a user""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - DECLINED = 3 - EXPIRED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/access_reason.py b/google/ads/googleads/v6/enums/types/access_reason.py deleted file mode 100644 index 96392ee07..000000000 --- a/google/ads/googleads/v6/enums/types/access_reason.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccessReasonEnum",}, -) - - -class AccessReasonEnum(proto.Message): - r"""Indicates the way the resource such as user list is related - to a user. - """ - - class AccessReason(proto.Enum): - r"""Enum describing possible access reasons.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OWNED = 2 - SHARED = 3 - LICENSED = 4 - SUBSCRIBED = 5 - AFFILIATED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/access_role.py b/google/ads/googleads/v6/enums/types/access_role.py deleted file mode 100644 index f36a23be2..000000000 --- a/google/ads/googleads/v6/enums/types/access_role.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccessRoleEnum",}, -) - - -class AccessRoleEnum(proto.Message): - r"""Container for enum describing possible access role for user.""" - - class AccessRole(proto.Enum): - r"""Possible access role of a user.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ADMIN = 2 - STANDARD = 3 - READ_ONLY = 4 - EMAIL_ONLY = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/account_budget_proposal_status.py b/google/ads/googleads/v6/enums/types/account_budget_proposal_status.py deleted file mode 100644 index 0ccf5180f..000000000 --- a/google/ads/googleads/v6/enums/types/account_budget_proposal_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccountBudgetProposalStatusEnum",}, -) - - -class AccountBudgetProposalStatusEnum(proto.Message): - r"""Message describing AccountBudgetProposal statuses.""" - - class AccountBudgetProposalStatus(proto.Enum): - r"""The possible statuses of an AccountBudgetProposal.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - APPROVED_HELD = 3 - APPROVED = 4 - CANCELLED = 5 - REJECTED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/account_budget_proposal_type.py b/google/ads/googleads/v6/enums/types/account_budget_proposal_type.py deleted file mode 100644 index 397fb8cee..000000000 --- a/google/ads/googleads/v6/enums/types/account_budget_proposal_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccountBudgetProposalTypeEnum",}, -) - - -class AccountBudgetProposalTypeEnum(proto.Message): - r"""Message describing AccountBudgetProposal types.""" - - class AccountBudgetProposalType(proto.Enum): - r"""The possible types of an AccountBudgetProposal.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CREATE = 2 - UPDATE = 3 - END = 4 - REMOVE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/account_budget_status.py b/google/ads/googleads/v6/enums/types/account_budget_status.py deleted file mode 100644 index 32c8ce7e8..000000000 --- a/google/ads/googleads/v6/enums/types/account_budget_status.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccountBudgetStatusEnum",}, -) - - -class AccountBudgetStatusEnum(proto.Message): - r"""Message describing AccountBudget statuses.""" - - class AccountBudgetStatus(proto.Enum): - r"""The possible statuses of an AccountBudget.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - APPROVED = 3 - CANCELLED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/account_link_status.py b/google/ads/googleads/v6/enums/types/account_link_status.py deleted file mode 100644 index 5bf52398b..000000000 --- a/google/ads/googleads/v6/enums/types/account_link_status.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AccountLinkStatusEnum",}, -) - - -class AccountLinkStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of an account - link. - """ - - class AccountLinkStatus(proto.Enum): - r"""Describes the possible statuses for a link between a Google - Ads customer and another account. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - REQUESTED = 4 - PENDING_APPROVAL = 5 - REJECTED = 6 - REVOKED = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_customizer_placeholder_field.py b/google/ads/googleads/v6/enums/types/ad_customizer_placeholder_field.py deleted file mode 100644 index 74e4c2559..000000000 --- a/google/ads/googleads/v6/enums/types/ad_customizer_placeholder_field.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdCustomizerPlaceholderFieldEnum",}, -) - - -class AdCustomizerPlaceholderFieldEnum(proto.Message): - r"""Values for Ad Customizer placeholder fields.""" - - class AdCustomizerPlaceholderField(proto.Enum): - r"""Possible values for Ad Customizers placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INTEGER = 2 - PRICE = 3 - DATE = 4 - STRING = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_destination_type.py b/google/ads/googleads/v6/enums/types/ad_destination_type.py deleted file mode 100644 index a7fa90d2a..000000000 --- a/google/ads/googleads/v6/enums/types/ad_destination_type.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdDestinationTypeEnum",}, -) - - -class AdDestinationTypeEnum(proto.Message): - r"""Container for enumeration of Google Ads destination types.""" - - class AdDestinationType(proto.Enum): - r"""Enumerates Google Ads destination types""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NOT_APPLICABLE = 2 - WEBSITE = 3 - APP_DEEP_LINK = 4 - APP_STORE = 5 - PHONE_CALL = 6 - MAP_DIRECTIONS = 7 - LOCATION_LISTING = 8 - MESSAGE = 9 - LEAD_FORM = 10 - YOUTUBE = 11 - UNMODELED_FOR_CONVERSIONS = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_ad_rotation_mode.py b/google/ads/googleads/v6/enums/types/ad_group_ad_rotation_mode.py deleted file mode 100644 index 70003be47..000000000 --- a/google/ads/googleads/v6/enums/types/ad_group_ad_rotation_mode.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAdRotationModeEnum",}, -) - - -class AdGroupAdRotationModeEnum(proto.Message): - r"""Container for enum describing possible ad rotation modes of - ads within an ad group. - """ - - class AdGroupAdRotationMode(proto.Enum): - r"""The possible ad rotation modes of an ad group.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPTIMIZE = 2 - ROTATE_FOREVER = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_criterion_approval_status.py b/google/ads/googleads/v6/enums/types/ad_group_criterion_approval_status.py deleted file mode 100644 index 1fe1269c4..000000000 --- a/google/ads/googleads/v6/enums/types/ad_group_criterion_approval_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterionApprovalStatusEnum",}, -) - - -class AdGroupCriterionApprovalStatusEnum(proto.Message): - r"""Container for enum describing possible AdGroupCriterion - approval statuses. - """ - - class AdGroupCriterionApprovalStatus(proto.Enum): - r"""Enumerates AdGroupCriterion approval statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APPROVED = 2 - DISAPPROVED = 3 - PENDING_REVIEW = 4 - UNDER_REVIEW = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_criterion_status.py b/google/ads/googleads/v6/enums/types/ad_group_criterion_status.py deleted file mode 100644 index 74f17b816..000000000 --- a/google/ads/googleads/v6/enums/types/ad_group_criterion_status.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterionStatusEnum",}, -) - - -class AdGroupCriterionStatusEnum(proto.Message): - r"""Message describing AdGroupCriterion statuses.""" - - class AdGroupCriterionStatus(proto.Enum): - r"""The possible statuses of an AdGroupCriterion.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - PAUSED = 3 - REMOVED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_status.py b/google/ads/googleads/v6/enums/types/ad_group_status.py deleted file mode 100644 index 40ac975b2..000000000 --- a/google/ads/googleads/v6/enums/types/ad_group_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupStatusEnum",}, -) - - -class AdGroupStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of an ad - group. - """ - - class AdGroupStatus(proto.Enum): - r"""The possible statuses of an ad group.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - PAUSED = 3 - REMOVED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_type.py b/google/ads/googleads/v6/enums/types/ad_group_type.py deleted file mode 100644 index 62187dee7..000000000 --- a/google/ads/googleads/v6/enums/types/ad_group_type.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupTypeEnum",}, -) - - -class AdGroupTypeEnum(proto.Message): - r"""Defines types of an ad group, specific to a particular - campaign channel type. This type drives validations that - restrict which entities can be added to the ad group. - """ - - class AdGroupType(proto.Enum): - r"""Enum listing the possible types of an ad group.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SEARCH_STANDARD = 2 - DISPLAY_STANDARD = 3 - SHOPPING_PRODUCT_ADS = 4 - HOTEL_ADS = 6 - SHOPPING_SMART_ADS = 7 - VIDEO_BUMPER = 8 - VIDEO_TRUE_VIEW_IN_STREAM = 9 - VIDEO_TRUE_VIEW_IN_DISPLAY = 10 - VIDEO_NON_SKIPPABLE_IN_STREAM = 11 - VIDEO_OUTSTREAM = 12 - SEARCH_DYNAMIC_ADS = 13 - SHOPPING_COMPARISON_LISTING_ADS = 14 - PROMOTED_HOTEL_ADS = 15 - VIDEO_RESPONSIVE = 16 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_network_type.py b/google/ads/googleads/v6/enums/types/ad_network_type.py deleted file mode 100644 index 6f134af04..000000000 --- a/google/ads/googleads/v6/enums/types/ad_network_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdNetworkTypeEnum",}, -) - - -class AdNetworkTypeEnum(proto.Message): - r"""Container for enumeration of Google Ads network types.""" - - class AdNetworkType(proto.Enum): - r"""Enumerates Google Ads network types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SEARCH = 2 - SEARCH_PARTNERS = 3 - CONTENT = 4 - YOUTUBE_SEARCH = 5 - YOUTUBE_WATCH = 6 - MIXED = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_serving_optimization_status.py b/google/ads/googleads/v6/enums/types/ad_serving_optimization_status.py deleted file mode 100644 index 6f3950110..000000000 --- a/google/ads/googleads/v6/enums/types/ad_serving_optimization_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdServingOptimizationStatusEnum",}, -) - - -class AdServingOptimizationStatusEnum(proto.Message): - r"""Possible ad serving statuses of a campaign.""" - - class AdServingOptimizationStatus(proto.Enum): - r"""Enum describing possible serving statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPTIMIZE = 2 - CONVERSION_OPTIMIZE = 3 - ROTATE = 4 - ROTATE_INDEFINITELY = 5 - UNAVAILABLE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_strength.py b/google/ads/googleads/v6/enums/types/ad_strength.py deleted file mode 100644 index 047c5e85b..000000000 --- a/google/ads/googleads/v6/enums/types/ad_strength.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdStrengthEnum",}, -) - - -class AdStrengthEnum(proto.Message): - r"""Container for enum describing possible ad strengths.""" - - class AdStrength(proto.Enum): - r"""Enum listing the possible ad strengths.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - NO_ADS = 3 - POOR = 4 - AVERAGE = 5 - GOOD = 6 - EXCELLENT = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_type.py b/google/ads/googleads/v6/enums/types/ad_type.py deleted file mode 100644 index 9ea75df7f..000000000 --- a/google/ads/googleads/v6/enums/types/ad_type.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdTypeEnum",}, -) - - -class AdTypeEnum(proto.Message): - r"""Container for enum describing possible types of an ad.""" - - class AdType(proto.Enum): - r"""The possible types of an ad.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TEXT_AD = 2 - EXPANDED_TEXT_AD = 3 - CALL_ONLY_AD = 6 - EXPANDED_DYNAMIC_SEARCH_AD = 7 - HOTEL_AD = 8 - SHOPPING_SMART_AD = 9 - SHOPPING_PRODUCT_AD = 10 - VIDEO_AD = 12 - GMAIL_AD = 13 - IMAGE_AD = 14 - RESPONSIVE_SEARCH_AD = 15 - LEGACY_RESPONSIVE_DISPLAY_AD = 16 - APP_AD = 17 - LEGACY_APP_INSTALL_AD = 18 - RESPONSIVE_DISPLAY_AD = 19 - LOCAL_AD = 20 - HTML5_UPLOAD_AD = 21 - DYNAMIC_HTML5_AD = 22 - APP_ENGAGEMENT_AD = 23 - SHOPPING_COMPARISON_LISTING_AD = 24 - VIDEO_BUMPER_AD = 25 - VIDEO_NON_SKIPPABLE_IN_STREAM_AD = 26 - VIDEO_OUTSTREAM_AD = 27 - VIDEO_TRUEVIEW_DISCOVERY_AD = 28 - VIDEO_TRUEVIEW_IN_STREAM_AD = 29 - VIDEO_RESPONSIVE_AD = 30 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/advertising_channel_sub_type.py b/google/ads/googleads/v6/enums/types/advertising_channel_sub_type.py deleted file mode 100644 index d2128e4c9..000000000 --- a/google/ads/googleads/v6/enums/types/advertising_channel_sub_type.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdvertisingChannelSubTypeEnum",}, -) - - -class AdvertisingChannelSubTypeEnum(proto.Message): - r"""An immutable specialization of an Advertising Channel.""" - - class AdvertisingChannelSubType(proto.Enum): - r"""Enum describing the different channel subtypes.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SEARCH_MOBILE_APP = 2 - DISPLAY_MOBILE_APP = 3 - SEARCH_EXPRESS = 4 - DISPLAY_EXPRESS = 5 - SHOPPING_SMART_ADS = 6 - DISPLAY_GMAIL_AD = 7 - DISPLAY_SMART_CAMPAIGN = 8 - VIDEO_OUTSTREAM = 9 - VIDEO_ACTION = 10 - VIDEO_NON_SKIPPABLE = 11 - APP_CAMPAIGN = 12 - APP_CAMPAIGN_FOR_ENGAGEMENT = 13 - LOCAL_CAMPAIGN = 14 - SHOPPING_COMPARISON_LISTING_ADS = 15 - SMART_CAMPAIGN = 16 - VIDEO_SEQUENCE = 17 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/advertising_channel_type.py b/google/ads/googleads/v6/enums/types/advertising_channel_type.py deleted file mode 100644 index 2ae2d9296..000000000 --- a/google/ads/googleads/v6/enums/types/advertising_channel_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdvertisingChannelTypeEnum",}, -) - - -class AdvertisingChannelTypeEnum(proto.Message): - r"""The channel type a campaign may target to serve on.""" - - class AdvertisingChannelType(proto.Enum): - r"""Enum describing the various advertising channel types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SEARCH = 2 - DISPLAY = 3 - SHOPPING = 4 - HOTEL = 5 - VIDEO = 6 - MULTI_CHANNEL = 7 - LOCAL = 8 - SMART = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/affiliate_location_feed_relationship_type.py b/google/ads/googleads/v6/enums/types/affiliate_location_feed_relationship_type.py deleted file mode 100644 index a87edd8ce..000000000 --- a/google/ads/googleads/v6/enums/types/affiliate_location_feed_relationship_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AffiliateLocationFeedRelationshipTypeEnum",}, -) - - -class AffiliateLocationFeedRelationshipTypeEnum(proto.Message): - r"""Container for enum describing possible values for a - relationship type for an affiliate location feed. - """ - - class AffiliateLocationFeedRelationshipType(proto.Enum): - r"""Possible values for a relationship type for an affiliate - location feed. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - GENERAL_RETAILER = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/affiliate_location_placeholder_field.py b/google/ads/googleads/v6/enums/types/affiliate_location_placeholder_field.py deleted file mode 100644 index dc29abe52..000000000 --- a/google/ads/googleads/v6/enums/types/affiliate_location_placeholder_field.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AffiliateLocationPlaceholderFieldEnum",}, -) - - -class AffiliateLocationPlaceholderFieldEnum(proto.Message): - r"""Values for Affiliate Location placeholder fields.""" - - class AffiliateLocationPlaceholderField(proto.Enum): - r"""Possible values for Affiliate Location placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BUSINESS_NAME = 2 - ADDRESS_LINE_1 = 3 - ADDRESS_LINE_2 = 4 - CITY = 5 - PROVINCE = 6 - POSTAL_CODE = 7 - COUNTRY_CODE = 8 - PHONE_NUMBER = 9 - LANGUAGE_CODE = 10 - CHAIN_ID = 11 - CHAIN_NAME = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/age_range_type.py b/google/ads/googleads/v6/enums/types/age_range_type.py deleted file mode 100644 index f809f1927..000000000 --- a/google/ads/googleads/v6/enums/types/age_range_type.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AgeRangeTypeEnum",}, -) - - -class AgeRangeTypeEnum(proto.Message): - r"""Container for enum describing the type of demographic age - ranges. - """ - - class AgeRangeType(proto.Enum): - r"""The type of demographic age ranges (e.g. between 18 and 24 - years old). - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - AGE_RANGE_18_24 = 503001 - AGE_RANGE_25_34 = 503002 - AGE_RANGE_35_44 = 503003 - AGE_RANGE_45_54 = 503004 - AGE_RANGE_55_64 = 503005 - AGE_RANGE_65_UP = 503006 - AGE_RANGE_UNDETERMINED = 503999 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_campaign_app_store.py b/google/ads/googleads/v6/enums/types/app_campaign_app_store.py deleted file mode 100644 index 8291dcc68..000000000 --- a/google/ads/googleads/v6/enums/types/app_campaign_app_store.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppCampaignAppStoreEnum",}, -) - - -class AppCampaignAppStoreEnum(proto.Message): - r"""The application store that distributes mobile applications.""" - - class AppCampaignAppStore(proto.Enum): - r"""Enum describing app campaign app store.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APPLE_APP_STORE = 2 - GOOGLE_APP_STORE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_campaign_bidding_strategy_goal_type.py b/google/ads/googleads/v6/enums/types/app_campaign_bidding_strategy_goal_type.py deleted file mode 100644 index 9eedcc967..000000000 --- a/google/ads/googleads/v6/enums/types/app_campaign_bidding_strategy_goal_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppCampaignBiddingStrategyGoalTypeEnum",}, -) - - -class AppCampaignBiddingStrategyGoalTypeEnum(proto.Message): - r"""Container for enum describing goal towards which the bidding - strategy of an app campaign should optimize for. - """ - - class AppCampaignBiddingStrategyGoalType(proto.Enum): - r"""Goal type of App campaign BiddingStrategy.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPTIMIZE_INSTALLS_TARGET_INSTALL_COST = 2 - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_INSTALL_COST = 3 - OPTIMIZE_IN_APP_CONVERSIONS_TARGET_CONVERSION_COST = 4 - OPTIMIZE_RETURN_ON_ADVERTISING_SPEND = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_payment_model_type.py b/google/ads/googleads/v6/enums/types/app_payment_model_type.py deleted file mode 100644 index 2ce023b85..000000000 --- a/google/ads/googleads/v6/enums/types/app_payment_model_type.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppPaymentModelTypeEnum",}, -) - - -class AppPaymentModelTypeEnum(proto.Message): - r"""Represents a criterion for targeting paid apps.""" - - class AppPaymentModelType(proto.Enum): - r"""Enum describing possible app payment models.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PAID = 30 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_placeholder_field.py b/google/ads/googleads/v6/enums/types/app_placeholder_field.py deleted file mode 100644 index de3734bd4..000000000 --- a/google/ads/googleads/v6/enums/types/app_placeholder_field.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppPlaceholderFieldEnum",}, -) - - -class AppPlaceholderFieldEnum(proto.Message): - r"""Values for App placeholder fields.""" - - class AppPlaceholderField(proto.Enum): - r"""Possible values for App placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - STORE = 2 - ID = 3 - LINK_TEXT = 4 - URL = 5 - FINAL_URLS = 6 - FINAL_MOBILE_URLS = 7 - TRACKING_URL = 8 - FINAL_URL_SUFFIX = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_store.py b/google/ads/googleads/v6/enums/types/app_store.py deleted file mode 100644 index 48303ea20..000000000 --- a/google/ads/googleads/v6/enums/types/app_store.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppStoreEnum",}, -) - - -class AppStoreEnum(proto.Message): - r"""Container for enum describing app store type in an app - extension. - """ - - class AppStore(proto.Enum): - r"""App store type in an app extension.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APPLE_ITUNES = 2 - GOOGLE_PLAY = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/app_url_operating_system_type.py b/google/ads/googleads/v6/enums/types/app_url_operating_system_type.py deleted file mode 100644 index 480964721..000000000 --- a/google/ads/googleads/v6/enums/types/app_url_operating_system_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AppUrlOperatingSystemTypeEnum",}, -) - - -class AppUrlOperatingSystemTypeEnum(proto.Message): - r"""The possible OS types for a deeplink AppUrl.""" - - class AppUrlOperatingSystemType(proto.Enum): - r"""Operating System""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IOS = 2 - ANDROID = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/asset_field_type.py b/google/ads/googleads/v6/enums/types/asset_field_type.py deleted file mode 100644 index 424d10a55..000000000 --- a/google/ads/googleads/v6/enums/types/asset_field_type.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AssetFieldTypeEnum",}, -) - - -class AssetFieldTypeEnum(proto.Message): - r"""Container for enum describing the possible placements of an - asset. - """ - - class AssetFieldType(proto.Enum): - r"""Enum describing the possible placements of an asset.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - HEADLINE = 2 - DESCRIPTION = 3 - MANDATORY_AD_TEXT = 4 - MARKETING_IMAGE = 5 - MEDIA_BUNDLE = 6 - YOUTUBE_VIDEO = 7 - BOOK_ON_GOOGLE = 8 - LEAD_FORM = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/asset_link_status.py b/google/ads/googleads/v6/enums/types/asset_link_status.py deleted file mode 100644 index d05c45f08..000000000 --- a/google/ads/googleads/v6/enums/types/asset_link_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AssetLinkStatusEnum",}, -) - - -class AssetLinkStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of an asset - link. - """ - - class AssetLinkStatus(proto.Enum): - r"""Enum describing statuses of an asset link.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/asset_performance_label.py b/google/ads/googleads/v6/enums/types/asset_performance_label.py deleted file mode 100644 index 1767082ae..000000000 --- a/google/ads/googleads/v6/enums/types/asset_performance_label.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AssetPerformanceLabelEnum",}, -) - - -class AssetPerformanceLabelEnum(proto.Message): - r"""Container for enum describing the performance label of an - asset. - """ - - class AssetPerformanceLabel(proto.Enum): - r"""Enum describing the possible performance labels of an asset, - usually computed in the context of a linkage. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - LEARNING = 3 - LOW = 4 - GOOD = 5 - BEST = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/asset_type.py b/google/ads/googleads/v6/enums/types/asset_type.py deleted file mode 100644 index 960322004..000000000 --- a/google/ads/googleads/v6/enums/types/asset_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AssetTypeEnum",}, -) - - -class AssetTypeEnum(proto.Message): - r"""Container for enum describing the types of asset.""" - - class AssetType(proto.Enum): - r"""Enum describing possible types of asset.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - YOUTUBE_VIDEO = 2 - MEDIA_BUNDLE = 3 - IMAGE = 4 - TEXT = 5 - LEAD_FORM = 6 - BOOK_ON_GOOGLE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/attribution_model.py b/google/ads/googleads/v6/enums/types/attribution_model.py deleted file mode 100644 index 2abc0f462..000000000 --- a/google/ads/googleads/v6/enums/types/attribution_model.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AttributionModelEnum",}, -) - - -class AttributionModelEnum(proto.Message): - r"""Container for enum representing the attribution model that - describes how to distribute credit for a particular conversion - across potentially many prior interactions. - """ - - class AttributionModel(proto.Enum): - r"""The attribution model that describes how to distribute credit - for a particular conversion across potentially many prior - interactions. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - EXTERNAL = 100 - GOOGLE_ADS_LAST_CLICK = 101 - GOOGLE_SEARCH_ATTRIBUTION_FIRST_CLICK = 102 - GOOGLE_SEARCH_ATTRIBUTION_LINEAR = 103 - GOOGLE_SEARCH_ATTRIBUTION_TIME_DECAY = 104 - GOOGLE_SEARCH_ATTRIBUTION_POSITION_BASED = 105 - GOOGLE_SEARCH_ATTRIBUTION_DATA_DRIVEN = 106 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/batch_job_status.py b/google/ads/googleads/v6/enums/types/batch_job_status.py deleted file mode 100644 index ed52974bc..000000000 --- a/google/ads/googleads/v6/enums/types/batch_job_status.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BatchJobStatusEnum",}, -) - - -class BatchJobStatusEnum(proto.Message): - r"""Container for enum describing possible batch job statuses.""" - - class BatchJobStatus(proto.Enum): - r"""The batch job statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - RUNNING = 3 - DONE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/bid_modifier_source.py b/google/ads/googleads/v6/enums/types/bid_modifier_source.py deleted file mode 100644 index 9cbf48eee..000000000 --- a/google/ads/googleads/v6/enums/types/bid_modifier_source.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BidModifierSourceEnum",}, -) - - -class BidModifierSourceEnum(proto.Message): - r"""Container for enum describing possible bid modifier sources.""" - - class BidModifierSource(proto.Enum): - r"""Enum describing possible bid modifier sources.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN = 2 - AD_GROUP = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/bidding_source.py b/google/ads/googleads/v6/enums/types/bidding_source.py deleted file mode 100644 index 2f5fa7c3b..000000000 --- a/google/ads/googleads/v6/enums/types/bidding_source.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BiddingSourceEnum",}, -) - - -class BiddingSourceEnum(proto.Message): - r"""Container for enum describing possible bidding sources.""" - - class BiddingSource(proto.Enum): - r"""Indicates where a bid or target is defined. For example, an - ad group criterion may define a cpc bid directly, or it can - inherit its cpc bid from the ad group. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN_BIDDING_STRATEGY = 5 - AD_GROUP = 6 - AD_GROUP_CRITERION = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/bidding_strategy_status.py b/google/ads/googleads/v6/enums/types/bidding_strategy_status.py deleted file mode 100644 index 84a542bb1..000000000 --- a/google/ads/googleads/v6/enums/types/bidding_strategy_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BiddingStrategyStatusEnum",}, -) - - -class BiddingStrategyStatusEnum(proto.Message): - r"""Message describing BiddingStrategy statuses.""" - - class BiddingStrategyStatus(proto.Enum): - r"""The possible statuses of a BiddingStrategy.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/bidding_strategy_type.py b/google/ads/googleads/v6/enums/types/bidding_strategy_type.py deleted file mode 100644 index 8c2d0fd9e..000000000 --- a/google/ads/googleads/v6/enums/types/bidding_strategy_type.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BiddingStrategyTypeEnum",}, -) - - -class BiddingStrategyTypeEnum(proto.Message): - r"""Container for enum describing possible bidding strategy - types. - """ - - class BiddingStrategyType(proto.Enum): - r"""Enum describing possible bidding strategy types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - COMMISSION = 16 - ENHANCED_CPC = 2 - MANUAL_CPC = 3 - MANUAL_CPM = 4 - MANUAL_CPV = 13 - MAXIMIZE_CONVERSIONS = 10 - MAXIMIZE_CONVERSION_VALUE = 11 - PAGE_ONE_PROMOTED = 5 - PERCENT_CPC = 12 - TARGET_CPA = 6 - TARGET_CPM = 14 - TARGET_IMPRESSION_SHARE = 15 - TARGET_OUTRANK_SHARE = 7 - TARGET_ROAS = 8 - TARGET_SPEND = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/billing_setup_status.py b/google/ads/googleads/v6/enums/types/billing_setup_status.py deleted file mode 100644 index e2f2a7076..000000000 --- a/google/ads/googleads/v6/enums/types/billing_setup_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BillingSetupStatusEnum",}, -) - - -class BillingSetupStatusEnum(proto.Message): - r"""Message describing BillingSetup statuses.""" - - class BillingSetupStatus(proto.Enum): - r"""The possible statuses of a BillingSetup.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - APPROVED_HELD = 3 - APPROVED = 4 - CANCELLED = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/brand_safety_suitability.py b/google/ads/googleads/v6/enums/types/brand_safety_suitability.py deleted file mode 100644 index 6a5a3f87c..000000000 --- a/google/ads/googleads/v6/enums/types/brand_safety_suitability.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BrandSafetySuitabilityEnum",}, -) - - -class BrandSafetySuitabilityEnum(proto.Message): - r"""Container for enum with 3-Tier brand safety suitability - control. - """ - - class BrandSafetySuitability(proto.Enum): - r"""3-Tier brand safety suitability control.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EXPANDED_INVENTORY = 2 - STANDARD_INVENTORY = 3 - LIMITED_INVENTORY = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/budget_campaign_association_status.py b/google/ads/googleads/v6/enums/types/budget_campaign_association_status.py deleted file mode 100644 index 88d8c035d..000000000 --- a/google/ads/googleads/v6/enums/types/budget_campaign_association_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BudgetCampaignAssociationStatusEnum",}, -) - - -class BudgetCampaignAssociationStatusEnum(proto.Message): - r"""Message describing the status of the association between the - Budget and the Campaign. - """ - - class BudgetCampaignAssociationStatus(proto.Enum): - r"""Possible statuses of the association between the Budget and - the Campaign. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/budget_delivery_method.py b/google/ads/googleads/v6/enums/types/budget_delivery_method.py deleted file mode 100644 index d92fb3cf9..000000000 --- a/google/ads/googleads/v6/enums/types/budget_delivery_method.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BudgetDeliveryMethodEnum",}, -) - - -class BudgetDeliveryMethodEnum(proto.Message): - r"""Message describing Budget delivery methods. A delivery method - determines the rate at which the Budget is spent. - """ - - class BudgetDeliveryMethod(proto.Enum): - r"""Possible delivery methods of a Budget.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - STANDARD = 2 - ACCELERATED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/budget_period.py b/google/ads/googleads/v6/enums/types/budget_period.py deleted file mode 100644 index c09271849..000000000 --- a/google/ads/googleads/v6/enums/types/budget_period.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BudgetPeriodEnum",}, -) - - -class BudgetPeriodEnum(proto.Message): - r"""Message describing Budget period.""" - - class BudgetPeriod(proto.Enum): - r"""Possible period of a Budget.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DAILY = 2 - CUSTOM_PERIOD = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/budget_status.py b/google/ads/googleads/v6/enums/types/budget_status.py deleted file mode 100644 index 535dfb003..000000000 --- a/google/ads/googleads/v6/enums/types/budget_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BudgetStatusEnum",}, -) - - -class BudgetStatusEnum(proto.Message): - r"""Message describing a Budget status""" - - class BudgetStatus(proto.Enum): - r"""Possible statuses of a Budget.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/budget_type.py b/google/ads/googleads/v6/enums/types/budget_type.py deleted file mode 100644 index a289f802b..000000000 --- a/google/ads/googleads/v6/enums/types/budget_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"BudgetTypeEnum",}, -) - - -class BudgetTypeEnum(proto.Message): - r"""Describes Budget types.""" - - class BudgetType(proto.Enum): - r"""Possible Budget types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - STANDARD = 2 - HOTEL_ADS_COMMISSION = 3 - FIXED_CPA = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/call_conversion_reporting_state.py b/google/ads/googleads/v6/enums/types/call_conversion_reporting_state.py deleted file mode 100644 index 8a001b297..000000000 --- a/google/ads/googleads/v6/enums/types/call_conversion_reporting_state.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CallConversionReportingStateEnum",}, -) - - -class CallConversionReportingStateEnum(proto.Message): - r"""Container for enum describing possible data types for call - conversion reporting state. - """ - - class CallConversionReportingState(proto.Enum): - r"""Possible data types for a call conversion action state.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DISABLED = 2 - USE_ACCOUNT_LEVEL_CALL_CONVERSION_ACTION = 3 - USE_RESOURCE_LEVEL_CALL_CONVERSION_ACTION = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/call_placeholder_field.py b/google/ads/googleads/v6/enums/types/call_placeholder_field.py deleted file mode 100644 index 18e8d1279..000000000 --- a/google/ads/googleads/v6/enums/types/call_placeholder_field.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CallPlaceholderFieldEnum",}, -) - - -class CallPlaceholderFieldEnum(proto.Message): - r"""Values for Call placeholder fields.""" - - class CallPlaceholderField(proto.Enum): - r"""Possible values for Call placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PHONE_NUMBER = 2 - COUNTRY_CODE = 3 - TRACKED = 4 - CONVERSION_TYPE_ID = 5 - CONVERSION_REPORTING_STATE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/call_tracking_display_location.py b/google/ads/googleads/v6/enums/types/call_tracking_display_location.py deleted file mode 100644 index 43d577350..000000000 --- a/google/ads/googleads/v6/enums/types/call_tracking_display_location.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CallTrackingDisplayLocationEnum",}, -) - - -class CallTrackingDisplayLocationEnum(proto.Message): - r"""Container for enum describing possible call tracking display - locations. - """ - - class CallTrackingDisplayLocation(proto.Enum): - r"""Possible call tracking display locations.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD = 2 - LANDING_PAGE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/call_type.py b/google/ads/googleads/v6/enums/types/call_type.py deleted file mode 100644 index 654f657f1..000000000 --- a/google/ads/googleads/v6/enums/types/call_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CallTypeEnum",}, -) - - -class CallTypeEnum(proto.Message): - r"""Container for enum describing possible types of property from - where the call was made. - """ - - class CallType(proto.Enum): - r"""Possible types of property from where the call was made.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MANUALLY_DIALED = 2 - HIGH_END_MOBILE_SEARCH = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/callout_placeholder_field.py b/google/ads/googleads/v6/enums/types/callout_placeholder_field.py deleted file mode 100644 index 8c3846370..000000000 --- a/google/ads/googleads/v6/enums/types/callout_placeholder_field.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CalloutPlaceholderFieldEnum",}, -) - - -class CalloutPlaceholderFieldEnum(proto.Message): - r"""Values for Callout placeholder fields.""" - - class CalloutPlaceholderField(proto.Enum): - r"""Possible values for Callout placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CALLOUT_TEXT = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_criterion_status.py b/google/ads/googleads/v6/enums/types/campaign_criterion_status.py deleted file mode 100644 index 490a26122..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_criterion_status.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignCriterionStatusEnum",}, -) - - -class CampaignCriterionStatusEnum(proto.Message): - r"""Message describing CampaignCriterion statuses.""" - - class CampaignCriterionStatus(proto.Enum): - r"""The possible statuses of a CampaignCriterion.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - PAUSED = 3 - REMOVED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_draft_status.py b/google/ads/googleads/v6/enums/types/campaign_draft_status.py deleted file mode 100644 index 34bd35db0..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_draft_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignDraftStatusEnum",}, -) - - -class CampaignDraftStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a campaign - draft. - """ - - class CampaignDraftStatus(proto.Enum): - r"""Possible statuses of a campaign draft.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PROPOSED = 2 - REMOVED = 3 - PROMOTING = 5 - PROMOTED = 4 - PROMOTE_FAILED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_experiment_status.py b/google/ads/googleads/v6/enums/types/campaign_experiment_status.py deleted file mode 100644 index 756065b99..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_experiment_status.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignExperimentStatusEnum",}, -) - - -class CampaignExperimentStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a campaign - experiment. - """ - - class CampaignExperimentStatus(proto.Enum): - r"""Possible statuses of a campaign experiment.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INITIALIZING = 2 - INITIALIZATION_FAILED = 8 - ENABLED = 3 - GRADUATED = 4 - REMOVED = 5 - PROMOTING = 6 - PROMOTION_FAILED = 9 - PROMOTED = 7 - ENDED_MANUALLY = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_experiment_traffic_split_type.py b/google/ads/googleads/v6/enums/types/campaign_experiment_traffic_split_type.py deleted file mode 100644 index 0ca0f1943..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_experiment_traffic_split_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignExperimentTrafficSplitTypeEnum",}, -) - - -class CampaignExperimentTrafficSplitTypeEnum(proto.Message): - r"""Container for enum describing campaign experiment traffic - split type. - """ - - class CampaignExperimentTrafficSplitType(proto.Enum): - r"""Enum of strategies for splitting traffic between base and - experiment campaigns in campaign experiment. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - RANDOM_QUERY = 2 - COOKIE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_serving_status.py b/google/ads/googleads/v6/enums/types/campaign_serving_status.py deleted file mode 100644 index 5c504828b..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_serving_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignServingStatusEnum",}, -) - - -class CampaignServingStatusEnum(proto.Message): - r"""Message describing Campaign serving statuses.""" - - class CampaignServingStatus(proto.Enum): - r"""Possible serving statuses of a campaign.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SERVING = 2 - NONE = 3 - ENDED = 4 - PENDING = 5 - SUSPENDED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_shared_set_status.py b/google/ads/googleads/v6/enums/types/campaign_shared_set_status.py deleted file mode 100644 index 3948bc29c..000000000 --- a/google/ads/googleads/v6/enums/types/campaign_shared_set_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignSharedSetStatusEnum",}, -) - - -class CampaignSharedSetStatusEnum(proto.Message): - r"""Container for enum describing types of campaign shared set - statuses. - """ - - class CampaignSharedSetStatus(proto.Enum): - r"""Enum listing the possible campaign shared set statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/change_client_type.py b/google/ads/googleads/v6/enums/types/change_client_type.py deleted file mode 100644 index 84523c957..000000000 --- a/google/ads/googleads/v6/enums/types/change_client_type.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ChangeClientTypeEnum",}, -) - - -class ChangeClientTypeEnum(proto.Message): - r"""Container for enum describing the sources that the change - event resource was made through. - """ - - class ChangeClientType(proto.Enum): - r"""The source that the change_event resource was made through.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - GOOGLE_ADS_WEB_CLIENT = 2 - GOOGLE_ADS_AUTOMATED_RULE = 3 - GOOGLE_ADS_SCRIPTS = 4 - GOOGLE_ADS_BULK_UPLOAD = 5 - GOOGLE_ADS_API = 6 - GOOGLE_ADS_EDITOR = 7 - GOOGLE_ADS_MOBILE_APP = 8 - GOOGLE_ADS_RECOMMENDATIONS = 9 - SEARCH_ADS_360_SYNC = 10 - SEARCH_ADS_360_POST = 11 - INTERNAL_TOOL = 12 - OTHER = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/change_event_resource_type.py b/google/ads/googleads/v6/enums/types/change_event_resource_type.py deleted file mode 100644 index 9bf333c2a..000000000 --- a/google/ads/googleads/v6/enums/types/change_event_resource_type.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ChangeEventResourceTypeEnum",}, -) - - -class ChangeEventResourceTypeEnum(proto.Message): - r"""Container for enum describing supported resource types for - the ChangeEvent resource. - """ - - class ChangeEventResourceType(proto.Enum): - r"""Enum listing the resource types support by the ChangeEvent - resource. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - AD = 2 - AD_GROUP = 3 - AD_GROUP_CRITERION = 4 - CAMPAIGN = 5 - CAMPAIGN_BUDGET = 6 - AD_GROUP_BID_MODIFIER = 7 - CAMPAIGN_CRITERION = 8 - FEED = 9 - FEED_ITEM = 10 - CAMPAIGN_FEED = 11 - AD_GROUP_FEED = 12 - AD_GROUP_AD = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/change_status_operation.py b/google/ads/googleads/v6/enums/types/change_status_operation.py deleted file mode 100644 index 4c6ab2543..000000000 --- a/google/ads/googleads/v6/enums/types/change_status_operation.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ChangeStatusOperationEnum",}, -) - - -class ChangeStatusOperationEnum(proto.Message): - r"""Container for enum describing operations for the ChangeStatus - resource. - """ - - class ChangeStatusOperation(proto.Enum): - r"""Status of the changed resource""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ADDED = 2 - CHANGED = 3 - REMOVED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/change_status_resource_type.py b/google/ads/googleads/v6/enums/types/change_status_resource_type.py deleted file mode 100644 index b8a4f807d..000000000 --- a/google/ads/googleads/v6/enums/types/change_status_resource_type.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ChangeStatusResourceTypeEnum",}, -) - - -class ChangeStatusResourceTypeEnum(proto.Message): - r"""Container for enum describing supported resource types for - the ChangeStatus resource. - """ - - class ChangeStatusResourceType(proto.Enum): - r"""Enum listing the resource types support by the ChangeStatus - resource. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_GROUP = 3 - AD_GROUP_AD = 4 - AD_GROUP_CRITERION = 5 - CAMPAIGN = 6 - CAMPAIGN_CRITERION = 7 - FEED = 9 - FEED_ITEM = 10 - AD_GROUP_FEED = 11 - CAMPAIGN_FEED = 12 - AD_GROUP_BID_MODIFIER = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/click_type.py b/google/ads/googleads/v6/enums/types/click_type.py deleted file mode 100644 index 4d31fa46f..000000000 --- a/google/ads/googleads/v6/enums/types/click_type.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ClickTypeEnum",}, -) - - -class ClickTypeEnum(proto.Message): - r"""Container for enumeration of Google Ads click types.""" - - class ClickType(proto.Enum): - r"""Enumerates Google Ads click types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APP_DEEPLINK = 2 - BREADCRUMBS = 3 - BROADBAND_PLAN = 4 - CALL_TRACKING = 5 - CALLS = 6 - CLICK_ON_ENGAGEMENT_AD = 7 - GET_DIRECTIONS = 8 - LOCATION_EXPANSION = 9 - LOCATION_FORMAT_CALL = 10 - LOCATION_FORMAT_DIRECTIONS = 11 - LOCATION_FORMAT_IMAGE = 12 - LOCATION_FORMAT_LANDING_PAGE = 13 - LOCATION_FORMAT_MAP = 14 - LOCATION_FORMAT_STORE_INFO = 15 - LOCATION_FORMAT_TEXT = 16 - MOBILE_CALL_TRACKING = 17 - OFFER_PRINTS = 18 - OTHER = 19 - PRODUCT_EXTENSION_CLICKS = 20 - PRODUCT_LISTING_AD_CLICKS = 21 - SITELINKS = 22 - STORE_LOCATOR = 23 - URL_CLICKS = 25 - VIDEO_APP_STORE_CLICKS = 26 - VIDEO_CALL_TO_ACTION_CLICKS = 27 - VIDEO_CARD_ACTION_HEADLINE_CLICKS = 28 - VIDEO_END_CAP_CLICKS = 29 - VIDEO_WEBSITE_CLICKS = 30 - VISUAL_SITELINKS = 31 - WIRELESS_PLAN = 32 - PRODUCT_LISTING_AD_LOCAL = 33 - PRODUCT_LISTING_AD_MULTICHANNEL_LOCAL = 34 - PRODUCT_LISTING_AD_MULTICHANNEL_ONLINE = 35 - PRODUCT_LISTING_ADS_COUPON = 36 - PRODUCT_LISTING_AD_TRANSACTABLE = 37 - PRODUCT_AD_APP_DEEPLINK = 38 - SHOWCASE_AD_CATEGORY_LINK = 39 - SHOWCASE_AD_LOCAL_STOREFRONT_LINK = 40 - SHOWCASE_AD_ONLINE_PRODUCT_LINK = 42 - SHOWCASE_AD_LOCAL_PRODUCT_LINK = 43 - PROMOTION_EXTENSION = 44 - SWIPEABLE_GALLERY_AD_HEADLINE = 45 - SWIPEABLE_GALLERY_AD_SWIPES = 46 - SWIPEABLE_GALLERY_AD_SEE_MORE = 47 - SWIPEABLE_GALLERY_AD_SITELINK_ONE = 48 - SWIPEABLE_GALLERY_AD_SITELINK_TWO = 49 - SWIPEABLE_GALLERY_AD_SITELINK_THREE = 50 - SWIPEABLE_GALLERY_AD_SITELINK_FOUR = 51 - SWIPEABLE_GALLERY_AD_SITELINK_FIVE = 52 - HOTEL_PRICE = 53 - PRICE_EXTENSION = 54 - HOTEL_BOOK_ON_GOOGLE_ROOM_SELECTION = 55 - SHOPPING_COMPARISON_LISTING = 56 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/combined_audience_status.py b/google/ads/googleads/v6/enums/types/combined_audience_status.py deleted file mode 100644 index 24fdb3c57..000000000 --- a/google/ads/googleads/v6/enums/types/combined_audience_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CombinedAudienceStatusEnum",}, -) - - -class CombinedAudienceStatusEnum(proto.Message): - r"""The status of combined audience.""" - - class CombinedAudienceStatus(proto.Enum): - r"""Enum containing possible combined audience status types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/content_label_type.py b/google/ads/googleads/v6/enums/types/content_label_type.py deleted file mode 100644 index 89c4854e9..000000000 --- a/google/ads/googleads/v6/enums/types/content_label_type.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ContentLabelTypeEnum",}, -) - - -class ContentLabelTypeEnum(proto.Message): - r"""Container for enum describing content label types in - ContentLabel. - """ - - class ContentLabelType(proto.Enum): - r"""Enum listing the content label types supported by - ContentLabel criterion. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - SEXUALLY_SUGGESTIVE = 2 - BELOW_THE_FOLD = 3 - PARKED_DOMAIN = 4 - JUVENILE = 6 - PROFANITY = 7 - TRAGEDY = 8 - VIDEO = 9 - VIDEO_RATING_DV_G = 10 - VIDEO_RATING_DV_PG = 11 - VIDEO_RATING_DV_T = 12 - VIDEO_RATING_DV_MA = 13 - VIDEO_NOT_YET_RATED = 14 - EMBEDDED_VIDEO = 15 - LIVE_STREAMING_VIDEO = 16 - SOCIAL_ISSUES = 17 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_action_category.py b/google/ads/googleads/v6/enums/types/conversion_action_category.py deleted file mode 100644 index eecfe05b6..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_action_category.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionActionCategoryEnum",}, -) - - -class ConversionActionCategoryEnum(proto.Message): - r"""Container for enum describing the category of conversions - that are associated with a ConversionAction. - """ - - class ConversionActionCategory(proto.Enum): - r"""The category of conversions that are associated with a - ConversionAction. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - DEFAULT = 2 - PAGE_VIEW = 3 - PURCHASE = 4 - SIGNUP = 5 - LEAD = 6 - DOWNLOAD = 7 - ADD_TO_CART = 8 - BEGIN_CHECKOUT = 9 - SUBSCRIBE_PAID = 10 - PHONE_CALL_LEAD = 11 - IMPORTED_LEAD = 12 - SUBMIT_LEAD_FORM = 13 - BOOK_APPOINTMENT = 14 - REQUEST_QUOTE = 15 - GET_DIRECTIONS = 16 - OUTBOUND_CLICK = 17 - CONTACT = 18 - ENGAGEMENT = 19 - STORE_VISIT = 20 - STORE_SALE = 21 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_action_type.py b/google/ads/googleads/v6/enums/types/conversion_action_type.py deleted file mode 100644 index 9fcf85d96..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_action_type.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionActionTypeEnum",}, -) - - -class ConversionActionTypeEnum(proto.Message): - r"""Container for enum describing possible types of a conversion - action. - """ - - class ConversionActionType(proto.Enum): - r"""Possible types of a conversion action.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_CALL = 2 - CLICK_TO_CALL = 3 - GOOGLE_PLAY_DOWNLOAD = 4 - GOOGLE_PLAY_IN_APP_PURCHASE = 5 - UPLOAD_CALLS = 6 - UPLOAD_CLICKS = 7 - WEBPAGE = 8 - WEBSITE_CALL = 9 - STORE_SALES_DIRECT_UPLOAD = 10 - STORE_SALES = 11 - FIREBASE_ANDROID_FIRST_OPEN = 12 - FIREBASE_ANDROID_IN_APP_PURCHASE = 13 - FIREBASE_ANDROID_CUSTOM = 14 - FIREBASE_IOS_FIRST_OPEN = 15 - FIREBASE_IOS_IN_APP_PURCHASE = 16 - FIREBASE_IOS_CUSTOM = 17 - THIRD_PARTY_APP_ANALYTICS_ANDROID_FIRST_OPEN = 18 - THIRD_PARTY_APP_ANALYTICS_ANDROID_IN_APP_PURCHASE = 19 - THIRD_PARTY_APP_ANALYTICS_ANDROID_CUSTOM = 20 - THIRD_PARTY_APP_ANALYTICS_IOS_FIRST_OPEN = 21 - THIRD_PARTY_APP_ANALYTICS_IOS_IN_APP_PURCHASE = 22 - THIRD_PARTY_APP_ANALYTICS_IOS_CUSTOM = 23 - ANDROID_APP_PRE_REGISTRATION = 24 - ANDROID_INSTALLS_ALL_OTHER_APPS = 25 - FLOODLIGHT_ACTION = 26 - FLOODLIGHT_TRANSACTION = 27 - GOOGLE_HOSTED = 28 - LEAD_FORM_SUBMIT = 29 - SALESFORCE = 30 - SEARCH_ADS_360 = 31 - SMART_CAMPAIGN_AD_CLICKS_TO_CALL = 32 - SMART_CAMPAIGN_MAP_CLICKS_TO_CALL = 33 - SMART_CAMPAIGN_MAP_DIRECTIONS = 34 - SMART_CAMPAIGN_TRACKED_CALLS = 35 - STORE_VISITS = 36 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_adjustment_type.py b/google/ads/googleads/v6/enums/types/conversion_adjustment_type.py deleted file mode 100644 index e1a85651c..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_adjustment_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionAdjustmentTypeEnum",}, -) - - -class ConversionAdjustmentTypeEnum(proto.Message): - r"""Container for enum describing conversion adjustment types.""" - - class ConversionAdjustmentType(proto.Enum): - r"""The different actions advertisers can take to adjust the - conversions that they already reported. Retractions negate a - conversion. Restatements change the value of a conversion. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - RETRACTION = 2 - RESTATEMENT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_attribution_event_type.py b/google/ads/googleads/v6/enums/types/conversion_attribution_event_type.py deleted file mode 100644 index e9d12537d..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_attribution_event_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionAttributionEventTypeEnum",}, -) - - -class ConversionAttributionEventTypeEnum(proto.Message): - r"""Container for enum indicating the event type the conversion - is attributed to. - """ - - class ConversionAttributionEventType(proto.Enum): - r"""The event type of conversions that are attributed to.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IMPRESSION = 2 - INTERACTION = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_lag_bucket.py b/google/ads/googleads/v6/enums/types/conversion_lag_bucket.py deleted file mode 100644 index c3958117a..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_lag_bucket.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionLagBucketEnum",}, -) - - -class ConversionLagBucketEnum(proto.Message): - r"""Container for enum representing the number of days between - impression and conversion. - """ - - class ConversionLagBucket(proto.Enum): - r"""Enum representing the number of days between impression and - conversion. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - LESS_THAN_ONE_DAY = 2 - ONE_TO_TWO_DAYS = 3 - TWO_TO_THREE_DAYS = 4 - THREE_TO_FOUR_DAYS = 5 - FOUR_TO_FIVE_DAYS = 6 - FIVE_TO_SIX_DAYS = 7 - SIX_TO_SEVEN_DAYS = 8 - SEVEN_TO_EIGHT_DAYS = 9 - EIGHT_TO_NINE_DAYS = 10 - NINE_TO_TEN_DAYS = 11 - TEN_TO_ELEVEN_DAYS = 12 - ELEVEN_TO_TWELVE_DAYS = 13 - TWELVE_TO_THIRTEEN_DAYS = 14 - THIRTEEN_TO_FOURTEEN_DAYS = 15 - FOURTEEN_TO_TWENTY_ONE_DAYS = 16 - TWENTY_ONE_TO_THIRTY_DAYS = 17 - THIRTY_TO_FORTY_FIVE_DAYS = 18 - FORTY_FIVE_TO_SIXTY_DAYS = 19 - SIXTY_TO_NINETY_DAYS = 20 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_or_adjustment_lag_bucket.py b/google/ads/googleads/v6/enums/types/conversion_or_adjustment_lag_bucket.py deleted file mode 100644 index e6677d887..000000000 --- a/google/ads/googleads/v6/enums/types/conversion_or_adjustment_lag_bucket.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionOrAdjustmentLagBucketEnum",}, -) - - -class ConversionOrAdjustmentLagBucketEnum(proto.Message): - r"""Container for enum representing the number of days between - the impression and the conversion or between the impression and - adjustments to the conversion. - """ - - class ConversionOrAdjustmentLagBucket(proto.Enum): - r"""Enum representing the number of days between the impression - and the conversion or between the impression and adjustments to - the conversion. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - CONVERSION_LESS_THAN_ONE_DAY = 2 - CONVERSION_ONE_TO_TWO_DAYS = 3 - CONVERSION_TWO_TO_THREE_DAYS = 4 - CONVERSION_THREE_TO_FOUR_DAYS = 5 - CONVERSION_FOUR_TO_FIVE_DAYS = 6 - CONVERSION_FIVE_TO_SIX_DAYS = 7 - CONVERSION_SIX_TO_SEVEN_DAYS = 8 - CONVERSION_SEVEN_TO_EIGHT_DAYS = 9 - CONVERSION_EIGHT_TO_NINE_DAYS = 10 - CONVERSION_NINE_TO_TEN_DAYS = 11 - CONVERSION_TEN_TO_ELEVEN_DAYS = 12 - CONVERSION_ELEVEN_TO_TWELVE_DAYS = 13 - CONVERSION_TWELVE_TO_THIRTEEN_DAYS = 14 - CONVERSION_THIRTEEN_TO_FOURTEEN_DAYS = 15 - CONVERSION_FOURTEEN_TO_TWENTY_ONE_DAYS = 16 - CONVERSION_TWENTY_ONE_TO_THIRTY_DAYS = 17 - CONVERSION_THIRTY_TO_FORTY_FIVE_DAYS = 18 - CONVERSION_FORTY_FIVE_TO_SIXTY_DAYS = 19 - CONVERSION_SIXTY_TO_NINETY_DAYS = 20 - ADJUSTMENT_LESS_THAN_ONE_DAY = 21 - ADJUSTMENT_ONE_TO_TWO_DAYS = 22 - ADJUSTMENT_TWO_TO_THREE_DAYS = 23 - ADJUSTMENT_THREE_TO_FOUR_DAYS = 24 - ADJUSTMENT_FOUR_TO_FIVE_DAYS = 25 - ADJUSTMENT_FIVE_TO_SIX_DAYS = 26 - ADJUSTMENT_SIX_TO_SEVEN_DAYS = 27 - ADJUSTMENT_SEVEN_TO_EIGHT_DAYS = 28 - ADJUSTMENT_EIGHT_TO_NINE_DAYS = 29 - ADJUSTMENT_NINE_TO_TEN_DAYS = 30 - ADJUSTMENT_TEN_TO_ELEVEN_DAYS = 31 - ADJUSTMENT_ELEVEN_TO_TWELVE_DAYS = 32 - ADJUSTMENT_TWELVE_TO_THIRTEEN_DAYS = 33 - ADJUSTMENT_THIRTEEN_TO_FOURTEEN_DAYS = 34 - ADJUSTMENT_FOURTEEN_TO_TWENTY_ONE_DAYS = 35 - ADJUSTMENT_TWENTY_ONE_TO_THIRTY_DAYS = 36 - ADJUSTMENT_THIRTY_TO_FORTY_FIVE_DAYS = 37 - ADJUSTMENT_FORTY_FIVE_TO_SIXTY_DAYS = 38 - ADJUSTMENT_SIXTY_TO_NINETY_DAYS = 39 - ADJUSTMENT_NINETY_TO_ONE_HUNDRED_AND_FORTY_FIVE_DAYS = 40 - CONVERSION_UNKNOWN = 41 - ADJUSTMENT_UNKNOWN = 42 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/criterion_category_channel_availability_mode.py b/google/ads/googleads/v6/enums/types/criterion_category_channel_availability_mode.py deleted file mode 100644 index 701c84fea..000000000 --- a/google/ads/googleads/v6/enums/types/criterion_category_channel_availability_mode.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CriterionCategoryChannelAvailabilityModeEnum",}, -) - - -class CriterionCategoryChannelAvailabilityModeEnum(proto.Message): - r"""Describes channel availability mode for a criterion - availability - whether the availability is meant to include all - advertising channels, or a particular channel with all its - channel subtypes, or a channel with a certain subset of channel - subtypes. - """ - - class CriterionCategoryChannelAvailabilityMode(proto.Enum): - r"""Enum containing the possible - CriterionCategoryChannelAvailabilityMode. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ALL_CHANNELS = 2 - CHANNEL_TYPE_AND_ALL_SUBTYPES = 3 - CHANNEL_TYPE_AND_SUBSET_SUBTYPES = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/criterion_category_locale_availability_mode.py b/google/ads/googleads/v6/enums/types/criterion_category_locale_availability_mode.py deleted file mode 100644 index df1e72971..000000000 --- a/google/ads/googleads/v6/enums/types/criterion_category_locale_availability_mode.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CriterionCategoryLocaleAvailabilityModeEnum",}, -) - - -class CriterionCategoryLocaleAvailabilityModeEnum(proto.Message): - r"""Describes locale availability mode for a criterion - availability - whether it's available globally, or a particular - country with all languages, or a particular language with all - countries, or a country-language pair. - """ - - class CriterionCategoryLocaleAvailabilityMode(proto.Enum): - r"""Enum containing the possible - CriterionCategoryLocaleAvailabilityMode. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ALL_LOCALES = 2 - COUNTRY_AND_ALL_LANGUAGES = 3 - LANGUAGE_AND_ALL_COUNTRIES = 4 - COUNTRY_AND_LANGUAGE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/criterion_system_serving_status.py b/google/ads/googleads/v6/enums/types/criterion_system_serving_status.py deleted file mode 100644 index 479661bc1..000000000 --- a/google/ads/googleads/v6/enums/types/criterion_system_serving_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CriterionSystemServingStatusEnum",}, -) - - -class CriterionSystemServingStatusEnum(proto.Message): - r"""Container for enum describing possible criterion system - serving statuses. - """ - - class CriterionSystemServingStatus(proto.Enum): - r"""Enumerates criterion system serving statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ELIGIBLE = 2 - RARELY_SERVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/criterion_type.py b/google/ads/googleads/v6/enums/types/criterion_type.py deleted file mode 100644 index c4061d903..000000000 --- a/google/ads/googleads/v6/enums/types/criterion_type.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CriterionTypeEnum",}, -) - - -class CriterionTypeEnum(proto.Message): - r"""The possible types of a criterion.""" - - class CriterionType(proto.Enum): - r"""Enum describing possible criterion types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - KEYWORD = 2 - PLACEMENT = 3 - MOBILE_APP_CATEGORY = 4 - MOBILE_APPLICATION = 5 - DEVICE = 6 - LOCATION = 7 - LISTING_GROUP = 8 - AD_SCHEDULE = 9 - AGE_RANGE = 10 - GENDER = 11 - INCOME_RANGE = 12 - PARENTAL_STATUS = 13 - YOUTUBE_VIDEO = 14 - YOUTUBE_CHANNEL = 15 - USER_LIST = 16 - PROXIMITY = 17 - TOPIC = 18 - LISTING_SCOPE = 19 - LANGUAGE = 20 - IP_BLOCK = 21 - CONTENT_LABEL = 22 - CARRIER = 23 - USER_INTEREST = 24 - WEBPAGE = 25 - OPERATING_SYSTEM_VERSION = 26 - APP_PAYMENT_MODEL = 27 - MOBILE_DEVICE = 28 - CUSTOM_AFFINITY = 29 - CUSTOM_INTENT = 30 - LOCATION_GROUP = 31 - CUSTOM_AUDIENCE = 32 - COMBINED_AUDIENCE = 33 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_audience_member_type.py b/google/ads/googleads/v6/enums/types/custom_audience_member_type.py deleted file mode 100644 index d6a9d9ad1..000000000 --- a/google/ads/googleads/v6/enums/types/custom_audience_member_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomAudienceMemberTypeEnum",}, -) - - -class CustomAudienceMemberTypeEnum(proto.Message): - r"""The type of custom audience member.""" - - class CustomAudienceMemberType(proto.Enum): - r"""Enum containing possible custom audience member types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - KEYWORD = 2 - URL = 3 - PLACE_CATEGORY = 4 - APP = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_audience_status.py b/google/ads/googleads/v6/enums/types/custom_audience_status.py deleted file mode 100644 index 74bf71b72..000000000 --- a/google/ads/googleads/v6/enums/types/custom_audience_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomAudienceStatusEnum",}, -) - - -class CustomAudienceStatusEnum(proto.Message): - r"""The status of custom audience.""" - - class CustomAudienceStatus(proto.Enum): - r"""Enum containing possible custom audience statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_audience_type.py b/google/ads/googleads/v6/enums/types/custom_audience_type.py deleted file mode 100644 index 7df63b28a..000000000 --- a/google/ads/googleads/v6/enums/types/custom_audience_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomAudienceTypeEnum",}, -) - - -class CustomAudienceTypeEnum(proto.Message): - r"""The types of custom audience.""" - - class CustomAudienceType(proto.Enum): - r"""Enum containing possible custom audience types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AUTO = 2 - INTEREST = 3 - PURCHASE_INTENT = 4 - SEARCH = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_interest_member_type.py b/google/ads/googleads/v6/enums/types/custom_interest_member_type.py deleted file mode 100644 index cec726c5a..000000000 --- a/google/ads/googleads/v6/enums/types/custom_interest_member_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomInterestMemberTypeEnum",}, -) - - -class CustomInterestMemberTypeEnum(proto.Message): - r"""The types of custom interest member, either KEYWORD or URL.""" - - class CustomInterestMemberType(proto.Enum): - r"""Enum containing possible custom interest member types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - KEYWORD = 2 - URL = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_interest_status.py b/google/ads/googleads/v6/enums/types/custom_interest_status.py deleted file mode 100644 index ee8253ee9..000000000 --- a/google/ads/googleads/v6/enums/types/custom_interest_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomInterestStatusEnum",}, -) - - -class CustomInterestStatusEnum(proto.Message): - r"""The status of custom interest.""" - - class CustomInterestStatus(proto.Enum): - r"""Enum containing possible custom interest types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_interest_type.py b/google/ads/googleads/v6/enums/types/custom_interest_type.py deleted file mode 100644 index 32c775f58..000000000 --- a/google/ads/googleads/v6/enums/types/custom_interest_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomInterestTypeEnum",}, -) - - -class CustomInterestTypeEnum(proto.Message): - r"""The types of custom interest.""" - - class CustomInterestType(proto.Enum): - r"""Enum containing possible custom interest types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CUSTOM_AFFINITY = 2 - CUSTOM_INTENT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/custom_placeholder_field.py b/google/ads/googleads/v6/enums/types/custom_placeholder_field.py deleted file mode 100644 index 63f11c4b1..000000000 --- a/google/ads/googleads/v6/enums/types/custom_placeholder_field.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomPlaceholderFieldEnum",}, -) - - -class CustomPlaceholderFieldEnum(proto.Message): - r"""Values for Custom placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class CustomPlaceholderField(proto.Enum): - r"""Possible values for Custom placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ID = 2 - ID2 = 3 - ITEM_TITLE = 4 - ITEM_SUBTITLE = 5 - ITEM_DESCRIPTION = 6 - ITEM_ADDRESS = 7 - PRICE = 8 - FORMATTED_PRICE = 9 - SALE_PRICE = 10 - FORMATTED_SALE_PRICE = 11 - IMAGE_URL = 12 - ITEM_CATEGORY = 13 - FINAL_URLS = 14 - FINAL_MOBILE_URLS = 15 - TRACKING_URL = 16 - CONTEXTUAL_KEYWORDS = 17 - ANDROID_APP_LINK = 18 - SIMILAR_IDS = 19 - IOS_APP_LINK = 20 - IOS_APP_STORE_ID = 21 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/customer_match_upload_key_type.py b/google/ads/googleads/v6/enums/types/customer_match_upload_key_type.py deleted file mode 100644 index a50112111..000000000 --- a/google/ads/googleads/v6/enums/types/customer_match_upload_key_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomerMatchUploadKeyTypeEnum",}, -) - - -class CustomerMatchUploadKeyTypeEnum(proto.Message): - r"""Indicates what type of data are the user list's members - matched from. - """ - - class CustomerMatchUploadKeyType(proto.Enum): - r"""Enum describing possible customer match upload key types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CONTACT_INFO = 2 - CRM_ID = 3 - MOBILE_ADVERTISING_ID = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/customer_pay_per_conversion_eligibility_failure_reason.py b/google/ads/googleads/v6/enums/types/customer_pay_per_conversion_eligibility_failure_reason.py deleted file mode 100644 index 203b70f84..000000000 --- a/google/ads/googleads/v6/enums/types/customer_pay_per_conversion_eligibility_failure_reason.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CustomerPayPerConversionEligibilityFailureReasonEnum",}, -) - - -class CustomerPayPerConversionEligibilityFailureReasonEnum(proto.Message): - r"""Container for enum describing reasons why a customer is not - eligible to use PaymentMode.CONVERSIONS. - """ - - class CustomerPayPerConversionEligibilityFailureReason(proto.Enum): - r"""Enum describing possible reasons a customer is not eligible - to use PaymentMode.CONVERSIONS. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - NOT_ENOUGH_CONVERSIONS = 2 - CONVERSION_LAG_TOO_HIGH = 3 - HAS_CAMPAIGN_WITH_SHARED_BUDGET = 4 - HAS_UPLOAD_CLICKS_CONVERSION = 5 - AVERAGE_DAILY_SPEND_TOO_HIGH = 6 - ANALYSIS_NOT_COMPLETE = 7 - OTHER = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/data_driven_model_status.py b/google/ads/googleads/v6/enums/types/data_driven_model_status.py deleted file mode 100644 index 0d3c17f22..000000000 --- a/google/ads/googleads/v6/enums/types/data_driven_model_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DataDrivenModelStatusEnum",}, -) - - -class DataDrivenModelStatusEnum(proto.Message): - r"""Container for enum indicating data driven model status.""" - - class DataDrivenModelStatus(proto.Enum): - r"""Enumerates data driven model statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AVAILABLE = 2 - STALE = 3 - EXPIRED = 4 - NEVER_GENERATED = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/day_of_week.py b/google/ads/googleads/v6/enums/types/day_of_week.py deleted file mode 100644 index 10566337b..000000000 --- a/google/ads/googleads/v6/enums/types/day_of_week.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DayOfWeekEnum",}, -) - - -class DayOfWeekEnum(proto.Message): - r"""Container for enumeration of days of the week, e.g., - "Monday". - """ - - class DayOfWeek(proto.Enum): - r"""Enumerates days of the week, e.g., "Monday".""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MONDAY = 2 - TUESDAY = 3 - WEDNESDAY = 4 - THURSDAY = 5 - FRIDAY = 6 - SATURDAY = 7 - SUNDAY = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/device.py b/google/ads/googleads/v6/enums/types/device.py deleted file mode 100644 index baf8ead59..000000000 --- a/google/ads/googleads/v6/enums/types/device.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DeviceEnum",}, -) - - -class DeviceEnum(proto.Message): - r"""Container for enumeration of Google Ads devices available for - targeting. - """ - - class Device(proto.Enum): - r"""Enumerates Google Ads devices available for targeting.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MOBILE = 2 - TABLET = 3 - DESKTOP = 4 - CONNECTED_TV = 6 - OTHER = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/display_ad_format_setting.py b/google/ads/googleads/v6/enums/types/display_ad_format_setting.py deleted file mode 100644 index a4a97a94f..000000000 --- a/google/ads/googleads/v6/enums/types/display_ad_format_setting.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DisplayAdFormatSettingEnum",}, -) - - -class DisplayAdFormatSettingEnum(proto.Message): - r"""Container for display ad format settings.""" - - class DisplayAdFormatSetting(proto.Enum): - r"""Enumerates display ad format settings.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ALL_FORMATS = 2 - NON_NATIVE = 3 - NATIVE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/display_upload_product_type.py b/google/ads/googleads/v6/enums/types/display_upload_product_type.py deleted file mode 100644 index b63bd4f98..000000000 --- a/google/ads/googleads/v6/enums/types/display_upload_product_type.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DisplayUploadProductTypeEnum",}, -) - - -class DisplayUploadProductTypeEnum(proto.Message): - r"""Container for display upload product types. Product types - that have the word "DYNAMIC" in them must be associated with a - campaign that has a dynamic remarketing feed. See - https://support.google.com/google-ads/answer/6053288 for more - info about dynamic remarketing. Other product types are regarded - as "static" and do not have this requirement. - """ - - class DisplayUploadProductType(proto.Enum): - r"""Enumerates display upload product types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - HTML5_UPLOAD_AD = 2 - DYNAMIC_HTML5_EDUCATION_AD = 3 - DYNAMIC_HTML5_FLIGHT_AD = 4 - DYNAMIC_HTML5_HOTEL_RENTAL_AD = 5 - DYNAMIC_HTML5_JOB_AD = 6 - DYNAMIC_HTML5_LOCAL_AD = 7 - DYNAMIC_HTML5_REAL_ESTATE_AD = 8 - DYNAMIC_HTML5_CUSTOM_AD = 9 - DYNAMIC_HTML5_TRAVEL_AD = 10 - DYNAMIC_HTML5_HOTEL_AD = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/distance_bucket.py b/google/ads/googleads/v6/enums/types/distance_bucket.py deleted file mode 100644 index 822b3670a..000000000 --- a/google/ads/googleads/v6/enums/types/distance_bucket.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DistanceBucketEnum",}, -) - - -class DistanceBucketEnum(proto.Message): - r"""Container for distance buckets of a user’s distance from an - advertiser’s location extension. - """ - - class DistanceBucket(proto.Enum): - r"""The distance bucket for a user’s distance from an - advertiser’s location extension. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - WITHIN_700M = 2 - WITHIN_1KM = 3 - WITHIN_5KM = 4 - WITHIN_10KM = 5 - WITHIN_15KM = 6 - WITHIN_20KM = 7 - WITHIN_25KM = 8 - WITHIN_30KM = 9 - WITHIN_35KM = 10 - WITHIN_40KM = 11 - WITHIN_45KM = 12 - WITHIN_50KM = 13 - WITHIN_55KM = 14 - WITHIN_60KM = 15 - WITHIN_65KM = 16 - BEYOND_65KM = 17 - WITHIN_0_7MILES = 18 - WITHIN_1MILE = 19 - WITHIN_5MILES = 20 - WITHIN_10MILES = 21 - WITHIN_15MILES = 22 - WITHIN_20MILES = 23 - WITHIN_25MILES = 24 - WITHIN_30MILES = 25 - WITHIN_35MILES = 26 - WITHIN_40MILES = 27 - BEYOND_40MILES = 28 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/dsa_page_feed_criterion_field.py b/google/ads/googleads/v6/enums/types/dsa_page_feed_criterion_field.py deleted file mode 100644 index c96878974..000000000 --- a/google/ads/googleads/v6/enums/types/dsa_page_feed_criterion_field.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"DsaPageFeedCriterionFieldEnum",}, -) - - -class DsaPageFeedCriterionFieldEnum(proto.Message): - r"""Values for Dynamic Search Ad Page Feed criterion fields.""" - - class DsaPageFeedCriterionField(proto.Enum): - r"""Possible values for Dynamic Search Ad Page Feed criterion - fields. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - PAGE_URL = 2 - LABEL = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/education_placeholder_field.py b/google/ads/googleads/v6/enums/types/education_placeholder_field.py deleted file mode 100644 index b525a196d..000000000 --- a/google/ads/googleads/v6/enums/types/education_placeholder_field.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"EducationPlaceholderFieldEnum",}, -) - - -class EducationPlaceholderFieldEnum(proto.Message): - r"""Values for Education placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class EducationPlaceholderField(proto.Enum): - r"""Possible values for Education placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PROGRAM_ID = 2 - LOCATION_ID = 3 - PROGRAM_NAME = 4 - AREA_OF_STUDY = 5 - PROGRAM_DESCRIPTION = 6 - SCHOOL_NAME = 7 - ADDRESS = 8 - THUMBNAIL_IMAGE_URL = 9 - ALTERNATIVE_THUMBNAIL_IMAGE_URL = 10 - FINAL_URLS = 11 - FINAL_MOBILE_URLS = 12 - TRACKING_URL = 13 - CONTEXTUAL_KEYWORDS = 14 - ANDROID_APP_LINK = 15 - SIMILAR_PROGRAM_IDS = 16 - IOS_APP_LINK = 17 - IOS_APP_STORE_ID = 18 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/extension_type.py b/google/ads/googleads/v6/enums/types/extension_type.py deleted file mode 100644 index 64779a359..000000000 --- a/google/ads/googleads/v6/enums/types/extension_type.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ExtensionTypeEnum",}, -) - - -class ExtensionTypeEnum(proto.Message): - r"""Container for enum describing possible data types for an - extension in an extension setting. - """ - - class ExtensionType(proto.Enum): - r"""Possible data types for an extension in an extension setting.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NONE = 2 - APP = 3 - CALL = 4 - CALLOUT = 5 - MESSAGE = 6 - PRICE = 7 - PROMOTION = 8 - SITELINK = 10 - STRUCTURED_SNIPPET = 11 - LOCATION = 12 - AFFILIATE_LOCATION = 13 - HOTEL_CALLOUT = 15 - IMAGE = 16 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/external_conversion_source.py b/google/ads/googleads/v6/enums/types/external_conversion_source.py deleted file mode 100644 index 4fcb486a5..000000000 --- a/google/ads/googleads/v6/enums/types/external_conversion_source.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ExternalConversionSourceEnum",}, -) - - -class ExternalConversionSourceEnum(proto.Message): - r"""Container for enum describing the external conversion source - that is associated with a ConversionAction. - """ - - class ExternalConversionSource(proto.Enum): - r"""The external conversion source that is associated with a - ConversionAction. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - WEBPAGE = 2 - ANALYTICS = 3 - UPLOAD = 4 - AD_CALL_METRICS = 5 - WEBSITE_CALL_METRICS = 6 - STORE_VISITS = 7 - ANDROID_IN_APP = 8 - IOS_IN_APP = 9 - IOS_FIRST_OPEN = 10 - APP_UNSPECIFIED = 11 - ANDROID_FIRST_OPEN = 12 - UPLOAD_CALLS = 13 - FIREBASE = 14 - CLICK_TO_CALL = 15 - SALESFORCE = 16 - STORE_SALES_CRM = 17 - STORE_SALES_PAYMENT_NETWORK = 18 - GOOGLE_PLAY = 19 - THIRD_PARTY_APP_ANALYTICS = 20 - GOOGLE_ATTRIBUTION = 21 - STORE_SALES_DIRECT_UPLOAD = 23 - STORE_SALES = 24 - SEARCH_ADS_360 = 25 - GOOGLE_HOSTED = 27 - FLOODLIGHT = 29 - ANALYTICS_SEARCH_ADS_360 = 31 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_attribute_type.py b/google/ads/googleads/v6/enums/types/feed_attribute_type.py deleted file mode 100644 index fa43a6048..000000000 --- a/google/ads/googleads/v6/enums/types/feed_attribute_type.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedAttributeTypeEnum",}, -) - - -class FeedAttributeTypeEnum(proto.Message): - r"""Container for enum describing possible data types for a feed - attribute. - """ - - class FeedAttributeType(proto.Enum): - r"""Possible data types for a feed attribute.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INT64 = 2 - DOUBLE = 3 - STRING = 4 - BOOLEAN = 5 - URL = 6 - DATE_TIME = 7 - INT64_LIST = 8 - DOUBLE_LIST = 9 - STRING_LIST = 10 - BOOLEAN_LIST = 11 - URL_LIST = 12 - DATE_TIME_LIST = 13 - PRICE = 14 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_quality_approval_status.py b/google/ads/googleads/v6/enums/types/feed_item_quality_approval_status.py deleted file mode 100644 index 9074bd77e..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_quality_approval_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemQualityApprovalStatusEnum",}, -) - - -class FeedItemQualityApprovalStatusEnum(proto.Message): - r"""Container for enum describing possible quality evaluation - approval statuses of a feed item. - """ - - class FeedItemQualityApprovalStatus(proto.Enum): - r"""The possible quality evaluation approval statuses of a feed - item. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - APPROVED = 2 - DISAPPROVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_quality_disapproval_reason.py b/google/ads/googleads/v6/enums/types/feed_item_quality_disapproval_reason.py deleted file mode 100644 index c2a54da90..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_quality_disapproval_reason.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemQualityDisapprovalReasonEnum",}, -) - - -class FeedItemQualityDisapprovalReasonEnum(proto.Message): - r"""Container for enum describing possible quality evaluation - disapproval reasons of a feed item. - """ - - class FeedItemQualityDisapprovalReason(proto.Enum): - r"""The possible quality evaluation disapproval reasons of a feed - item. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - PRICE_TABLE_REPETITIVE_HEADERS = 2 - PRICE_TABLE_REPETITIVE_DESCRIPTION = 3 - PRICE_TABLE_INCONSISTENT_ROWS = 4 - PRICE_DESCRIPTION_HAS_PRICE_QUALIFIERS = 5 - PRICE_UNSUPPORTED_LANGUAGE = 6 - PRICE_TABLE_ROW_HEADER_TABLE_TYPE_MISMATCH = 7 - PRICE_TABLE_ROW_HEADER_HAS_PROMOTIONAL_TEXT = 8 - PRICE_TABLE_ROW_DESCRIPTION_NOT_RELEVANT = 9 - PRICE_TABLE_ROW_DESCRIPTION_HAS_PROMOTIONAL_TEXT = 10 - PRICE_TABLE_ROW_HEADER_DESCRIPTION_REPETITIVE = 11 - PRICE_TABLE_ROW_UNRATEABLE = 12 - PRICE_TABLE_ROW_PRICE_INVALID = 13 - PRICE_TABLE_ROW_URL_INVALID = 14 - PRICE_HEADER_OR_DESCRIPTION_HAS_PRICE = 15 - STRUCTURED_SNIPPETS_HEADER_POLICY_VIOLATED = 16 - STRUCTURED_SNIPPETS_REPEATED_VALUES = 17 - STRUCTURED_SNIPPETS_EDITORIAL_GUIDELINES = 18 - STRUCTURED_SNIPPETS_HAS_PROMOTIONAL_TEXT = 19 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_set_status.py b/google/ads/googleads/v6/enums/types/feed_item_set_status.py deleted file mode 100644 index e55d38bd0..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_set_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSetStatusEnum",}, -) - - -class FeedItemSetStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a feed - item set. - """ - - class FeedItemSetStatus(proto.Enum): - r"""Possible statuses of a feed item set.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_set_string_filter_type.py b/google/ads/googleads/v6/enums/types/feed_item_set_string_filter_type.py deleted file mode 100644 index f99803823..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_set_string_filter_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSetStringFilterTypeEnum",}, -) - - -class FeedItemSetStringFilterTypeEnum(proto.Message): - r"""The type of string matching to be used for a dynamic - FeedItemSet filter. - """ - - class FeedItemSetStringFilterType(proto.Enum): - r"""describe the possible types for a FeedItemSetStringFilter.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EXACT = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_status.py b/google/ads/googleads/v6/enums/types/feed_item_status.py deleted file mode 100644 index 4977d4e3c..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemStatusEnum",}, -) - - -class FeedItemStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a feed - item. - """ - - class FeedItemStatus(proto.Enum): - r"""Possible statuses of a feed item.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_target_device.py b/google/ads/googleads/v6/enums/types/feed_item_target_device.py deleted file mode 100644 index 89ab800c3..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_target_device.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemTargetDeviceEnum",}, -) - - -class FeedItemTargetDeviceEnum(proto.Message): - r"""Container for enum describing possible data types for a feed - item target device. - """ - - class FeedItemTargetDevice(proto.Enum): - r"""Possible data types for a feed item target device.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MOBILE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_target_status.py b/google/ads/googleads/v6/enums/types/feed_item_target_status.py deleted file mode 100644 index 285bcbc5a..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_target_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemTargetStatusEnum",}, -) - - -class FeedItemTargetStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a feed - item target. - """ - - class FeedItemTargetStatus(proto.Enum): - r"""Possible statuses of a feed item target.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_target_type.py b/google/ads/googleads/v6/enums/types/feed_item_target_type.py deleted file mode 100644 index 425d82e59..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_target_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemTargetTypeEnum",}, -) - - -class FeedItemTargetTypeEnum(proto.Message): - r"""Container for enum describing possible types of a feed item - target. - """ - - class FeedItemTargetType(proto.Enum): - r"""Possible type of a feed item target.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN = 2 - AD_GROUP = 3 - CRITERION = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_item_validation_status.py b/google/ads/googleads/v6/enums/types/feed_item_validation_status.py deleted file mode 100644 index 1ce95b301..000000000 --- a/google/ads/googleads/v6/enums/types/feed_item_validation_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedItemValidationStatusEnum",}, -) - - -class FeedItemValidationStatusEnum(proto.Message): - r"""Container for enum describing possible validation statuses of - a feed item. - """ - - class FeedItemValidationStatus(proto.Enum): - r"""The possible validation statuses of a feed item.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - INVALID = 3 - VALID = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_link_status.py b/google/ads/googleads/v6/enums/types/feed_link_status.py deleted file mode 100644 index 2ce05395d..000000000 --- a/google/ads/googleads/v6/enums/types/feed_link_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedLinkStatusEnum",}, -) - - -class FeedLinkStatusEnum(proto.Message): - r"""Container for an enum describing possible statuses of a feed - link. - """ - - class FeedLinkStatus(proto.Enum): - r"""Possible statuses of a feed link.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_mapping_criterion_type.py b/google/ads/googleads/v6/enums/types/feed_mapping_criterion_type.py deleted file mode 100644 index 0018145ee..000000000 --- a/google/ads/googleads/v6/enums/types/feed_mapping_criterion_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedMappingCriterionTypeEnum",}, -) - - -class FeedMappingCriterionTypeEnum(proto.Message): - r"""Container for enum describing possible criterion types for a - feed mapping. - """ - - class FeedMappingCriterionType(proto.Enum): - r"""Possible placeholder types for a feed mapping.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LOCATION_EXTENSION_TARGETING = 4 - DSA_PAGE_FEED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_mapping_status.py b/google/ads/googleads/v6/enums/types/feed_mapping_status.py deleted file mode 100644 index 5143033ed..000000000 --- a/google/ads/googleads/v6/enums/types/feed_mapping_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedMappingStatusEnum",}, -) - - -class FeedMappingStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a feed - mapping. - """ - - class FeedMappingStatus(proto.Enum): - r"""Possible statuses of a feed mapping.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_origin.py b/google/ads/googleads/v6/enums/types/feed_origin.py deleted file mode 100644 index dcb2a1b90..000000000 --- a/google/ads/googleads/v6/enums/types/feed_origin.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedOriginEnum",}, -) - - -class FeedOriginEnum(proto.Message): - r"""Container for enum describing possible values for a feed - origin. - """ - - class FeedOrigin(proto.Enum): - r"""Possible values for a feed origin.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - USER = 2 - GOOGLE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/feed_status.py b/google/ads/googleads/v6/enums/types/feed_status.py deleted file mode 100644 index d98394162..000000000 --- a/google/ads/googleads/v6/enums/types/feed_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FeedStatusEnum",}, -) - - -class FeedStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a feed.""" - - class FeedStatus(proto.Enum): - r"""Possible statuses of a feed.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/flight_placeholder_field.py b/google/ads/googleads/v6/enums/types/flight_placeholder_field.py deleted file mode 100644 index e15c5cebc..000000000 --- a/google/ads/googleads/v6/enums/types/flight_placeholder_field.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FlightPlaceholderFieldEnum",}, -) - - -class FlightPlaceholderFieldEnum(proto.Message): - r"""Values for Flight placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class FlightPlaceholderField(proto.Enum): - r"""Possible values for Flight placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DESTINATION_ID = 2 - ORIGIN_ID = 3 - FLIGHT_DESCRIPTION = 4 - ORIGIN_NAME = 5 - DESTINATION_NAME = 6 - FLIGHT_PRICE = 7 - FORMATTED_PRICE = 8 - FLIGHT_SALE_PRICE = 9 - FORMATTED_SALE_PRICE = 10 - IMAGE_URL = 11 - FINAL_URLS = 12 - FINAL_MOBILE_URLS = 13 - TRACKING_URL = 14 - ANDROID_APP_LINK = 15 - SIMILAR_DESTINATION_IDS = 16 - IOS_APP_LINK = 17 - IOS_APP_STORE_ID = 18 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/frequency_cap_event_type.py b/google/ads/googleads/v6/enums/types/frequency_cap_event_type.py deleted file mode 100644 index f1e5e07bc..000000000 --- a/google/ads/googleads/v6/enums/types/frequency_cap_event_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FrequencyCapEventTypeEnum",}, -) - - -class FrequencyCapEventTypeEnum(proto.Message): - r"""Container for enum describing the type of event that the cap - applies to. - """ - - class FrequencyCapEventType(proto.Enum): - r"""The type of event that the cap applies to (e.g. impression).""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IMPRESSION = 2 - VIDEO_VIEW = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/frequency_cap_time_unit.py b/google/ads/googleads/v6/enums/types/frequency_cap_time_unit.py deleted file mode 100644 index 17cf96b43..000000000 --- a/google/ads/googleads/v6/enums/types/frequency_cap_time_unit.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FrequencyCapTimeUnitEnum",}, -) - - -class FrequencyCapTimeUnitEnum(proto.Message): - r"""Container for enum describing the unit of time the cap is - defined at. - """ - - class FrequencyCapTimeUnit(proto.Enum): - r"""Unit of time the cap is defined at (e.g. day, week).""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DAY = 2 - WEEK = 3 - MONTH = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/gender_type.py b/google/ads/googleads/v6/enums/types/gender_type.py deleted file mode 100644 index 303b0d60b..000000000 --- a/google/ads/googleads/v6/enums/types/gender_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GenderTypeEnum",}, -) - - -class GenderTypeEnum(proto.Message): - r"""Container for enum describing the type of demographic - genders. - """ - - class GenderType(proto.Enum): - r"""The type of demographic genders (e.g. female).""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MALE = 10 - FEMALE = 11 - UNDETERMINED = 20 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/geo_target_constant_status.py b/google/ads/googleads/v6/enums/types/geo_target_constant_status.py deleted file mode 100644 index 476545053..000000000 --- a/google/ads/googleads/v6/enums/types/geo_target_constant_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GeoTargetConstantStatusEnum",}, -) - - -class GeoTargetConstantStatusEnum(proto.Message): - r"""Container for describing the status of a geo target constant.""" - - class GeoTargetConstantStatus(proto.Enum): - r"""The possible statuses of a geo target constant.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVAL_PLANNED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/geo_targeting_restriction.py b/google/ads/googleads/v6/enums/types/geo_targeting_restriction.py deleted file mode 100644 index 2d98d0963..000000000 --- a/google/ads/googleads/v6/enums/types/geo_targeting_restriction.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GeoTargetingRestrictionEnum",}, -) - - -class GeoTargetingRestrictionEnum(proto.Message): - r"""Message describing feed item geo targeting restriction.""" - - class GeoTargetingRestriction(proto.Enum): - r"""A restriction used to determine if the request context's - geo should be matched. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - LOCATION_OF_PRESENCE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/google_ads_field_category.py b/google/ads/googleads/v6/enums/types/google_ads_field_category.py deleted file mode 100644 index 9196a03f1..000000000 --- a/google/ads/googleads/v6/enums/types/google_ads_field_category.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GoogleAdsFieldCategoryEnum",}, -) - - -class GoogleAdsFieldCategoryEnum(proto.Message): - r"""Container for enum that determines if the described artifact - is a resource or a field, and if it is a field, when it segments - search queries. - """ - - class GoogleAdsFieldCategory(proto.Enum): - r"""The category of the artifact.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - RESOURCE = 2 - ATTRIBUTE = 3 - SEGMENT = 5 - METRIC = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/google_ads_field_data_type.py b/google/ads/googleads/v6/enums/types/google_ads_field_data_type.py deleted file mode 100644 index d5a141f34..000000000 --- a/google/ads/googleads/v6/enums/types/google_ads_field_data_type.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GoogleAdsFieldDataTypeEnum",}, -) - - -class GoogleAdsFieldDataTypeEnum(proto.Message): - r"""Container holding the various data types.""" - - class GoogleAdsFieldDataType(proto.Enum): - r"""These are the various types a GoogleAdsService artifact may - take on. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - BOOLEAN = 2 - DATE = 3 - DOUBLE = 4 - ENUM = 5 - FLOAT = 6 - INT32 = 7 - INT64 = 8 - MESSAGE = 9 - RESOURCE_NAME = 10 - STRING = 11 - UINT64 = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/google_voice_call_status.py b/google/ads/googleads/v6/enums/types/google_voice_call_status.py deleted file mode 100644 index ea6eab45b..000000000 --- a/google/ads/googleads/v6/enums/types/google_voice_call_status.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GoogleVoiceCallStatusEnum",}, -) - - -class GoogleVoiceCallStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a google - voice call. - """ - - class GoogleVoiceCallStatus(proto.Enum): - r"""Possible statuses of a google voice call.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MISSED = 2 - RECEIVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/hotel_date_selection_type.py b/google/ads/googleads/v6/enums/types/hotel_date_selection_type.py deleted file mode 100644 index 11ea502e0..000000000 --- a/google/ads/googleads/v6/enums/types/hotel_date_selection_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"HotelDateSelectionTypeEnum",}, -) - - -class HotelDateSelectionTypeEnum(proto.Message): - r"""Container for enum describing possible hotel date selection - types - """ - - class HotelDateSelectionType(proto.Enum): - r"""Enum describing possible hotel date selection types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DEFAULT_SELECTION = 50 - USER_SELECTED = 51 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/hotel_placeholder_field.py b/google/ads/googleads/v6/enums/types/hotel_placeholder_field.py deleted file mode 100644 index f94d1a9e4..000000000 --- a/google/ads/googleads/v6/enums/types/hotel_placeholder_field.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"HotelPlaceholderFieldEnum",}, -) - - -class HotelPlaceholderFieldEnum(proto.Message): - r"""Values for Hotel placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class HotelPlaceholderField(proto.Enum): - r"""Possible values for Hotel placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PROPERTY_ID = 2 - PROPERTY_NAME = 3 - DESTINATION_NAME = 4 - DESCRIPTION = 5 - ADDRESS = 6 - PRICE = 7 - FORMATTED_PRICE = 8 - SALE_PRICE = 9 - FORMATTED_SALE_PRICE = 10 - IMAGE_URL = 11 - CATEGORY = 12 - STAR_RATING = 13 - CONTEXTUAL_KEYWORDS = 14 - FINAL_URLS = 15 - FINAL_MOBILE_URLS = 16 - TRACKING_URL = 17 - ANDROID_APP_LINK = 18 - SIMILAR_PROPERTY_IDS = 19 - IOS_APP_LINK = 20 - IOS_APP_STORE_ID = 21 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/hotel_price_bucket.py b/google/ads/googleads/v6/enums/types/hotel_price_bucket.py deleted file mode 100644 index fa1a629cb..000000000 --- a/google/ads/googleads/v6/enums/types/hotel_price_bucket.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"HotelPriceBucketEnum",}, -) - - -class HotelPriceBucketEnum(proto.Message): - r"""Container for enum describing hotel price bucket for a hotel - itinerary. - """ - - class HotelPriceBucket(proto.Enum): - r"""Enum describing possible hotel price buckets.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LOWEST_UNIQUE = 2 - LOWEST_TIED = 3 - NOT_LOWEST = 4 - ONLY_PARTNER_SHOWN = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/hotel_rate_type.py b/google/ads/googleads/v6/enums/types/hotel_rate_type.py deleted file mode 100644 index ecd4b51a0..000000000 --- a/google/ads/googleads/v6/enums/types/hotel_rate_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"HotelRateTypeEnum",}, -) - - -class HotelRateTypeEnum(proto.Message): - r"""Container for enum describing possible hotel rate types.""" - - class HotelRateType(proto.Enum): - r"""Enum describing possible hotel rate types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UNAVAILABLE = 2 - PUBLIC_RATE = 3 - QUALIFIED_RATE = 4 - PRIVATE_RATE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/income_range_type.py b/google/ads/googleads/v6/enums/types/income_range_type.py deleted file mode 100644 index 0f895f22f..000000000 --- a/google/ads/googleads/v6/enums/types/income_range_type.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"IncomeRangeTypeEnum",}, -) - - -class IncomeRangeTypeEnum(proto.Message): - r"""Container for enum describing the type of demographic income - ranges. - """ - - class IncomeRangeType(proto.Enum): - r"""The type of demographic income ranges (e.g. between 0% to - 50%). - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INCOME_RANGE_0_50 = 510001 - INCOME_RANGE_50_60 = 510002 - INCOME_RANGE_60_70 = 510003 - INCOME_RANGE_70_80 = 510004 - INCOME_RANGE_80_90 = 510005 - INCOME_RANGE_90_UP = 510006 - INCOME_RANGE_UNDETERMINED = 510000 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/interaction_event_type.py b/google/ads/googleads/v6/enums/types/interaction_event_type.py deleted file mode 100644 index 6e4d5e614..000000000 --- a/google/ads/googleads/v6/enums/types/interaction_event_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"InteractionEventTypeEnum",}, -) - - -class InteractionEventTypeEnum(proto.Message): - r"""Container for enum describing types of payable and free - interactions. - """ - - class InteractionEventType(proto.Enum): - r"""Enum describing possible types of payable and free - interactions. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - CLICK = 2 - ENGAGEMENT = 3 - VIDEO_VIEW = 4 - NONE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/interaction_type.py b/google/ads/googleads/v6/enums/types/interaction_type.py deleted file mode 100644 index 73fe7350d..000000000 --- a/google/ads/googleads/v6/enums/types/interaction_type.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"InteractionTypeEnum",}, -) - - -class InteractionTypeEnum(proto.Message): - r"""Container for enum describing possible interaction types.""" - - class InteractionType(proto.Enum): - r"""Enum describing possible interaction types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CALLS = 8000 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/invoice_type.py b/google/ads/googleads/v6/enums/types/invoice_type.py deleted file mode 100644 index a62563cc1..000000000 --- a/google/ads/googleads/v6/enums/types/invoice_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"InvoiceTypeEnum",}, -) - - -class InvoiceTypeEnum(proto.Message): - r"""Container for enum describing the type of invoices.""" - - class InvoiceType(proto.Enum): - r"""The possible type of invoices.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CREDIT_MEMO = 2 - INVOICE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/job_placeholder_field.py b/google/ads/googleads/v6/enums/types/job_placeholder_field.py deleted file mode 100644 index 18202ca22..000000000 --- a/google/ads/googleads/v6/enums/types/job_placeholder_field.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"JobPlaceholderFieldEnum",}, -) - - -class JobPlaceholderFieldEnum(proto.Message): - r"""Values for Job placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class JobPlaceholderField(proto.Enum): - r"""Possible values for Job placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - JOB_ID = 2 - LOCATION_ID = 3 - TITLE = 4 - SUBTITLE = 5 - DESCRIPTION = 6 - IMAGE_URL = 7 - CATEGORY = 8 - CONTEXTUAL_KEYWORDS = 9 - ADDRESS = 10 - SALARY = 11 - FINAL_URLS = 12 - FINAL_MOBILE_URLS = 14 - TRACKING_URL = 15 - ANDROID_APP_LINK = 16 - SIMILAR_JOB_IDS = 17 - IOS_APP_LINK = 18 - IOS_APP_STORE_ID = 19 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/keyword_match_type.py b/google/ads/googleads/v6/enums/types/keyword_match_type.py deleted file mode 100644 index da77603e4..000000000 --- a/google/ads/googleads/v6/enums/types/keyword_match_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"KeywordMatchTypeEnum",}, -) - - -class KeywordMatchTypeEnum(proto.Message): - r"""Message describing Keyword match types.""" - - class KeywordMatchType(proto.Enum): - r"""Possible Keyword match types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EXACT = 2 - PHRASE = 3 - BROAD = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/keyword_plan_competition_level.py b/google/ads/googleads/v6/enums/types/keyword_plan_competition_level.py deleted file mode 100644 index 60b41093e..000000000 --- a/google/ads/googleads/v6/enums/types/keyword_plan_competition_level.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanCompetitionLevelEnum",}, -) - - -class KeywordPlanCompetitionLevelEnum(proto.Message): - r"""Container for enumeration of keyword competition levels. The - competition level indicates how competitive ad placement is for - a keyword and is determined by the number of advertisers bidding - on that keyword relative to all keywords across Google. The - competition level can depend on the location and Search Network - targeting options you've selected. - """ - - class KeywordPlanCompetitionLevel(proto.Enum): - r"""Competition level of a keyword.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LOW = 2 - MEDIUM = 3 - HIGH = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/keyword_plan_forecast_interval.py b/google/ads/googleads/v6/enums/types/keyword_plan_forecast_interval.py deleted file mode 100644 index cce64b512..000000000 --- a/google/ads/googleads/v6/enums/types/keyword_plan_forecast_interval.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanForecastIntervalEnum",}, -) - - -class KeywordPlanForecastIntervalEnum(proto.Message): - r"""Container for enumeration of forecast intervals.""" - - class KeywordPlanForecastInterval(proto.Enum): - r"""Forecast intervals.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NEXT_WEEK = 3 - NEXT_MONTH = 4 - NEXT_QUARTER = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/keyword_plan_network.py b/google/ads/googleads/v6/enums/types/keyword_plan_network.py deleted file mode 100644 index d06fe5c88..000000000 --- a/google/ads/googleads/v6/enums/types/keyword_plan_network.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanNetworkEnum",}, -) - - -class KeywordPlanNetworkEnum(proto.Message): - r"""Container for enumeration of keyword plan forecastable - network types. - """ - - class KeywordPlanNetwork(proto.Enum): - r"""Enumerates keyword plan forecastable network types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - GOOGLE_SEARCH = 2 - GOOGLE_SEARCH_AND_PARTNERS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/label_status.py b/google/ads/googleads/v6/enums/types/label_status.py deleted file mode 100644 index e2e76ee54..000000000 --- a/google/ads/googleads/v6/enums/types/label_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LabelStatusEnum",}, -) - - -class LabelStatusEnum(proto.Message): - r"""Container for enum describing possible status of a label.""" - - class LabelStatus(proto.Enum): - r"""Possible statuses of a label.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/lead_form_call_to_action_type.py b/google/ads/googleads/v6/enums/types/lead_form_call_to_action_type.py deleted file mode 100644 index f05c6e75b..000000000 --- a/google/ads/googleads/v6/enums/types/lead_form_call_to_action_type.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LeadFormCallToActionTypeEnum",}, -) - - -class LeadFormCallToActionTypeEnum(proto.Message): - r"""Describes the type of call-to-action phrases in a lead form.""" - - class LeadFormCallToActionType(proto.Enum): - r"""Enum describing the type of call-to-action phrases in a lead - form. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - LEARN_MORE = 2 - GET_QUOTE = 3 - APPLY_NOW = 4 - SIGN_UP = 5 - CONTACT_US = 6 - SUBSCRIBE = 7 - DOWNLOAD = 8 - BOOK_NOW = 9 - GET_OFFER = 10 - REGISTER = 11 - GET_INFO = 12 - REQUEST_DEMO = 13 - JOIN_NOW = 14 - GET_STARTED = 15 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/lead_form_desired_intent.py b/google/ads/googleads/v6/enums/types/lead_form_desired_intent.py deleted file mode 100644 index f92e76e57..000000000 --- a/google/ads/googleads/v6/enums/types/lead_form_desired_intent.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LeadFormDesiredIntentEnum",}, -) - - -class LeadFormDesiredIntentEnum(proto.Message): - r"""Describes the desired level of intent of generated leads.""" - - class LeadFormDesiredIntent(proto.Enum): - r"""Enum describing the desired level of intent of generated - leads. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - LOW_INTENT = 2 - HIGH_INTENT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/lead_form_field_user_input_type.py b/google/ads/googleads/v6/enums/types/lead_form_field_user_input_type.py deleted file mode 100644 index bdcfab4e7..000000000 --- a/google/ads/googleads/v6/enums/types/lead_form_field_user_input_type.py +++ /dev/null @@ -1,97 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LeadFormFieldUserInputTypeEnum",}, -) - - -class LeadFormFieldUserInputTypeEnum(proto.Message): - r"""Describes the input type of a lead form field.""" - - class LeadFormFieldUserInputType(proto.Enum): - r"""Enum describing the input type of a lead form field.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FULL_NAME = 2 - GIVEN_NAME = 6 - FAMILY_NAME = 7 - EMAIL = 3 - PHONE_NUMBER = 4 - POSTAL_CODE = 5 - CITY = 9 - REGION = 10 - COUNTRY = 11 - WORK_EMAIL = 12 - COMPANY_NAME = 13 - WORK_PHONE = 14 - JOB_TITLE = 15 - VEHICLE_MODEL = 1001 - VEHICLE_TYPE = 1002 - PREFERRED_DEALERSHIP = 1003 - VEHICLE_PURCHASE_TIMELINE = 1004 - VEHICLE_OWNERSHIP = 1005 - VEHICLE_PAYMENT_TYPE = 1009 - VEHICLE_CONDITION = 1010 - COMPANY_SIZE = 1006 - ANNUAL_SALES = 1007 - YEARS_IN_BUSINESS = 1008 - JOB_DEPARTMENT = 1011 - JOB_ROLE = 1012 - EDUCATION_PROGRAM = 1013 - EDUCATION_COURSE = 1014 - PRODUCT = 1016 - SERVICE = 1017 - OFFER = 1018 - CATEGORY = 1019 - PREFERRED_CONTACT_METHOD = 1020 - PREFERRED_LOCATION = 1021 - PREFERRED_CONTACT_TIME = 1022 - PURCHASE_TIMELINE = 1023 - YEARS_OF_EXPERIENCE = 1048 - JOB_INDUSTRY = 1049 - LEVEL_OF_EDUCATION = 1050 - PROPERTY_TYPE = 1024 - REALTOR_HELP_GOAL = 1025 - PROPERTY_COMMUNITY = 1026 - PRICE_RANGE = 1027 - NUMBER_OF_BEDROOMS = 1028 - FURNISHED_PROPERTY = 1029 - PETS_ALLOWED_PROPERTY = 1030 - NEXT_PLANNED_PURCHASE = 1031 - EVENT_SIGNUP_INTEREST = 1033 - PREFERRED_SHOPPING_PLACES = 1034 - FAVORITE_BRAND = 1035 - TRANSPORTATION_COMMERCIAL_LICENSE_TYPE = 1036 - EVENT_BOOKING_INTEREST = 1038 - DESTINATION_COUNTRY = 1039 - DESTINATION_CITY = 1040 - DEPARTURE_COUNTRY = 1041 - DEPARTURE_CITY = 1042 - DEPARTURE_DATE = 1043 - RETURN_DATE = 1044 - NUMBER_OF_TRAVELERS = 1045 - TRAVEL_BUDGET = 1046 - TRAVEL_ACCOMMODATION = 1047 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/lead_form_post_submit_call_to_action_type.py b/google/ads/googleads/v6/enums/types/lead_form_post_submit_call_to_action_type.py deleted file mode 100644 index ee123a386..000000000 --- a/google/ads/googleads/v6/enums/types/lead_form_post_submit_call_to_action_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LeadFormPostSubmitCallToActionTypeEnum",}, -) - - -class LeadFormPostSubmitCallToActionTypeEnum(proto.Message): - r"""Describes the type of post-submit call-to-action phrases for - a lead form. - """ - - class LeadFormPostSubmitCallToActionType(proto.Enum): - r"""Enum describing the type of post-submit call-to-action - phrases for a lead form. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - VISIT_SITE = 2 - DOWNLOAD = 3 - LEARN_MORE = 4 - SHOP_NOW = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/legacy_app_install_ad_app_store.py b/google/ads/googleads/v6/enums/types/legacy_app_install_ad_app_store.py deleted file mode 100644 index 01c3abe69..000000000 --- a/google/ads/googleads/v6/enums/types/legacy_app_install_ad_app_store.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LegacyAppInstallAdAppStoreEnum",}, -) - - -class LegacyAppInstallAdAppStoreEnum(proto.Message): - r"""Container for enum describing app store type in a legacy app - install ad. - """ - - class LegacyAppInstallAdAppStore(proto.Enum): - r"""App store type in a legacy app install ad.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APPLE_APP_STORE = 2 - GOOGLE_PLAY = 3 - WINDOWS_STORE = 4 - WINDOWS_PHONE_STORE = 5 - CN_APP_STORE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/linked_account_type.py b/google/ads/googleads/v6/enums/types/linked_account_type.py deleted file mode 100644 index fd96c5d85..000000000 --- a/google/ads/googleads/v6/enums/types/linked_account_type.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LinkedAccountTypeEnum",}, -) - - -class LinkedAccountTypeEnum(proto.Message): - r"""Container for enum describing different types of Linked - accounts. - """ - - class LinkedAccountType(proto.Enum): - r"""Describes the possible link types between a Google Ads - customer and another account. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - THIRD_PARTY_APP_ANALYTICS = 2 - DATA_PARTNER = 3 - GOOGLE_ADS = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/listing_group_type.py b/google/ads/googleads/v6/enums/types/listing_group_type.py deleted file mode 100644 index 9b483090c..000000000 --- a/google/ads/googleads/v6/enums/types/listing_group_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ListingGroupTypeEnum",}, -) - - -class ListingGroupTypeEnum(proto.Message): - r"""Container for enum describing the type of the listing group.""" - - class ListingGroupType(proto.Enum): - r"""The type of the listing group.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SUBDIVISION = 2 - UNIT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/local_placeholder_field.py b/google/ads/googleads/v6/enums/types/local_placeholder_field.py deleted file mode 100644 index 0437e938a..000000000 --- a/google/ads/googleads/v6/enums/types/local_placeholder_field.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LocalPlaceholderFieldEnum",}, -) - - -class LocalPlaceholderFieldEnum(proto.Message): - r"""Values for Local placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class LocalPlaceholderField(proto.Enum): - r"""Possible values for Local placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DEAL_ID = 2 - DEAL_NAME = 3 - SUBTITLE = 4 - DESCRIPTION = 5 - PRICE = 6 - FORMATTED_PRICE = 7 - SALE_PRICE = 8 - FORMATTED_SALE_PRICE = 9 - IMAGE_URL = 10 - ADDRESS = 11 - CATEGORY = 12 - CONTEXTUAL_KEYWORDS = 13 - FINAL_URLS = 14 - FINAL_MOBILE_URLS = 15 - TRACKING_URL = 16 - ANDROID_APP_LINK = 17 - SIMILAR_DEAL_IDS = 18 - IOS_APP_LINK = 19 - IOS_APP_STORE_ID = 20 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/location_extension_targeting_criterion_field.py b/google/ads/googleads/v6/enums/types/location_extension_targeting_criterion_field.py deleted file mode 100644 index 8aa71e2d1..000000000 --- a/google/ads/googleads/v6/enums/types/location_extension_targeting_criterion_field.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LocationExtensionTargetingCriterionFieldEnum",}, -) - - -class LocationExtensionTargetingCriterionFieldEnum(proto.Message): - r"""Values for Location Extension Targeting criterion fields.""" - - class LocationExtensionTargetingCriterionField(proto.Enum): - r"""Possible values for Location Extension Targeting criterion - fields. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ADDRESS_LINE_1 = 2 - ADDRESS_LINE_2 = 3 - CITY = 4 - PROVINCE = 5 - POSTAL_CODE = 6 - COUNTRY_CODE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/location_group_radius_units.py b/google/ads/googleads/v6/enums/types/location_group_radius_units.py deleted file mode 100644 index df694b536..000000000 --- a/google/ads/googleads/v6/enums/types/location_group_radius_units.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LocationGroupRadiusUnitsEnum",}, -) - - -class LocationGroupRadiusUnitsEnum(proto.Message): - r"""Container for enum describing unit of radius in location - group. - """ - - class LocationGroupRadiusUnits(proto.Enum): - r"""The unit of radius distance in location group (e.g. MILES)""" - UNSPECIFIED = 0 - UNKNOWN = 1 - METERS = 2 - MILES = 3 - MILLI_MILES = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/location_placeholder_field.py b/google/ads/googleads/v6/enums/types/location_placeholder_field.py deleted file mode 100644 index 684a22144..000000000 --- a/google/ads/googleads/v6/enums/types/location_placeholder_field.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LocationPlaceholderFieldEnum",}, -) - - -class LocationPlaceholderFieldEnum(proto.Message): - r"""Values for Location placeholder fields.""" - - class LocationPlaceholderField(proto.Enum): - r"""Possible values for Location placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BUSINESS_NAME = 2 - ADDRESS_LINE_1 = 3 - ADDRESS_LINE_2 = 4 - CITY = 5 - PROVINCE = 6 - POSTAL_CODE = 7 - COUNTRY_CODE = 8 - PHONE_NUMBER = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/location_source_type.py b/google/ads/googleads/v6/enums/types/location_source_type.py deleted file mode 100644 index 8750944dc..000000000 --- a/google/ads/googleads/v6/enums/types/location_source_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"LocationSourceTypeEnum",}, -) - - -class LocationSourceTypeEnum(proto.Message): - r"""Used to distinguish the location source type.""" - - class LocationSourceType(proto.Enum): - r"""The possible types of a location source.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - GOOGLE_MY_BUSINESS = 2 - AFFILIATE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/manager_link_status.py b/google/ads/googleads/v6/enums/types/manager_link_status.py deleted file mode 100644 index bc0eb0e06..000000000 --- a/google/ads/googleads/v6/enums/types/manager_link_status.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ManagerLinkStatusEnum",}, -) - - -class ManagerLinkStatusEnum(proto.Message): - r"""Container for enum describing possible status of a manager - and client link. - """ - - class ManagerLinkStatus(proto.Enum): - r"""Possible statuses of a link.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ACTIVE = 2 - INACTIVE = 3 - PENDING = 4 - REFUSED = 5 - CANCELED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/matching_function_context_type.py b/google/ads/googleads/v6/enums/types/matching_function_context_type.py deleted file mode 100644 index d0aebdada..000000000 --- a/google/ads/googleads/v6/enums/types/matching_function_context_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MatchingFunctionContextTypeEnum",}, -) - - -class MatchingFunctionContextTypeEnum(proto.Message): - r"""Container for context types for an operand in a matching - function. - """ - - class MatchingFunctionContextType(proto.Enum): - r"""Possible context types for an operand in a matching function.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ITEM_ID = 2 - DEVICE_NAME = 3 - FEED_ITEM_SET_ID = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/matching_function_operator.py b/google/ads/googleads/v6/enums/types/matching_function_operator.py deleted file mode 100644 index a9cff1097..000000000 --- a/google/ads/googleads/v6/enums/types/matching_function_operator.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MatchingFunctionOperatorEnum",}, -) - - -class MatchingFunctionOperatorEnum(proto.Message): - r"""Container for enum describing matching function operator.""" - - class MatchingFunctionOperator(proto.Enum): - r"""Possible operators in a matching function.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IN = 2 - IDENTITY = 3 - EQUALS = 4 - AND = 5 - CONTAINS_ANY = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/media_type.py b/google/ads/googleads/v6/enums/types/media_type.py deleted file mode 100644 index 702fdfc6d..000000000 --- a/google/ads/googleads/v6/enums/types/media_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MediaTypeEnum",}, -) - - -class MediaTypeEnum(proto.Message): - r"""Container for enum describing the types of media.""" - - class MediaType(proto.Enum): - r"""The type of media.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IMAGE = 2 - ICON = 3 - MEDIA_BUNDLE = 4 - AUDIO = 5 - VIDEO = 6 - DYNAMIC_IMAGE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/merchant_center_link_status.py b/google/ads/googleads/v6/enums/types/merchant_center_link_status.py deleted file mode 100644 index a688adc3d..000000000 --- a/google/ads/googleads/v6/enums/types/merchant_center_link_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MerchantCenterLinkStatusEnum",}, -) - - -class MerchantCenterLinkStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of a Google - Merchant Center link. - """ - - class MerchantCenterLinkStatus(proto.Enum): - r"""Describes the possible statuses for a link between a Google - Ads customer and a Google Merchant Center account. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - PENDING = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/message_placeholder_field.py b/google/ads/googleads/v6/enums/types/message_placeholder_field.py deleted file mode 100644 index c14fda0da..000000000 --- a/google/ads/googleads/v6/enums/types/message_placeholder_field.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MessagePlaceholderFieldEnum",}, -) - - -class MessagePlaceholderFieldEnum(proto.Message): - r"""Values for Message placeholder fields.""" - - class MessagePlaceholderField(proto.Enum): - r"""Possible values for Message placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BUSINESS_NAME = 2 - COUNTRY_CODE = 3 - PHONE_NUMBER = 4 - MESSAGE_EXTENSION_TEXT = 5 - MESSAGE_TEXT = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/mime_type.py b/google/ads/googleads/v6/enums/types/mime_type.py deleted file mode 100644 index 41d6bf223..000000000 --- a/google/ads/googleads/v6/enums/types/mime_type.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MimeTypeEnum",}, -) - - -class MimeTypeEnum(proto.Message): - r"""Container for enum describing the mime types.""" - - class MimeType(proto.Enum): - r"""The mime type""" - UNSPECIFIED = 0 - UNKNOWN = 1 - IMAGE_JPEG = 2 - IMAGE_GIF = 3 - IMAGE_PNG = 4 - FLASH = 5 - TEXT_HTML = 6 - PDF = 7 - MSWORD = 8 - MSEXCEL = 9 - RTF = 10 - AUDIO_WAV = 11 - AUDIO_MP3 = 12 - HTML5_AD_ZIP = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/minute_of_hour.py b/google/ads/googleads/v6/enums/types/minute_of_hour.py deleted file mode 100644 index 186db7896..000000000 --- a/google/ads/googleads/v6/enums/types/minute_of_hour.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MinuteOfHourEnum",}, -) - - -class MinuteOfHourEnum(proto.Message): - r"""Container for enumeration of quarter-hours.""" - - class MinuteOfHour(proto.Enum): - r"""Enumerates of quarter-hours. E.g. "FIFTEEN".""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ZERO = 2 - FIFTEEN = 3 - THIRTY = 4 - FORTY_FIVE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/mobile_app_vendor.py b/google/ads/googleads/v6/enums/types/mobile_app_vendor.py deleted file mode 100644 index c96bbbaca..000000000 --- a/google/ads/googleads/v6/enums/types/mobile_app_vendor.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MobileAppVendorEnum",}, -) - - -class MobileAppVendorEnum(proto.Message): - r"""Container for enum describing different types of mobile app - vendors. - """ - - class MobileAppVendor(proto.Enum): - r"""The type of mobile app vendor""" - UNSPECIFIED = 0 - UNKNOWN = 1 - APPLE_APP_STORE = 2 - GOOGLE_APP_STORE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/mobile_device_type.py b/google/ads/googleads/v6/enums/types/mobile_device_type.py deleted file mode 100644 index db76c8218..000000000 --- a/google/ads/googleads/v6/enums/types/mobile_device_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MobileDeviceTypeEnum",}, -) - - -class MobileDeviceTypeEnum(proto.Message): - r"""Container for enum describing the types of mobile device.""" - - class MobileDeviceType(proto.Enum): - r"""The type of mobile device.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MOBILE = 2 - TABLET = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/month_of_year.py b/google/ads/googleads/v6/enums/types/month_of_year.py deleted file mode 100644 index 040042adc..000000000 --- a/google/ads/googleads/v6/enums/types/month_of_year.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"MonthOfYearEnum",}, -) - - -class MonthOfYearEnum(proto.Message): - r"""Container for enumeration of months of the year, e.g., - "January". - """ - - class MonthOfYear(proto.Enum): - r"""Enumerates months of the year, e.g., "January".""" - UNSPECIFIED = 0 - UNKNOWN = 1 - JANUARY = 2 - FEBRUARY = 3 - MARCH = 4 - APRIL = 5 - MAY = 6 - JUNE = 7 - JULY = 8 - AUGUST = 9 - SEPTEMBER = 10 - OCTOBER = 11 - NOVEMBER = 12 - DECEMBER = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/negative_geo_target_type.py b/google/ads/googleads/v6/enums/types/negative_geo_target_type.py deleted file mode 100644 index 4d1c59e61..000000000 --- a/google/ads/googleads/v6/enums/types/negative_geo_target_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"NegativeGeoTargetTypeEnum",}, -) - - -class NegativeGeoTargetTypeEnum(proto.Message): - r"""Container for enum describing possible negative geo target - types. - """ - - class NegativeGeoTargetType(proto.Enum): - r"""The possible negative geo target types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PRESENCE_OR_INTEREST = 4 - PRESENCE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/offline_user_data_job_failure_reason.py b/google/ads/googleads/v6/enums/types/offline_user_data_job_failure_reason.py deleted file mode 100644 index c065f1be5..000000000 --- a/google/ads/googleads/v6/enums/types/offline_user_data_job_failure_reason.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"OfflineUserDataJobFailureReasonEnum",}, -) - - -class OfflineUserDataJobFailureReasonEnum(proto.Message): - r"""Container for enum describing reasons why an offline user - data job failed to be processed. - """ - - class OfflineUserDataJobFailureReason(proto.Enum): - r"""The failure reason of an offline user data job.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INSUFFICIENT_MATCHED_TRANSACTIONS = 2 - INSUFFICIENT_TRANSACTIONS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/offline_user_data_job_status.py b/google/ads/googleads/v6/enums/types/offline_user_data_job_status.py deleted file mode 100644 index 27da50f1f..000000000 --- a/google/ads/googleads/v6/enums/types/offline_user_data_job_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"OfflineUserDataJobStatusEnum",}, -) - - -class OfflineUserDataJobStatusEnum(proto.Message): - r"""Container for enum describing status of an offline user data - job. - """ - - class OfflineUserDataJobStatus(proto.Enum): - r"""The status of an offline user data job.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PENDING = 2 - RUNNING = 3 - SUCCESS = 4 - FAILED = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/offline_user_data_job_type.py b/google/ads/googleads/v6/enums/types/offline_user_data_job_type.py deleted file mode 100644 index c3943ee3f..000000000 --- a/google/ads/googleads/v6/enums/types/offline_user_data_job_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"OfflineUserDataJobTypeEnum",}, -) - - -class OfflineUserDataJobTypeEnum(proto.Message): - r"""Container for enum describing types of an offline user data - job. - """ - - class OfflineUserDataJobType(proto.Enum): - r"""The type of an offline user data job.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - STORE_SALES_UPLOAD_FIRST_PARTY = 2 - STORE_SALES_UPLOAD_THIRD_PARTY = 3 - CUSTOMER_MATCH_USER_LIST = 4 - CUSTOMER_MATCH_WITH_ATTRIBUTES = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/operating_system_version_operator_type.py b/google/ads/googleads/v6/enums/types/operating_system_version_operator_type.py deleted file mode 100644 index 9e179a070..000000000 --- a/google/ads/googleads/v6/enums/types/operating_system_version_operator_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"OperatingSystemVersionOperatorTypeEnum",}, -) - - -class OperatingSystemVersionOperatorTypeEnum(proto.Message): - r"""Container for enum describing the type of OS operators.""" - - class OperatingSystemVersionOperatorType(proto.Enum): - r"""The type of operating system version.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EQUALS_TO = 2 - GREATER_THAN_EQUALS_TO = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/optimization_goal_type.py b/google/ads/googleads/v6/enums/types/optimization_goal_type.py deleted file mode 100644 index e070d835e..000000000 --- a/google/ads/googleads/v6/enums/types/optimization_goal_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"OptimizationGoalTypeEnum",}, -) - - -class OptimizationGoalTypeEnum(proto.Message): - r"""Container for enum describing the type of optimization goal.""" - - class OptimizationGoalType(proto.Enum): - r"""The type of optimization goal""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CALL_CLICKS = 2 - DRIVING_DIRECTIONS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/parental_status_type.py b/google/ads/googleads/v6/enums/types/parental_status_type.py deleted file mode 100644 index 147a484db..000000000 --- a/google/ads/googleads/v6/enums/types/parental_status_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ParentalStatusTypeEnum",}, -) - - -class ParentalStatusTypeEnum(proto.Message): - r"""Container for enum describing the type of demographic - parental statuses. - """ - - class ParentalStatusType(proto.Enum): - r"""The type of parental statuses (e.g. not a parent).""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PARENT = 300 - NOT_A_PARENT = 301 - UNDETERMINED = 302 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/payment_mode.py b/google/ads/googleads/v6/enums/types/payment_mode.py deleted file mode 100644 index 1137f8a96..000000000 --- a/google/ads/googleads/v6/enums/types/payment_mode.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PaymentModeEnum",}, -) - - -class PaymentModeEnum(proto.Message): - r"""Container for enum describing possible payment modes.""" - - class PaymentMode(proto.Enum): - r"""Enum describing possible payment modes.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CLICKS = 4 - CONVERSION_VALUE = 5 - CONVERSIONS = 6 - GUEST_STAY = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/placeholder_type.py b/google/ads/googleads/v6/enums/types/placeholder_type.py deleted file mode 100644 index 24829c463..000000000 --- a/google/ads/googleads/v6/enums/types/placeholder_type.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PlaceholderTypeEnum",}, -) - - -class PlaceholderTypeEnum(proto.Message): - r"""Container for enum describing possible placeholder types for - a feed mapping. - """ - - class PlaceholderType(proto.Enum): - r"""Possible placeholder types for a feed mapping.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SITELINK = 2 - CALL = 3 - APP = 4 - LOCATION = 5 - AFFILIATE_LOCATION = 6 - CALLOUT = 7 - STRUCTURED_SNIPPET = 8 - MESSAGE = 9 - PRICE = 10 - PROMOTION = 11 - AD_CUSTOMIZER = 12 - DYNAMIC_EDUCATION = 13 - DYNAMIC_FLIGHT = 14 - DYNAMIC_CUSTOM = 15 - DYNAMIC_HOTEL = 16 - DYNAMIC_REAL_ESTATE = 17 - DYNAMIC_TRAVEL = 18 - DYNAMIC_LOCAL = 19 - DYNAMIC_JOB = 20 - IMAGE = 21 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/placement_type.py b/google/ads/googleads/v6/enums/types/placement_type.py deleted file mode 100644 index cc1d1810c..000000000 --- a/google/ads/googleads/v6/enums/types/placement_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PlacementTypeEnum",}, -) - - -class PlacementTypeEnum(proto.Message): - r"""Container for enum describing possible placement types.""" - - class PlacementType(proto.Enum): - r"""Possible placement types for a feed mapping.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - WEBSITE = 2 - MOBILE_APP_CATEGORY = 3 - MOBILE_APPLICATION = 4 - YOUTUBE_VIDEO = 5 - YOUTUBE_CHANNEL = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_approval_status.py b/google/ads/googleads/v6/enums/types/policy_approval_status.py deleted file mode 100644 index 37bb552e2..000000000 --- a/google/ads/googleads/v6/enums/types/policy_approval_status.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyApprovalStatusEnum",}, -) - - -class PolicyApprovalStatusEnum(proto.Message): - r"""Container for enum describing possible policy approval - statuses. - """ - - class PolicyApprovalStatus(proto.Enum): - r"""The possible policy approval statuses. When there are several - approval statuses available the most severe one will be used. The - order of severity is DISAPPROVED, AREA_OF_INTEREST_ONLY, - APPROVED_LIMITED and APPROVED. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - DISAPPROVED = 2 - APPROVED_LIMITED = 3 - APPROVED = 4 - AREA_OF_INTEREST_ONLY = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_review_status.py b/google/ads/googleads/v6/enums/types/policy_review_status.py deleted file mode 100644 index 83e0a711b..000000000 --- a/google/ads/googleads/v6/enums/types/policy_review_status.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyReviewStatusEnum",}, -) - - -class PolicyReviewStatusEnum(proto.Message): - r"""Container for enum describing possible policy review - statuses. - """ - - class PolicyReviewStatus(proto.Enum): - r"""The possible policy review statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REVIEW_IN_PROGRESS = 2 - REVIEWED = 3 - UNDER_APPEAL = 4 - ELIGIBLE_MAY_SERVE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_topic_entry_type.py b/google/ads/googleads/v6/enums/types/policy_topic_entry_type.py deleted file mode 100644 index 0cdf4b0e0..000000000 --- a/google/ads/googleads/v6/enums/types/policy_topic_entry_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyTopicEntryTypeEnum",}, -) - - -class PolicyTopicEntryTypeEnum(proto.Message): - r"""Container for enum describing possible policy topic entry - types. - """ - - class PolicyTopicEntryType(proto.Enum): - r"""The possible policy topic entry types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PROHIBITED = 2 - LIMITED = 4 - FULLY_LIMITED = 8 - DESCRIPTIVE = 5 - BROADENING = 6 - AREA_OF_INTEREST_ONLY = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_mismatch_url_type.py b/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_mismatch_url_type.py deleted file mode 100644 index 277f28139..000000000 --- a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_mismatch_url_type.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyTopicEvidenceDestinationMismatchUrlTypeEnum",}, -) - - -class PolicyTopicEvidenceDestinationMismatchUrlTypeEnum(proto.Message): - r"""Container for enum describing possible policy topic evidence - destination mismatch url types. - """ - - class PolicyTopicEvidenceDestinationMismatchUrlType(proto.Enum): - r"""The possible policy topic evidence destination mismatch url - types. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - DISPLAY_URL = 2 - FINAL_URL = 3 - FINAL_MOBILE_URL = 4 - TRACKING_URL = 5 - MOBILE_TRACKING_URL = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_device.py b/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_device.py deleted file mode 100644 index 50206929b..000000000 --- a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_device.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyTopicEvidenceDestinationNotWorkingDeviceEnum",}, -) - - -class PolicyTopicEvidenceDestinationNotWorkingDeviceEnum(proto.Message): - r"""Container for enum describing possible policy topic evidence - destination not working devices. - """ - - class PolicyTopicEvidenceDestinationNotWorkingDevice(proto.Enum): - r"""The possible policy topic evidence destination not working - devices. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - DESKTOP = 2 - ANDROID = 3 - IOS = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_dns_error_type.py b/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_dns_error_type.py deleted file mode 100644 index b48d7c760..000000000 --- a/google/ads/googleads/v6/enums/types/policy_topic_evidence_destination_not_working_dns_error_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum",}, -) - - -class PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum(proto.Message): - r"""Container for enum describing possible policy topic evidence - destination not working DNS error types. - """ - - class PolicyTopicEvidenceDestinationNotWorkingDnsErrorType(proto.Enum): - r"""The possible policy topic evidence destination not working - DNS error types. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - HOSTNAME_NOT_FOUND = 2 - GOOGLE_CRAWLER_DNS_ISSUE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/positive_geo_target_type.py b/google/ads/googleads/v6/enums/types/positive_geo_target_type.py deleted file mode 100644 index c8a6c3b8e..000000000 --- a/google/ads/googleads/v6/enums/types/positive_geo_target_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PositiveGeoTargetTypeEnum",}, -) - - -class PositiveGeoTargetTypeEnum(proto.Message): - r"""Container for enum describing possible positive geo target - types. - """ - - class PositiveGeoTargetType(proto.Enum): - r"""The possible positive geo target types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PRESENCE_OR_INTEREST = 5 - SEARCH_INTEREST = 6 - PRESENCE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/preferred_content_type.py b/google/ads/googleads/v6/enums/types/preferred_content_type.py deleted file mode 100644 index 88d44923f..000000000 --- a/google/ads/googleads/v6/enums/types/preferred_content_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PreferredContentTypeEnum",}, -) - - -class PreferredContentTypeEnum(proto.Message): - r"""Container for enumeration of preferred content criterion - type. - """ - - class PreferredContentType(proto.Enum): - r"""Enumerates preferred content criterion type.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - YOUTUBE_TOP_CONTENT = 400 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/price_extension_price_qualifier.py b/google/ads/googleads/v6/enums/types/price_extension_price_qualifier.py deleted file mode 100644 index 8b8676a2a..000000000 --- a/google/ads/googleads/v6/enums/types/price_extension_price_qualifier.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PriceExtensionPriceQualifierEnum",}, -) - - -class PriceExtensionPriceQualifierEnum(proto.Message): - r"""Container for enum describing a price extension price - qualifier. - """ - - class PriceExtensionPriceQualifier(proto.Enum): - r"""Enums of price extension price qualifier.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FROM = 2 - UP_TO = 3 - AVERAGE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/price_extension_price_unit.py b/google/ads/googleads/v6/enums/types/price_extension_price_unit.py deleted file mode 100644 index 60f08a998..000000000 --- a/google/ads/googleads/v6/enums/types/price_extension_price_unit.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PriceExtensionPriceUnitEnum",}, -) - - -class PriceExtensionPriceUnitEnum(proto.Message): - r"""Container for enum describing price extension price unit.""" - - class PriceExtensionPriceUnit(proto.Enum): - r"""Price extension price unit.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PER_HOUR = 2 - PER_DAY = 3 - PER_WEEK = 4 - PER_MONTH = 5 - PER_YEAR = 6 - PER_NIGHT = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/price_extension_type.py b/google/ads/googleads/v6/enums/types/price_extension_type.py deleted file mode 100644 index 2d4ac9e8c..000000000 --- a/google/ads/googleads/v6/enums/types/price_extension_type.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PriceExtensionTypeEnum",}, -) - - -class PriceExtensionTypeEnum(proto.Message): - r"""Container for enum describing types for a price extension.""" - - class PriceExtensionType(proto.Enum): - r"""Price extension type.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BRANDS = 2 - EVENTS = 3 - LOCATIONS = 4 - NEIGHBORHOODS = 5 - PRODUCT_CATEGORIES = 6 - PRODUCT_TIERS = 7 - SERVICES = 8 - SERVICE_CATEGORIES = 9 - SERVICE_TIERS = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/price_placeholder_field.py b/google/ads/googleads/v6/enums/types/price_placeholder_field.py deleted file mode 100644 index a580fb22d..000000000 --- a/google/ads/googleads/v6/enums/types/price_placeholder_field.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PricePlaceholderFieldEnum",}, -) - - -class PricePlaceholderFieldEnum(proto.Message): - r"""Values for Price placeholder fields.""" - - class PricePlaceholderField(proto.Enum): - r"""Possible values for Price placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TYPE = 2 - PRICE_QUALIFIER = 3 - TRACKING_TEMPLATE = 4 - LANGUAGE = 5 - FINAL_URL_SUFFIX = 6 - ITEM_1_HEADER = 100 - ITEM_1_DESCRIPTION = 101 - ITEM_1_PRICE = 102 - ITEM_1_UNIT = 103 - ITEM_1_FINAL_URLS = 104 - ITEM_1_FINAL_MOBILE_URLS = 105 - ITEM_2_HEADER = 200 - ITEM_2_DESCRIPTION = 201 - ITEM_2_PRICE = 202 - ITEM_2_UNIT = 203 - ITEM_2_FINAL_URLS = 204 - ITEM_2_FINAL_MOBILE_URLS = 205 - ITEM_3_HEADER = 300 - ITEM_3_DESCRIPTION = 301 - ITEM_3_PRICE = 302 - ITEM_3_UNIT = 303 - ITEM_3_FINAL_URLS = 304 - ITEM_3_FINAL_MOBILE_URLS = 305 - ITEM_4_HEADER = 400 - ITEM_4_DESCRIPTION = 401 - ITEM_4_PRICE = 402 - ITEM_4_UNIT = 403 - ITEM_4_FINAL_URLS = 404 - ITEM_4_FINAL_MOBILE_URLS = 405 - ITEM_5_HEADER = 500 - ITEM_5_DESCRIPTION = 501 - ITEM_5_PRICE = 502 - ITEM_5_UNIT = 503 - ITEM_5_FINAL_URLS = 504 - ITEM_5_FINAL_MOBILE_URLS = 505 - ITEM_6_HEADER = 600 - ITEM_6_DESCRIPTION = 601 - ITEM_6_PRICE = 602 - ITEM_6_UNIT = 603 - ITEM_6_FINAL_URLS = 604 - ITEM_6_FINAL_MOBILE_URLS = 605 - ITEM_7_HEADER = 700 - ITEM_7_DESCRIPTION = 701 - ITEM_7_PRICE = 702 - ITEM_7_UNIT = 703 - ITEM_7_FINAL_URLS = 704 - ITEM_7_FINAL_MOBILE_URLS = 705 - ITEM_8_HEADER = 800 - ITEM_8_DESCRIPTION = 801 - ITEM_8_PRICE = 802 - ITEM_8_UNIT = 803 - ITEM_8_FINAL_URLS = 804 - ITEM_8_FINAL_MOBILE_URLS = 805 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_bidding_category_level.py b/google/ads/googleads/v6/enums/types/product_bidding_category_level.py deleted file mode 100644 index 81069fb09..000000000 --- a/google/ads/googleads/v6/enums/types/product_bidding_category_level.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductBiddingCategoryLevelEnum",}, -) - - -class ProductBiddingCategoryLevelEnum(proto.Message): - r"""Level of a product bidding category.""" - - class ProductBiddingCategoryLevel(proto.Enum): - r"""Enum describing the level of the product bidding category.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LEVEL1 = 2 - LEVEL2 = 3 - LEVEL3 = 4 - LEVEL4 = 5 - LEVEL5 = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_bidding_category_status.py b/google/ads/googleads/v6/enums/types/product_bidding_category_status.py deleted file mode 100644 index 90917214a..000000000 --- a/google/ads/googleads/v6/enums/types/product_bidding_category_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductBiddingCategoryStatusEnum",}, -) - - -class ProductBiddingCategoryStatusEnum(proto.Message): - r"""Status of the product bidding category.""" - - class ProductBiddingCategoryStatus(proto.Enum): - r"""Enum describing the status of the product bidding category.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ACTIVE = 2 - OBSOLETE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_channel.py b/google/ads/googleads/v6/enums/types/product_channel.py deleted file mode 100644 index c2497c6d0..000000000 --- a/google/ads/googleads/v6/enums/types/product_channel.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductChannelEnum",}, -) - - -class ProductChannelEnum(proto.Message): - r"""Locality of a product offer.""" - - class ProductChannel(proto.Enum): - r"""Enum describing the locality of a product offer.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ONLINE = 2 - LOCAL = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_channel_exclusivity.py b/google/ads/googleads/v6/enums/types/product_channel_exclusivity.py deleted file mode 100644 index 3fbf7d109..000000000 --- a/google/ads/googleads/v6/enums/types/product_channel_exclusivity.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductChannelExclusivityEnum",}, -) - - -class ProductChannelExclusivityEnum(proto.Message): - r"""Availability of a product offer.""" - - class ProductChannelExclusivity(proto.Enum): - r"""Enum describing the availability of a product offer.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SINGLE_CHANNEL = 2 - MULTI_CHANNEL = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_condition.py b/google/ads/googleads/v6/enums/types/product_condition.py deleted file mode 100644 index c46071f15..000000000 --- a/google/ads/googleads/v6/enums/types/product_condition.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductConditionEnum",}, -) - - -class ProductConditionEnum(proto.Message): - r"""Condition of a product offer.""" - - class ProductCondition(proto.Enum): - r"""Enum describing the condition of a product offer.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NEW = 3 - REFURBISHED = 4 - USED = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_custom_attribute_index.py b/google/ads/googleads/v6/enums/types/product_custom_attribute_index.py deleted file mode 100644 index 18b09a5f6..000000000 --- a/google/ads/googleads/v6/enums/types/product_custom_attribute_index.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductCustomAttributeIndexEnum",}, -) - - -class ProductCustomAttributeIndexEnum(proto.Message): - r"""Container for enum describing the index of the product custom - attribute. - """ - - class ProductCustomAttributeIndex(proto.Enum): - r"""The index of the product custom attribute.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INDEX0 = 7 - INDEX1 = 8 - INDEX2 = 9 - INDEX3 = 10 - INDEX4 = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/product_type_level.py b/google/ads/googleads/v6/enums/types/product_type_level.py deleted file mode 100644 index 7a855e442..000000000 --- a/google/ads/googleads/v6/enums/types/product_type_level.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProductTypeLevelEnum",}, -) - - -class ProductTypeLevelEnum(proto.Message): - r"""Level of the type of a product offer.""" - - class ProductTypeLevel(proto.Enum): - r"""Enum describing the level of the type of a product offer.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LEVEL1 = 7 - LEVEL2 = 8 - LEVEL3 = 9 - LEVEL4 = 10 - LEVEL5 = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/promotion_extension_discount_modifier.py b/google/ads/googleads/v6/enums/types/promotion_extension_discount_modifier.py deleted file mode 100644 index 5bc3055b6..000000000 --- a/google/ads/googleads/v6/enums/types/promotion_extension_discount_modifier.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PromotionExtensionDiscountModifierEnum",}, -) - - -class PromotionExtensionDiscountModifierEnum(proto.Message): - r"""Container for enum describing possible a promotion extension - discount modifier. - """ - - class PromotionExtensionDiscountModifier(proto.Enum): - r"""A promotion extension discount modifier.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UP_TO = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/promotion_extension_occasion.py b/google/ads/googleads/v6/enums/types/promotion_extension_occasion.py deleted file mode 100644 index e48727110..000000000 --- a/google/ads/googleads/v6/enums/types/promotion_extension_occasion.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PromotionExtensionOccasionEnum",}, -) - - -class PromotionExtensionOccasionEnum(proto.Message): - r"""Container for enum describing a promotion extension occasion. - For more information about the occasions please check: - https://support.google.com/google-ads/answer/7367521 - """ - - class PromotionExtensionOccasion(proto.Enum): - r"""A promotion extension occasion.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NEW_YEARS = 2 - CHINESE_NEW_YEAR = 3 - VALENTINES_DAY = 4 - EASTER = 5 - MOTHERS_DAY = 6 - FATHERS_DAY = 7 - LABOR_DAY = 8 - BACK_TO_SCHOOL = 9 - HALLOWEEN = 10 - BLACK_FRIDAY = 11 - CYBER_MONDAY = 12 - CHRISTMAS = 13 - BOXING_DAY = 14 - INDEPENDENCE_DAY = 15 - NATIONAL_DAY = 16 - END_OF_SEASON = 17 - WINTER_SALE = 18 - SUMMER_SALE = 19 - FALL_SALE = 20 - SPRING_SALE = 21 - RAMADAN = 22 - EID_AL_FITR = 23 - EID_AL_ADHA = 24 - SINGLES_DAY = 25 - WOMENS_DAY = 26 - HOLI = 27 - PARENTS_DAY = 28 - ST_NICHOLAS_DAY = 29 - CARNIVAL = 30 - EPIPHANY = 31 - ROSH_HASHANAH = 32 - PASSOVER = 33 - HANUKKAH = 34 - DIWALI = 35 - NAVRATRI = 36 - SONGKRAN = 37 - YEAR_END_GIFT = 38 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/promotion_placeholder_field.py b/google/ads/googleads/v6/enums/types/promotion_placeholder_field.py deleted file mode 100644 index d4aaa3d55..000000000 --- a/google/ads/googleads/v6/enums/types/promotion_placeholder_field.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"PromotionPlaceholderFieldEnum",}, -) - - -class PromotionPlaceholderFieldEnum(proto.Message): - r"""Values for Promotion placeholder fields.""" - - class PromotionPlaceholderField(proto.Enum): - r"""Possible values for Promotion placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PROMOTION_TARGET = 2 - DISCOUNT_MODIFIER = 3 - PERCENT_OFF = 4 - MONEY_AMOUNT_OFF = 5 - PROMOTION_CODE = 6 - ORDERS_OVER_AMOUNT = 7 - PROMOTION_START = 8 - PROMOTION_END = 9 - OCCASION = 10 - FINAL_URLS = 11 - FINAL_MOBILE_URLS = 12 - TRACKING_URL = 13 - LANGUAGE = 14 - FINAL_URL_SUFFIX = 15 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/proximity_radius_units.py b/google/ads/googleads/v6/enums/types/proximity_radius_units.py deleted file mode 100644 index b4cd962c4..000000000 --- a/google/ads/googleads/v6/enums/types/proximity_radius_units.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ProximityRadiusUnitsEnum",}, -) - - -class ProximityRadiusUnitsEnum(proto.Message): - r"""Container for enum describing unit of radius in proximity.""" - - class ProximityRadiusUnits(proto.Enum): - r"""The unit of radius distance in proximity (e.g. MILES)""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MILES = 2 - KILOMETERS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/quality_score_bucket.py b/google/ads/googleads/v6/enums/types/quality_score_bucket.py deleted file mode 100644 index 7d2662f35..000000000 --- a/google/ads/googleads/v6/enums/types/quality_score_bucket.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"QualityScoreBucketEnum",}, -) - - -class QualityScoreBucketEnum(proto.Message): - r"""The relative performance compared to other advertisers.""" - - class QualityScoreBucket(proto.Enum): - r"""Enum listing the possible quality score buckets.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BELOW_AVERAGE = 2 - AVERAGE = 3 - ABOVE_AVERAGE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/reach_plan_ad_length.py b/google/ads/googleads/v6/enums/types/reach_plan_ad_length.py deleted file mode 100644 index e73499ebc..000000000 --- a/google/ads/googleads/v6/enums/types/reach_plan_ad_length.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ReachPlanAdLengthEnum",}, -) - - -class ReachPlanAdLengthEnum(proto.Message): - r"""Message describing length of a plannable video ad.""" - - class ReachPlanAdLength(proto.Enum): - r"""Possible ad length values.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SIX_SECONDS = 2 - FIFTEEN_OR_TWENTY_SECONDS = 3 - TWENTY_SECONDS_OR_MORE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/reach_plan_age_range.py b/google/ads/googleads/v6/enums/types/reach_plan_age_range.py deleted file mode 100644 index 7e3898895..000000000 --- a/google/ads/googleads/v6/enums/types/reach_plan_age_range.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ReachPlanAgeRangeEnum",}, -) - - -class ReachPlanAgeRangeEnum(proto.Message): - r"""Message describing plannable age ranges.""" - - class ReachPlanAgeRange(proto.Enum): - r"""Possible plannable age range values.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AGE_RANGE_18_24 = 503001 - AGE_RANGE_18_34 = 2 - AGE_RANGE_18_44 = 3 - AGE_RANGE_18_49 = 4 - AGE_RANGE_18_54 = 5 - AGE_RANGE_18_64 = 6 - AGE_RANGE_18_65_UP = 7 - AGE_RANGE_21_34 = 8 - AGE_RANGE_25_34 = 503002 - AGE_RANGE_25_44 = 9 - AGE_RANGE_25_49 = 10 - AGE_RANGE_25_54 = 11 - AGE_RANGE_25_64 = 12 - AGE_RANGE_25_65_UP = 13 - AGE_RANGE_35_44 = 503003 - AGE_RANGE_35_49 = 14 - AGE_RANGE_35_54 = 15 - AGE_RANGE_35_64 = 16 - AGE_RANGE_35_65_UP = 17 - AGE_RANGE_45_54 = 503004 - AGE_RANGE_45_64 = 18 - AGE_RANGE_45_65_UP = 19 - AGE_RANGE_50_65_UP = 20 - AGE_RANGE_55_64 = 503005 - AGE_RANGE_55_65_UP = 21 - AGE_RANGE_65_UP = 503006 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/reach_plan_network.py b/google/ads/googleads/v6/enums/types/reach_plan_network.py deleted file mode 100644 index 74f6cf61a..000000000 --- a/google/ads/googleads/v6/enums/types/reach_plan_network.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ReachPlanNetworkEnum",}, -) - - -class ReachPlanNetworkEnum(proto.Message): - r"""Container for enum describing plannable networks.""" - - class ReachPlanNetwork(proto.Enum): - r"""Possible plannable network values.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - YOUTUBE = 2 - GOOGLE_VIDEO_PARTNERS = 3 - YOUTUBE_AND_GOOGLE_VIDEO_PARTNERS = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/real_estate_placeholder_field.py b/google/ads/googleads/v6/enums/types/real_estate_placeholder_field.py deleted file mode 100644 index 281991a6b..000000000 --- a/google/ads/googleads/v6/enums/types/real_estate_placeholder_field.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"RealEstatePlaceholderFieldEnum",}, -) - - -class RealEstatePlaceholderFieldEnum(proto.Message): - r"""Values for Real Estate placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class RealEstatePlaceholderField(proto.Enum): - r"""Possible values for Real Estate placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LISTING_ID = 2 - LISTING_NAME = 3 - CITY_NAME = 4 - DESCRIPTION = 5 - ADDRESS = 6 - PRICE = 7 - FORMATTED_PRICE = 8 - IMAGE_URL = 9 - PROPERTY_TYPE = 10 - LISTING_TYPE = 11 - CONTEXTUAL_KEYWORDS = 12 - FINAL_URLS = 13 - FINAL_MOBILE_URLS = 14 - TRACKING_URL = 15 - ANDROID_APP_LINK = 16 - SIMILAR_LISTING_IDS = 17 - IOS_APP_LINK = 18 - IOS_APP_STORE_ID = 19 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/recommendation_type.py b/google/ads/googleads/v6/enums/types/recommendation_type.py deleted file mode 100644 index 3a7fd521c..000000000 --- a/google/ads/googleads/v6/enums/types/recommendation_type.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"RecommendationTypeEnum",}, -) - - -class RecommendationTypeEnum(proto.Message): - r"""Container for enum describing types of recommendations.""" - - class RecommendationType(proto.Enum): - r"""Types of recommendations.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN_BUDGET = 2 - KEYWORD = 3 - TEXT_AD = 4 - TARGET_CPA_OPT_IN = 5 - MAXIMIZE_CONVERSIONS_OPT_IN = 6 - ENHANCED_CPC_OPT_IN = 7 - SEARCH_PARTNERS_OPT_IN = 8 - MAXIMIZE_CLICKS_OPT_IN = 9 - OPTIMIZE_AD_ROTATION = 10 - CALLOUT_EXTENSION = 11 - SITELINK_EXTENSION = 12 - CALL_EXTENSION = 13 - KEYWORD_MATCH_TYPE = 14 - MOVE_UNUSED_BUDGET = 15 - FORECASTING_CAMPAIGN_BUDGET = 16 - TARGET_ROAS_OPT_IN = 17 - RESPONSIVE_SEARCH_AD = 18 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/resource_change_operation.py b/google/ads/googleads/v6/enums/types/resource_change_operation.py deleted file mode 100644 index a65604d80..000000000 --- a/google/ads/googleads/v6/enums/types/resource_change_operation.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ResourceChangeOperationEnum",}, -) - - -class ResourceChangeOperationEnum(proto.Message): - r"""Container for enum describing resource change operations - in the ChangeEvent resource. - """ - - class ResourceChangeOperation(proto.Enum): - r"""The operation on the changed resource in change_event resource.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CREATE = 2 - UPDATE = 3 - REMOVE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/response_content_type.py b/google/ads/googleads/v6/enums/types/response_content_type.py deleted file mode 100644 index 8625b8ad2..000000000 --- a/google/ads/googleads/v6/enums/types/response_content_type.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ResponseContentTypeEnum",}, -) - - -class ResponseContentTypeEnum(proto.Message): - r"""Container for possible response content types.""" - - class ResponseContentType(proto.Enum): - r"""Possible response content types.""" - UNSPECIFIED = 0 - RESOURCE_NAME_ONLY = 1 - MUTABLE_RESOURCE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/search_engine_results_page_type.py b/google/ads/googleads/v6/enums/types/search_engine_results_page_type.py deleted file mode 100644 index 6bc64cb2f..000000000 --- a/google/ads/googleads/v6/enums/types/search_engine_results_page_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SearchEngineResultsPageTypeEnum",}, -) - - -class SearchEngineResultsPageTypeEnum(proto.Message): - r"""The type of the search engine results page.""" - - class SearchEngineResultsPageType(proto.Enum): - r"""The type of the search engine results page.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ADS_ONLY = 2 - ORGANIC_ONLY = 3 - ADS_AND_ORGANIC = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/search_term_match_type.py b/google/ads/googleads/v6/enums/types/search_term_match_type.py deleted file mode 100644 index 64a8bc2d1..000000000 --- a/google/ads/googleads/v6/enums/types/search_term_match_type.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SearchTermMatchTypeEnum",}, -) - - -class SearchTermMatchTypeEnum(proto.Message): - r"""Container for enum describing match types for a keyword - triggering an ad. - """ - - class SearchTermMatchType(proto.Enum): - r"""Possible match types for a keyword triggering an ad, - including variants. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - BROAD = 2 - EXACT = 3 - PHRASE = 4 - NEAR_EXACT = 5 - NEAR_PHRASE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/search_term_targeting_status.py b/google/ads/googleads/v6/enums/types/search_term_targeting_status.py deleted file mode 100644 index 71784058c..000000000 --- a/google/ads/googleads/v6/enums/types/search_term_targeting_status.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SearchTermTargetingStatusEnum",}, -) - - -class SearchTermTargetingStatusEnum(proto.Message): - r"""Container for enum indicating whether a search term is one of - your targeted or excluded keywords. - """ - - class SearchTermTargetingStatus(proto.Enum): - r"""Indicates whether the search term is one of your targeted or - excluded keywords. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ADDED = 2 - EXCLUDED = 3 - ADDED_EXCLUDED = 4 - NONE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/served_asset_field_type.py b/google/ads/googleads/v6/enums/types/served_asset_field_type.py deleted file mode 100644 index 8f8c536f0..000000000 --- a/google/ads/googleads/v6/enums/types/served_asset_field_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ServedAssetFieldTypeEnum",}, -) - - -class ServedAssetFieldTypeEnum(proto.Message): - r"""Container for enum describing possible asset field types.""" - - class ServedAssetFieldType(proto.Enum): - r"""The possible asset field types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - HEADLINE_1 = 2 - HEADLINE_2 = 3 - HEADLINE_3 = 4 - DESCRIPTION_1 = 5 - DESCRIPTION_2 = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/shared_set_status.py b/google/ads/googleads/v6/enums/types/shared_set_status.py deleted file mode 100644 index 0b6369410..000000000 --- a/google/ads/googleads/v6/enums/types/shared_set_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SharedSetStatusEnum",}, -) - - -class SharedSetStatusEnum(proto.Message): - r"""Container for enum describing types of shared set statuses.""" - - class SharedSetStatus(proto.Enum): - r"""Enum listing the possible shared set statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - REMOVED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/shared_set_type.py b/google/ads/googleads/v6/enums/types/shared_set_type.py deleted file mode 100644 index 4818d89fd..000000000 --- a/google/ads/googleads/v6/enums/types/shared_set_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SharedSetTypeEnum",}, -) - - -class SharedSetTypeEnum(proto.Message): - r"""Container for enum describing types of shared sets.""" - - class SharedSetType(proto.Enum): - r"""Enum listing the possible shared set types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NEGATIVE_KEYWORDS = 2 - NEGATIVE_PLACEMENTS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/simulation_modification_method.py b/google/ads/googleads/v6/enums/types/simulation_modification_method.py deleted file mode 100644 index 57b2c217c..000000000 --- a/google/ads/googleads/v6/enums/types/simulation_modification_method.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SimulationModificationMethodEnum",}, -) - - -class SimulationModificationMethodEnum(proto.Message): - r"""Container for enum describing the method by which a - simulation modifies a field. - """ - - class SimulationModificationMethod(proto.Enum): - r"""Enum describing the method by which a simulation modifies a - field. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - UNIFORM = 2 - DEFAULT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/simulation_type.py b/google/ads/googleads/v6/enums/types/simulation_type.py deleted file mode 100644 index ef0ec8727..000000000 --- a/google/ads/googleads/v6/enums/types/simulation_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SimulationTypeEnum",}, -) - - -class SimulationTypeEnum(proto.Message): - r"""Container for enum describing the field a simulation - modifies. - """ - - class SimulationType(proto.Enum): - r"""Enum describing the field a simulation modifies.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CPC_BID = 2 - CPV_BID = 3 - TARGET_CPA = 4 - BID_MODIFIER = 5 - TARGET_ROAS = 6 - PERCENT_CPC_BID = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/sitelink_placeholder_field.py b/google/ads/googleads/v6/enums/types/sitelink_placeholder_field.py deleted file mode 100644 index a81e9a323..000000000 --- a/google/ads/googleads/v6/enums/types/sitelink_placeholder_field.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SitelinkPlaceholderFieldEnum",}, -) - - -class SitelinkPlaceholderFieldEnum(proto.Message): - r"""Values for Sitelink placeholder fields.""" - - class SitelinkPlaceholderField(proto.Enum): - r"""Possible values for Sitelink placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TEXT = 2 - LINE_1 = 3 - LINE_2 = 4 - FINAL_URLS = 5 - FINAL_MOBILE_URLS = 6 - TRACKING_URL = 7 - FINAL_URL_SUFFIX = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/slot.py b/google/ads/googleads/v6/enums/types/slot.py deleted file mode 100644 index 38e00d927..000000000 --- a/google/ads/googleads/v6/enums/types/slot.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SlotEnum",}, -) - - -class SlotEnum(proto.Message): - r"""Container for enumeration of possible positions of the Ad.""" - - class Slot(proto.Enum): - r"""Enumerates possible positions of the Ad.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SEARCH_SIDE = 2 - SEARCH_TOP = 3 - SEARCH_OTHER = 4 - CONTENT = 5 - SEARCH_PARTNER_TOP = 6 - SEARCH_PARTNER_OTHER = 7 - MIXED = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/spending_limit_type.py b/google/ads/googleads/v6/enums/types/spending_limit_type.py deleted file mode 100644 index 654448dfd..000000000 --- a/google/ads/googleads/v6/enums/types/spending_limit_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SpendingLimitTypeEnum",}, -) - - -class SpendingLimitTypeEnum(proto.Message): - r"""Message describing spending limit types.""" - - class SpendingLimitType(proto.Enum): - r"""The possible spending limit types used by certain resources - as an alternative to absolute money values in micros. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INFINITE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/structured_snippet_placeholder_field.py b/google/ads/googleads/v6/enums/types/structured_snippet_placeholder_field.py deleted file mode 100644 index da93c1e1e..000000000 --- a/google/ads/googleads/v6/enums/types/structured_snippet_placeholder_field.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"StructuredSnippetPlaceholderFieldEnum",}, -) - - -class StructuredSnippetPlaceholderFieldEnum(proto.Message): - r"""Values for Structured Snippet placeholder fields.""" - - class StructuredSnippetPlaceholderField(proto.Enum): - r"""Possible values for Structured Snippet placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - HEADER = 2 - SNIPPETS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/summary_row_setting.py b/google/ads/googleads/v6/enums/types/summary_row_setting.py deleted file mode 100644 index 36f24ef3e..000000000 --- a/google/ads/googleads/v6/enums/types/summary_row_setting.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SummaryRowSettingEnum",}, -) - - -class SummaryRowSettingEnum(proto.Message): - r"""Indicates summary row setting in request parameter.""" - - class SummaryRowSetting(proto.Enum): - r"""Enum describing return summary row settings.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NO_SUMMARY_ROW = 2 - SUMMARY_ROW_WITH_RESULTS = 3 - SUMMARY_ROW_ONLY = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/system_managed_entity_source.py b/google/ads/googleads/v6/enums/types/system_managed_entity_source.py deleted file mode 100644 index a05988268..000000000 --- a/google/ads/googleads/v6/enums/types/system_managed_entity_source.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"SystemManagedResourceSourceEnum",}, -) - - -class SystemManagedResourceSourceEnum(proto.Message): - r"""Container for enum describing possible system managed entity - sources. - """ - - class SystemManagedResourceSource(proto.Enum): - r"""Enum listing the possible system managed entity sources.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_VARIATIONS = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/target_cpa_opt_in_recommendation_goal.py b/google/ads/googleads/v6/enums/types/target_cpa_opt_in_recommendation_goal.py deleted file mode 100644 index 6b58ca253..000000000 --- a/google/ads/googleads/v6/enums/types/target_cpa_opt_in_recommendation_goal.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TargetCpaOptInRecommendationGoalEnum",}, -) - - -class TargetCpaOptInRecommendationGoalEnum(proto.Message): - r"""Container for enum describing goals for TargetCpaOptIn - recommendation. - """ - - class TargetCpaOptInRecommendationGoal(proto.Enum): - r"""Goal of TargetCpaOptIn recommendation.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SAME_COST = 2 - SAME_CONVERSIONS = 3 - SAME_CPA = 4 - CLOSEST_CPA = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/target_impression_share_location.py b/google/ads/googleads/v6/enums/types/target_impression_share_location.py deleted file mode 100644 index 0a5df48e0..000000000 --- a/google/ads/googleads/v6/enums/types/target_impression_share_location.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TargetImpressionShareLocationEnum",}, -) - - -class TargetImpressionShareLocationEnum(proto.Message): - r"""Container for enum describing where on the first search - results page the automated bidding system should target - impressions for the TargetImpressionShare bidding strategy. - """ - - class TargetImpressionShareLocation(proto.Enum): - r"""Enum describing possible goals.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ANYWHERE_ON_PAGE = 2 - TOP_OF_PAGE = 3 - ABSOLUTE_TOP_OF_PAGE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/targeting_dimension.py b/google/ads/googleads/v6/enums/types/targeting_dimension.py deleted file mode 100644 index f3cc56c7d..000000000 --- a/google/ads/googleads/v6/enums/types/targeting_dimension.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TargetingDimensionEnum",}, -) - - -class TargetingDimensionEnum(proto.Message): - r"""The dimensions that can be targeted.""" - - class TargetingDimension(proto.Enum): - r"""Enum describing possible targeting dimensions.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - KEYWORD = 2 - AUDIENCE = 3 - TOPIC = 4 - GENDER = 5 - AGE_RANGE = 6 - PLACEMENT = 7 - PARENTAL_STATUS = 8 - INCOME_RANGE = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/time_type.py b/google/ads/googleads/v6/enums/types/time_type.py deleted file mode 100644 index a6d26d54b..000000000 --- a/google/ads/googleads/v6/enums/types/time_type.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TimeTypeEnum",}, -) - - -class TimeTypeEnum(proto.Message): - r"""Message describing time types.""" - - class TimeType(proto.Enum): - r"""The possible time types used by certain resources as an - alternative to absolute timestamps. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - NOW = 2 - FOREVER = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/tracking_code_page_format.py b/google/ads/googleads/v6/enums/types/tracking_code_page_format.py deleted file mode 100644 index a0c20189a..000000000 --- a/google/ads/googleads/v6/enums/types/tracking_code_page_format.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TrackingCodePageFormatEnum",}, -) - - -class TrackingCodePageFormatEnum(proto.Message): - r"""Container for enum describing the format of the web page - where the tracking tag and snippet will be installed. - """ - - class TrackingCodePageFormat(proto.Enum): - r"""The format of the web page where the tracking tag and snippet - will be installed. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - HTML = 2 - AMP = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/tracking_code_type.py b/google/ads/googleads/v6/enums/types/tracking_code_type.py deleted file mode 100644 index dcd721335..000000000 --- a/google/ads/googleads/v6/enums/types/tracking_code_type.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TrackingCodeTypeEnum",}, -) - - -class TrackingCodeTypeEnum(proto.Message): - r"""Container for enum describing the type of the generated tag - snippets for tracking conversions. - """ - - class TrackingCodeType(proto.Enum): - r"""The type of the generated tag snippets for tracking - conversions. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - WEBPAGE = 2 - WEBPAGE_ONCLICK = 3 - CLICK_TO_CALL = 4 - WEBSITE_CALL = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/travel_placeholder_field.py b/google/ads/googleads/v6/enums/types/travel_placeholder_field.py deleted file mode 100644 index 7ebe4902b..000000000 --- a/google/ads/googleads/v6/enums/types/travel_placeholder_field.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"TravelPlaceholderFieldEnum",}, -) - - -class TravelPlaceholderFieldEnum(proto.Message): - r"""Values for Travel placeholder fields. - For more information about dynamic remarketing feeds, see - https://support.google.com/google-ads/answer/6053288. - """ - - class TravelPlaceholderField(proto.Enum): - r"""Possible values for Travel placeholder fields.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DESTINATION_ID = 2 - ORIGIN_ID = 3 - TITLE = 4 - DESTINATION_NAME = 5 - ORIGIN_NAME = 6 - PRICE = 7 - FORMATTED_PRICE = 8 - SALE_PRICE = 9 - FORMATTED_SALE_PRICE = 10 - IMAGE_URL = 11 - CATEGORY = 12 - CONTEXTUAL_KEYWORDS = 13 - DESTINATION_ADDRESS = 14 - FINAL_URL = 15 - FINAL_MOBILE_URLS = 16 - TRACKING_URL = 17 - ANDROID_APP_LINK = 18 - SIMILAR_DESTINATION_IDS = 19 - IOS_APP_LINK = 20 - IOS_APP_STORE_ID = 21 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_identifier_source.py b/google/ads/googleads/v6/enums/types/user_identifier_source.py deleted file mode 100644 index 7410ee646..000000000 --- a/google/ads/googleads/v6/enums/types/user_identifier_source.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserIdentifierSourceEnum",}, -) - - -class UserIdentifierSourceEnum(proto.Message): - r"""Container for enum describing the source of the user - identifier for offline Store Sales third party uploads. - """ - - class UserIdentifierSource(proto.Enum): - r"""The type of user identifier source for offline Store Sales - third party uploads. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - FIRST_PARTY = 2 - THIRD_PARTY = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_interest_taxonomy_type.py b/google/ads/googleads/v6/enums/types/user_interest_taxonomy_type.py deleted file mode 100644 index df9567e95..000000000 --- a/google/ads/googleads/v6/enums/types/user_interest_taxonomy_type.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserInterestTaxonomyTypeEnum",}, -) - - -class UserInterestTaxonomyTypeEnum(proto.Message): - r"""Message describing a UserInterestTaxonomyType.""" - - class UserInterestTaxonomyType(proto.Enum): - r"""Enum containing the possible UserInterestTaxonomyTypes.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AFFINITY = 2 - IN_MARKET = 3 - MOBILE_APP_INSTALL_USER = 4 - VERTICAL_GEO = 5 - NEW_SMART_PHONE_USER = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_access_status.py b/google/ads/googleads/v6/enums/types/user_list_access_status.py deleted file mode 100644 index e8a209aeb..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_access_status.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListAccessStatusEnum",}, -) - - -class UserListAccessStatusEnum(proto.Message): - r"""Indicates if this client still has access to the list.""" - - class UserListAccessStatus(proto.Enum): - r"""Enum containing possible user list access statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENABLED = 2 - DISABLED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_closing_reason.py b/google/ads/googleads/v6/enums/types/user_list_closing_reason.py deleted file mode 100644 index 5bfc786b5..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_closing_reason.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListClosingReasonEnum",}, -) - - -class UserListClosingReasonEnum(proto.Message): - r"""Indicates the reason why the userlist was closed. - This enum is only used when a list is auto-closed by the system. - """ - - class UserListClosingReason(proto.Enum): - r"""Enum describing possible user list closing reasons.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UNUSED = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_combined_rule_operator.py b/google/ads/googleads/v6/enums/types/user_list_combined_rule_operator.py deleted file mode 100644 index 3cf730fea..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_combined_rule_operator.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListCombinedRuleOperatorEnum",}, -) - - -class UserListCombinedRuleOperatorEnum(proto.Message): - r"""Logical operator connecting two rules.""" - - class UserListCombinedRuleOperator(proto.Enum): - r"""Enum describing possible user list combined rule operators.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AND = 2 - AND_NOT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_crm_data_source_type.py b/google/ads/googleads/v6/enums/types/user_list_crm_data_source_type.py deleted file mode 100644 index 93c7053df..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_crm_data_source_type.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListCrmDataSourceTypeEnum",}, -) - - -class UserListCrmDataSourceTypeEnum(proto.Message): - r"""Indicates source of Crm upload data.""" - - class UserListCrmDataSourceType(proto.Enum): - r"""Enum describing possible user list crm data source type.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FIRST_PARTY = 2 - THIRD_PARTY_CREDIT_BUREAU = 3 - THIRD_PARTY_VOTER_FILE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_date_rule_item_operator.py b/google/ads/googleads/v6/enums/types/user_list_date_rule_item_operator.py deleted file mode 100644 index 3415ed3a9..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_date_rule_item_operator.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListDateRuleItemOperatorEnum",}, -) - - -class UserListDateRuleItemOperatorEnum(proto.Message): - r"""Supported rule operator for date type.""" - - class UserListDateRuleItemOperator(proto.Enum): - r"""Enum describing possible user list date rule item operators.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EQUALS = 2 - NOT_EQUALS = 3 - BEFORE = 4 - AFTER = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_logical_rule_operator.py b/google/ads/googleads/v6/enums/types/user_list_logical_rule_operator.py deleted file mode 100644 index d3b8cf7f9..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_logical_rule_operator.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListLogicalRuleOperatorEnum",}, -) - - -class UserListLogicalRuleOperatorEnum(proto.Message): - r"""The logical operator of the rule.""" - - class UserListLogicalRuleOperator(proto.Enum): - r"""Enum describing possible user list logical rule operators.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ALL = 2 - ANY = 3 - NONE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_membership_status.py b/google/ads/googleads/v6/enums/types/user_list_membership_status.py deleted file mode 100644 index b0fcff8ad..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_membership_status.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListMembershipStatusEnum",}, -) - - -class UserListMembershipStatusEnum(proto.Message): - r"""Membership status of this user list. Indicates whether a user - list is open or active. Only open user lists can accumulate more - users and can be used for targeting. - """ - - class UserListMembershipStatus(proto.Enum): - r"""Enum containing possible user list membership statuses.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPEN = 2 - CLOSED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_number_rule_item_operator.py b/google/ads/googleads/v6/enums/types/user_list_number_rule_item_operator.py deleted file mode 100644 index fa8dd7683..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_number_rule_item_operator.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListNumberRuleItemOperatorEnum",}, -) - - -class UserListNumberRuleItemOperatorEnum(proto.Message): - r"""Supported rule operator for number type.""" - - class UserListNumberRuleItemOperator(proto.Enum): - r"""Enum describing possible user list number rule item - operators. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - GREATER_THAN = 2 - GREATER_THAN_OR_EQUAL = 3 - EQUALS = 4 - NOT_EQUALS = 5 - LESS_THAN = 6 - LESS_THAN_OR_EQUAL = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_prepopulation_status.py b/google/ads/googleads/v6/enums/types/user_list_prepopulation_status.py deleted file mode 100644 index 5e92a878a..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_prepopulation_status.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListPrepopulationStatusEnum",}, -) - - -class UserListPrepopulationStatusEnum(proto.Message): - r"""Indicates status of prepopulation based on the rule.""" - - class UserListPrepopulationStatus(proto.Enum): - r"""Enum describing possible user list prepopulation status.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REQUESTED = 2 - FINISHED = 3 - FAILED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_rule_type.py b/google/ads/googleads/v6/enums/types/user_list_rule_type.py deleted file mode 100644 index ae23e9e04..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_rule_type.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListRuleTypeEnum",}, -) - - -class UserListRuleTypeEnum(proto.Message): - r"""Rule based user list rule type.""" - - class UserListRuleType(proto.Enum): - r"""Enum describing possible user list rule types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AND_OF_ORS = 2 - OR_OF_ANDS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_size_range.py b/google/ads/googleads/v6/enums/types/user_list_size_range.py deleted file mode 100644 index 90194f8fa..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_size_range.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListSizeRangeEnum",}, -) - - -class UserListSizeRangeEnum(proto.Message): - r"""Size range in terms of number of users of a UserList.""" - - class UserListSizeRange(proto.Enum): - r"""Enum containing possible user list size ranges.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LESS_THAN_FIVE_HUNDRED = 2 - LESS_THAN_ONE_THOUSAND = 3 - ONE_THOUSAND_TO_TEN_THOUSAND = 4 - TEN_THOUSAND_TO_FIFTY_THOUSAND = 5 - FIFTY_THOUSAND_TO_ONE_HUNDRED_THOUSAND = 6 - ONE_HUNDRED_THOUSAND_TO_THREE_HUNDRED_THOUSAND = 7 - THREE_HUNDRED_THOUSAND_TO_FIVE_HUNDRED_THOUSAND = 8 - FIVE_HUNDRED_THOUSAND_TO_ONE_MILLION = 9 - ONE_MILLION_TO_TWO_MILLION = 10 - TWO_MILLION_TO_THREE_MILLION = 11 - THREE_MILLION_TO_FIVE_MILLION = 12 - FIVE_MILLION_TO_TEN_MILLION = 13 - TEN_MILLION_TO_TWENTY_MILLION = 14 - TWENTY_MILLION_TO_THIRTY_MILLION = 15 - THIRTY_MILLION_TO_FIFTY_MILLION = 16 - OVER_FIFTY_MILLION = 17 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_string_rule_item_operator.py b/google/ads/googleads/v6/enums/types/user_list_string_rule_item_operator.py deleted file mode 100644 index 726846335..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_string_rule_item_operator.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListStringRuleItemOperatorEnum",}, -) - - -class UserListStringRuleItemOperatorEnum(proto.Message): - r"""Supported rule operator for string type.""" - - class UserListStringRuleItemOperator(proto.Enum): - r"""Enum describing possible user list string rule item - operators. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - CONTAINS = 2 - EQUALS = 3 - STARTS_WITH = 4 - ENDS_WITH = 5 - NOT_EQUALS = 6 - NOT_CONTAINS = 7 - NOT_STARTS_WITH = 8 - NOT_ENDS_WITH = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/user_list_type.py b/google/ads/googleads/v6/enums/types/user_list_type.py deleted file mode 100644 index 07196be8b..000000000 --- a/google/ads/googleads/v6/enums/types/user_list_type.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"UserListTypeEnum",}, -) - - -class UserListTypeEnum(proto.Message): - r"""The user list types.""" - - class UserListType(proto.Enum): - r"""Enum containing possible user list types.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REMARKETING = 2 - LOGICAL = 3 - EXTERNAL_REMARKETING = 4 - RULE_BASED = 5 - SIMILAR = 6 - CRM_BASED = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/vanity_pharma_display_url_mode.py b/google/ads/googleads/v6/enums/types/vanity_pharma_display_url_mode.py deleted file mode 100644 index b8fd18ccd..000000000 --- a/google/ads/googleads/v6/enums/types/vanity_pharma_display_url_mode.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"VanityPharmaDisplayUrlModeEnum",}, -) - - -class VanityPharmaDisplayUrlModeEnum(proto.Message): - r"""The display mode for vanity pharma URLs.""" - - class VanityPharmaDisplayUrlMode(proto.Enum): - r"""Enum describing possible display modes for vanity pharma - URLs. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - MANUFACTURER_WEBSITE_URL = 2 - WEBSITE_DESCRIPTION = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/vanity_pharma_text.py b/google/ads/googleads/v6/enums/types/vanity_pharma_text.py deleted file mode 100644 index ef5a3286a..000000000 --- a/google/ads/googleads/v6/enums/types/vanity_pharma_text.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"VanityPharmaTextEnum",}, -) - - -class VanityPharmaTextEnum(proto.Message): - r"""The text that will be displayed in display URL of the text ad - when website description is the selected display mode for vanity - pharma URLs. - """ - - class VanityPharmaText(proto.Enum): - r"""Enum describing possible text.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PRESCRIPTION_TREATMENT_WEBSITE_EN = 2 - PRESCRIPTION_TREATMENT_WEBSITE_ES = 3 - PRESCRIPTION_DEVICE_WEBSITE_EN = 4 - PRESCRIPTION_DEVICE_WEBSITE_ES = 5 - MEDICAL_DEVICE_WEBSITE_EN = 6 - MEDICAL_DEVICE_WEBSITE_ES = 7 - PREVENTATIVE_TREATMENT_WEBSITE_EN = 8 - PREVENTATIVE_TREATMENT_WEBSITE_ES = 9 - PRESCRIPTION_CONTRACEPTION_WEBSITE_EN = 10 - PRESCRIPTION_CONTRACEPTION_WEBSITE_ES = 11 - PRESCRIPTION_VACCINE_WEBSITE_EN = 12 - PRESCRIPTION_VACCINE_WEBSITE_ES = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/webpage_condition_operand.py b/google/ads/googleads/v6/enums/types/webpage_condition_operand.py deleted file mode 100644 index b49390de6..000000000 --- a/google/ads/googleads/v6/enums/types/webpage_condition_operand.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"WebpageConditionOperandEnum",}, -) - - -class WebpageConditionOperandEnum(proto.Message): - r"""Container for enum describing webpage condition operand in - webpage criterion. - """ - - class WebpageConditionOperand(proto.Enum): - r"""The webpage condition operand in webpage criterion.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - URL = 2 - CATEGORY = 3 - PAGE_TITLE = 4 - PAGE_CONTENT = 5 - CUSTOM_LABEL = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/webpage_condition_operator.py b/google/ads/googleads/v6/enums/types/webpage_condition_operator.py deleted file mode 100644 index 635f67e2c..000000000 --- a/google/ads/googleads/v6/enums/types/webpage_condition_operator.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"WebpageConditionOperatorEnum",}, -) - - -class WebpageConditionOperatorEnum(proto.Message): - r"""Container for enum describing webpage condition operator in - webpage criterion. - """ - - class WebpageConditionOperator(proto.Enum): - r"""The webpage condition operator in webpage criterion.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EQUALS = 2 - CONTAINS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/__init__.py b/google/ads/googleads/v6/errors/__init__.py deleted file mode 100644 index 98fb60957..000000000 --- a/google/ads/googleads/v6/errors/__init__.py +++ /dev/null @@ -1,146 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - - -__all__ = ( - "AccountBudgetProposalErrorEnum", - "AccountLinkErrorEnum", - "AdCustomizerErrorEnum", - "AdErrorEnum", - "AdGroupAdErrorEnum", - "AdGroupBidModifierErrorEnum", - "AdGroupCriterionErrorEnum", - "AdGroupErrorEnum", - "AdGroupFeedErrorEnum", - "AdParameterErrorEnum", - "AdSharingErrorEnum", - "AdxErrorEnum", - "AssetErrorEnum", - "AssetLinkErrorEnum", - "AuthenticationErrorEnum", - "AuthorizationErrorEnum", - "BatchJobErrorEnum", - "BiddingErrorEnum", - "BiddingStrategyErrorEnum", - "BillingSetupErrorEnum", - "CampaignBudgetErrorEnum", - "CampaignCriterionErrorEnum", - "CampaignDraftErrorEnum", - "CampaignErrorEnum", - "CampaignExperimentErrorEnum", - "CampaignFeedErrorEnum", - "CampaignSharedSetErrorEnum", - "ChangeEventErrorEnum", - "ChangeStatusErrorEnum", - "CollectionSizeErrorEnum", - "ContextErrorEnum", - "ConversionActionErrorEnum", - "ConversionAdjustmentUploadErrorEnum", - "ConversionUploadErrorEnum", - "CountryCodeErrorEnum", - "CriterionErrorEnum", - "CurrencyCodeErrorEnum", - "CustomAudienceErrorEnum", - "CustomInterestErrorEnum", - "CustomerClientLinkErrorEnum", - "CustomerErrorEnum", - "CustomerFeedErrorEnum", - "CustomerManagerLinkErrorEnum", - "CustomerUserAccessErrorEnum", - "DatabaseErrorEnum", - "DateErrorEnum", - "DateRangeErrorEnum", - "DistinctErrorEnum", - "EnumErrorEnum", - "ErrorCode", - "ErrorDetails", - "ErrorLocation", - "ExtensionFeedItemErrorEnum", - "ExtensionSettingErrorEnum", - "FeedAttributeReferenceErrorEnum", - "FeedErrorEnum", - "FeedItemErrorEnum", - "FeedItemSetErrorEnum", - "FeedItemSetLinkErrorEnum", - "FeedItemTargetErrorEnum", - "FeedItemValidationErrorEnum", - "FeedMappingErrorEnum", - "FieldErrorEnum", - "FieldMaskErrorEnum", - "FunctionErrorEnum", - "FunctionParsingErrorEnum", - "GeoTargetConstantSuggestionErrorEnum", - "GoogleAdsError", - "GoogleAdsFailure", - "HeaderErrorEnum", - "IdErrorEnum", - "ImageErrorEnum", - "InternalErrorEnum", - "InvoiceErrorEnum", - "KeywordPlanAdGroupErrorEnum", - "KeywordPlanAdGroupKeywordErrorEnum", - "KeywordPlanCampaignErrorEnum", - "KeywordPlanCampaignKeywordErrorEnum", - "KeywordPlanErrorEnum", - "KeywordPlanIdeaErrorEnum", - "LabelErrorEnum", - "LanguageCodeErrorEnum", - "ListOperationErrorEnum", - "ManagerLinkErrorEnum", - "MediaBundleErrorEnum", - "MediaFileErrorEnum", - "MediaUploadErrorEnum", - "MultiplierErrorEnum", - "MutateErrorEnum", - "NewResourceCreationErrorEnum", - "NotAllowlistedErrorEnum", - "NotEmptyErrorEnum", - "NullErrorEnum", - "OfflineUserDataJobErrorEnum", - "OperationAccessDeniedErrorEnum", - "OperatorErrorEnum", - "PartialFailureErrorEnum", - "PaymentsAccountErrorEnum", - "PolicyFindingDetails", - "PolicyFindingErrorEnum", - "PolicyValidationParameterErrorEnum", - "PolicyViolationDetails", - "PolicyViolationErrorEnum", - "QueryErrorEnum", - "QuotaErrorDetails", - "QuotaErrorEnum", - "RangeErrorEnum", - "ReachPlanErrorEnum", - "RecommendationErrorEnum", - "RegionCodeErrorEnum", - "RequestErrorEnum", - "ResourceAccessDeniedErrorEnum", - "ResourceCountLimitExceededErrorEnum", - "SettingErrorEnum", - "SharedCriterionErrorEnum", - "SharedSetErrorEnum", - "SizeLimitErrorEnum", - "StringFormatErrorEnum", - "StringLengthErrorEnum", - "ThirdPartyAppAnalyticsLinkErrorEnum", - "TimeZoneErrorEnum", - "UrlFieldErrorEnum", - "UserDataErrorEnum", - "UserListErrorEnum", - "YoutubeVideoRegistrationErrorEnum", - "AccessInvitationErrorEnum", -) diff --git a/google/ads/googleads/v6/errors/services/__init__.py b/google/ads/googleads/v6/errors/services/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/errors/services/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/errors/types/__init__.py b/google/ads/googleads/v6/errors/types/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/errors/types/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/errors/types/access_invitation_error.py b/google/ads/googleads/v6/errors/types/access_invitation_error.py deleted file mode 100644 index 5648b445c..000000000 --- a/google/ads/googleads/v6/errors/types/access_invitation_error.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AccessInvitationErrorEnum",}, -) - - -class AccessInvitationErrorEnum(proto.Message): - r"""Container for enum describing possible AccessInvitation - errors. - """ - - class AccessInvitationError(proto.Enum): - r"""Enum describing possible AccessInvitation errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_EMAIL_ADDRESS = 2 - EMAIL_ADDRESS_ALREADY_HAS_ACCESS = 3 - INVALID_INVITATION_STATUS = 4 - GOOGLE_CONSUMER_ACCOUNT_NOT_ALLOWED = 5 - INVALID_INVITATION_ID = 6 - EMAIL_ADDRESS_ALREADY_HAS_PENDING_INVITATION = 7 - PENDING_INVITATIONS_LIMIT_EXCEEDED = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/account_budget_proposal_error.py b/google/ads/googleads/v6/errors/types/account_budget_proposal_error.py deleted file mode 100644 index 26e8ee5a2..000000000 --- a/google/ads/googleads/v6/errors/types/account_budget_proposal_error.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AccountBudgetProposalErrorEnum",}, -) - - -class AccountBudgetProposalErrorEnum(proto.Message): - r"""Container for enum describing possible account budget - proposal errors. - """ - - class AccountBudgetProposalError(proto.Enum): - r"""Enum describing possible account budget proposal errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FIELD_MASK_NOT_ALLOWED = 2 - IMMUTABLE_FIELD = 3 - REQUIRED_FIELD_MISSING = 4 - CANNOT_CANCEL_APPROVED_PROPOSAL = 5 - CANNOT_REMOVE_UNAPPROVED_BUDGET = 6 - CANNOT_REMOVE_RUNNING_BUDGET = 7 - CANNOT_END_UNAPPROVED_BUDGET = 8 - CANNOT_END_INACTIVE_BUDGET = 9 - BUDGET_NAME_REQUIRED = 10 - CANNOT_UPDATE_OLD_BUDGET = 11 - CANNOT_END_IN_PAST = 12 - CANNOT_EXTEND_END_TIME = 13 - PURCHASE_ORDER_NUMBER_REQUIRED = 14 - PENDING_UPDATE_PROPOSAL_EXISTS = 15 - MULTIPLE_BUDGETS_NOT_ALLOWED_FOR_UNAPPROVED_BILLING_SETUP = 16 - CANNOT_UPDATE_START_TIME_FOR_STARTED_BUDGET = 17 - SPENDING_LIMIT_LOWER_THAN_ACCRUED_COST_NOT_ALLOWED = 18 - UPDATE_IS_NO_OP = 19 - END_TIME_MUST_FOLLOW_START_TIME = 20 - BUDGET_DATE_RANGE_INCOMPATIBLE_WITH_BILLING_SETUP = 21 - NOT_AUTHORIZED = 22 - INVALID_BILLING_SETUP = 23 - OVERLAPS_EXISTING_BUDGET = 24 - CANNOT_CREATE_BUDGET_THROUGH_API = 25 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/account_link_error.py b/google/ads/googleads/v6/errors/types/account_link_error.py deleted file mode 100644 index 68408345d..000000000 --- a/google/ads/googleads/v6/errors/types/account_link_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AccountLinkErrorEnum",}, -) - - -class AccountLinkErrorEnum(proto.Message): - r"""Container for enum describing possible account link errors.""" - - class AccountLinkError(proto.Enum): - r"""Enum describing possible account link errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_STATUS = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_customizer_error.py b/google/ads/googleads/v6/errors/types/ad_customizer_error.py deleted file mode 100644 index 89e701935..000000000 --- a/google/ads/googleads/v6/errors/types/ad_customizer_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdCustomizerErrorEnum",}, -) - - -class AdCustomizerErrorEnum(proto.Message): - r"""Container for enum describing possible ad customizer errors.""" - - class AdCustomizerError(proto.Enum): - r"""Enum describing possible ad customizer errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - COUNTDOWN_INVALID_DATE_FORMAT = 2 - COUNTDOWN_DATE_IN_PAST = 3 - COUNTDOWN_INVALID_LOCALE = 4 - COUNTDOWN_INVALID_START_DAYS_BEFORE = 5 - UNKNOWN_USER_LIST = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_error.py b/google/ads/googleads/v6/errors/types/ad_error.py deleted file mode 100644 index 01482f696..000000000 --- a/google/ads/googleads/v6/errors/types/ad_error.py +++ /dev/null @@ -1,181 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdErrorEnum",}, -) - - -class AdErrorEnum(proto.Message): - r"""Container for enum describing possible ad errors.""" - - class AdError(proto.Enum): - r"""Enum describing possible ad errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_CUSTOMIZERS_NOT_SUPPORTED_FOR_AD_TYPE = 2 - APPROXIMATELY_TOO_LONG = 3 - APPROXIMATELY_TOO_SHORT = 4 - BAD_SNIPPET = 5 - CANNOT_MODIFY_AD = 6 - CANNOT_SET_BUSINESS_NAME_IF_URL_SET = 7 - CANNOT_SET_FIELD = 8 - CANNOT_SET_FIELD_WITH_ORIGIN_AD_ID_SET = 9 - CANNOT_SET_FIELD_WITH_AD_ID_SET_FOR_SHARING = 10 - CANNOT_SET_ALLOW_FLEXIBLE_COLOR_FALSE = 11 - CANNOT_SET_COLOR_CONTROL_WHEN_NATIVE_FORMAT_SETTING = 12 - CANNOT_SET_URL = 13 - CANNOT_SET_WITHOUT_FINAL_URLS = 14 - CANNOT_SET_WITH_FINAL_URLS = 15 - CANNOT_SET_WITH_URL_DATA = 17 - CANNOT_USE_AD_SUBCLASS_FOR_OPERATOR = 18 - CUSTOMER_NOT_APPROVED_MOBILEADS = 19 - CUSTOMER_NOT_APPROVED_THIRDPARTY_ADS = 20 - CUSTOMER_NOT_APPROVED_THIRDPARTY_REDIRECT_ADS = 21 - CUSTOMER_NOT_ELIGIBLE = 22 - CUSTOMER_NOT_ELIGIBLE_FOR_UPDATING_BEACON_URL = 23 - DIMENSION_ALREADY_IN_UNION = 24 - DIMENSION_MUST_BE_SET = 25 - DIMENSION_NOT_IN_UNION = 26 - DISPLAY_URL_CANNOT_BE_SPECIFIED = 27 - DOMESTIC_PHONE_NUMBER_FORMAT = 28 - EMERGENCY_PHONE_NUMBER = 29 - EMPTY_FIELD = 30 - FEED_ATTRIBUTE_MUST_HAVE_MAPPING_FOR_TYPE_ID = 31 - FEED_ATTRIBUTE_MAPPING_TYPE_MISMATCH = 32 - ILLEGAL_AD_CUSTOMIZER_TAG_USE = 33 - ILLEGAL_TAG_USE = 34 - INCONSISTENT_DIMENSIONS = 35 - INCONSISTENT_STATUS_IN_TEMPLATE_UNION = 36 - INCORRECT_LENGTH = 37 - INELIGIBLE_FOR_UPGRADE = 38 - INVALID_AD_ADDRESS_CAMPAIGN_TARGET = 39 - INVALID_AD_TYPE = 40 - INVALID_ATTRIBUTES_FOR_MOBILE_IMAGE = 41 - INVALID_ATTRIBUTES_FOR_MOBILE_TEXT = 42 - INVALID_CALL_TO_ACTION_TEXT = 43 - INVALID_CHARACTER_FOR_URL = 44 - INVALID_COUNTRY_CODE = 45 - INVALID_EXPANDED_DYNAMIC_SEARCH_AD_TAG = 47 - INVALID_INPUT = 48 - INVALID_MARKUP_LANGUAGE = 49 - INVALID_MOBILE_CARRIER = 50 - INVALID_MOBILE_CARRIER_TARGET = 51 - INVALID_NUMBER_OF_ELEMENTS = 52 - INVALID_PHONE_NUMBER_FORMAT = 53 - INVALID_RICH_MEDIA_CERTIFIED_VENDOR_FORMAT_ID = 54 - INVALID_TEMPLATE_DATA = 55 - INVALID_TEMPLATE_ELEMENT_FIELD_TYPE = 56 - INVALID_TEMPLATE_ID = 57 - LINE_TOO_WIDE = 58 - MISSING_AD_CUSTOMIZER_MAPPING = 59 - MISSING_ADDRESS_COMPONENT = 60 - MISSING_ADVERTISEMENT_NAME = 61 - MISSING_BUSINESS_NAME = 62 - MISSING_DESCRIPTION1 = 63 - MISSING_DESCRIPTION2 = 64 - MISSING_DESTINATION_URL_TAG = 65 - MISSING_LANDING_PAGE_URL_TAG = 66 - MISSING_DIMENSION = 67 - MISSING_DISPLAY_URL = 68 - MISSING_HEADLINE = 69 - MISSING_HEIGHT = 70 - MISSING_IMAGE = 71 - MISSING_MARKETING_IMAGE_OR_PRODUCT_VIDEOS = 72 - MISSING_MARKUP_LANGUAGES = 73 - MISSING_MOBILE_CARRIER = 74 - MISSING_PHONE = 75 - MISSING_REQUIRED_TEMPLATE_FIELDS = 76 - MISSING_TEMPLATE_FIELD_VALUE = 77 - MISSING_TEXT = 78 - MISSING_VISIBLE_URL = 79 - MISSING_WIDTH = 80 - MULTIPLE_DISTINCT_FEEDS_UNSUPPORTED = 81 - MUST_USE_TEMP_AD_UNION_ID_ON_ADD = 82 - TOO_LONG = 83 - TOO_SHORT = 84 - UNION_DIMENSIONS_CANNOT_CHANGE = 85 - UNKNOWN_ADDRESS_COMPONENT = 86 - UNKNOWN_FIELD_NAME = 87 - UNKNOWN_UNIQUE_NAME = 88 - UNSUPPORTED_DIMENSIONS = 89 - URL_INVALID_SCHEME = 90 - URL_INVALID_TOP_LEVEL_DOMAIN = 91 - URL_MALFORMED = 92 - URL_NO_HOST = 93 - URL_NOT_EQUIVALENT = 94 - URL_HOST_NAME_TOO_LONG = 95 - URL_NO_SCHEME = 96 - URL_NO_TOP_LEVEL_DOMAIN = 97 - URL_PATH_NOT_ALLOWED = 98 - URL_PORT_NOT_ALLOWED = 99 - URL_QUERY_NOT_ALLOWED = 100 - URL_SCHEME_BEFORE_EXPANDED_DYNAMIC_SEARCH_AD_TAG = 102 - USER_DOES_NOT_HAVE_ACCESS_TO_TEMPLATE = 103 - INCONSISTENT_EXPANDABLE_SETTINGS = 104 - INVALID_FORMAT = 105 - INVALID_FIELD_TEXT = 106 - ELEMENT_NOT_PRESENT = 107 - IMAGE_ERROR = 108 - VALUE_NOT_IN_RANGE = 109 - FIELD_NOT_PRESENT = 110 - ADDRESS_NOT_COMPLETE = 111 - ADDRESS_INVALID = 112 - VIDEO_RETRIEVAL_ERROR = 113 - AUDIO_ERROR = 114 - INVALID_YOUTUBE_DISPLAY_URL = 115 - TOO_MANY_PRODUCT_IMAGES = 116 - TOO_MANY_PRODUCT_VIDEOS = 117 - INCOMPATIBLE_AD_TYPE_AND_DEVICE_PREFERENCE = 118 - CALLTRACKING_NOT_SUPPORTED_FOR_COUNTRY = 119 - CARRIER_SPECIFIC_SHORT_NUMBER_NOT_ALLOWED = 120 - DISALLOWED_NUMBER_TYPE = 121 - PHONE_NUMBER_NOT_SUPPORTED_FOR_COUNTRY = 122 - PHONE_NUMBER_NOT_SUPPORTED_WITH_CALLTRACKING_FOR_COUNTRY = 123 - PREMIUM_RATE_NUMBER_NOT_ALLOWED = 124 - VANITY_PHONE_NUMBER_NOT_ALLOWED = 125 - INVALID_CALL_CONVERSION_TYPE_ID = 126 - CANNOT_DISABLE_CALL_CONVERSION_AND_SET_CONVERSION_TYPE_ID = 127 - CANNOT_SET_PATH2_WITHOUT_PATH1 = 128 - MISSING_DYNAMIC_SEARCH_ADS_SETTING_DOMAIN_NAME = 129 - INCOMPATIBLE_WITH_RESTRICTION_TYPE = 130 - CUSTOMER_CONSENT_FOR_CALL_RECORDING_REQUIRED = 131 - MISSING_IMAGE_OR_MEDIA_BUNDLE = 132 - PRODUCT_TYPE_NOT_SUPPORTED_IN_THIS_CAMPAIGN = 133 - PLACEHOLDER_CANNOT_HAVE_EMPTY_DEFAULT_VALUE = 134 - PLACEHOLDER_COUNTDOWN_FUNCTION_CANNOT_HAVE_DEFAULT_VALUE = 135 - PLACEHOLDER_DEFAULT_VALUE_MISSING = 136 - UNEXPECTED_PLACEHOLDER_DEFAULT_VALUE = 137 - AD_CUSTOMIZERS_MAY_NOT_BE_ADJACENT = 138 - UPDATING_AD_WITH_NO_ENABLED_ASSOCIATION = 139 - TOO_MANY_AD_CUSTOMIZERS = 141 - INVALID_AD_CUSTOMIZER_FORMAT = 142 - NESTED_AD_CUSTOMIZER_SYNTAX = 143 - UNSUPPORTED_AD_CUSTOMIZER_SYNTAX = 144 - UNPAIRED_BRACE_IN_AD_CUSTOMIZER_TAG = 145 - MORE_THAN_ONE_COUNTDOWN_TAG_TYPE_EXISTS = 146 - DATE_TIME_IN_COUNTDOWN_TAG_IS_INVALID = 147 - DATE_TIME_IN_COUNTDOWN_TAG_IS_PAST = 148 - UNRECOGNIZED_AD_CUSTOMIZER_TAG_FOUND = 149 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_group_ad_error.py b/google/ads/googleads/v6/errors/types/ad_group_ad_error.py deleted file mode 100644 index 354486c39..000000000 --- a/google/ads/googleads/v6/errors/types/ad_group_ad_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAdErrorEnum",}, -) - - -class AdGroupAdErrorEnum(proto.Message): - r"""Container for enum describing possible ad group ad errors.""" - - class AdGroupAdError(proto.Enum): - r"""Enum describing possible ad group ad errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_GROUP_AD_LABEL_DOES_NOT_EXIST = 2 - AD_GROUP_AD_LABEL_ALREADY_EXISTS = 3 - AD_NOT_UNDER_ADGROUP = 4 - CANNOT_OPERATE_ON_REMOVED_ADGROUPAD = 5 - CANNOT_CREATE_DEPRECATED_ADS = 6 - CANNOT_CREATE_TEXT_ADS = 7 - EMPTY_FIELD = 8 - RESOURCE_REFERENCED_IN_MULTIPLE_OPS = 9 - AD_TYPE_CANNOT_BE_PAUSED = 10 - AD_TYPE_CANNOT_BE_REMOVED = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_group_bid_modifier_error.py b/google/ads/googleads/v6/errors/types/ad_group_bid_modifier_error.py deleted file mode 100644 index 21cc70113..000000000 --- a/google/ads/googleads/v6/errors/types/ad_group_bid_modifier_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdGroupBidModifierErrorEnum",}, -) - - -class AdGroupBidModifierErrorEnum(proto.Message): - r"""Container for enum describing possible ad group bid modifier - errors. - """ - - class AdGroupBidModifierError(proto.Enum): - r"""Enum describing possible ad group bid modifier errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CRITERION_ID_NOT_SUPPORTED = 2 - CANNOT_OVERRIDE_OPTED_OUT_CAMPAIGN_CRITERION_BID_MODIFIER = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_group_criterion_error.py b/google/ads/googleads/v6/errors/types/ad_group_criterion_error.py deleted file mode 100644 index 0684e6783..000000000 --- a/google/ads/googleads/v6/errors/types/ad_group_criterion_error.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterionErrorEnum",}, -) - - -class AdGroupCriterionErrorEnum(proto.Message): - r"""Container for enum describing possible ad group criterion - errors. - """ - - class AdGroupCriterionError(proto.Enum): - r"""Enum describing possible ad group criterion errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_GROUP_CRITERION_LABEL_DOES_NOT_EXIST = 2 - AD_GROUP_CRITERION_LABEL_ALREADY_EXISTS = 3 - CANNOT_ADD_LABEL_TO_NEGATIVE_CRITERION = 4 - TOO_MANY_OPERATIONS = 5 - CANT_UPDATE_NEGATIVE = 6 - CONCRETE_TYPE_REQUIRED = 7 - BID_INCOMPATIBLE_WITH_ADGROUP = 8 - CANNOT_TARGET_AND_EXCLUDE = 9 - ILLEGAL_URL = 10 - INVALID_KEYWORD_TEXT = 11 - INVALID_DESTINATION_URL = 12 - MISSING_DESTINATION_URL_TAG = 13 - KEYWORD_LEVEL_BID_NOT_SUPPORTED_FOR_MANUALCPM = 14 - INVALID_USER_STATUS = 15 - CANNOT_ADD_CRITERIA_TYPE = 16 - CANNOT_EXCLUDE_CRITERIA_TYPE = 17 - CAMPAIGN_TYPE_NOT_COMPATIBLE_WITH_PARTIAL_FAILURE = 27 - OPERATIONS_FOR_TOO_MANY_SHOPPING_ADGROUPS = 28 - CANNOT_MODIFY_URL_FIELDS_WITH_DUPLICATE_ELEMENTS = 29 - CANNOT_SET_WITHOUT_FINAL_URLS = 30 - CANNOT_CLEAR_FINAL_URLS_IF_FINAL_MOBILE_URLS_EXIST = 31 - CANNOT_CLEAR_FINAL_URLS_IF_FINAL_APP_URLS_EXIST = 32 - CANNOT_CLEAR_FINAL_URLS_IF_TRACKING_URL_TEMPLATE_EXISTS = 33 - CANNOT_CLEAR_FINAL_URLS_IF_URL_CUSTOM_PARAMETERS_EXIST = 34 - CANNOT_SET_BOTH_DESTINATION_URL_AND_FINAL_URLS = 35 - CANNOT_SET_BOTH_DESTINATION_URL_AND_TRACKING_URL_TEMPLATE = 36 - FINAL_URLS_NOT_SUPPORTED_FOR_CRITERION_TYPE = 37 - FINAL_MOBILE_URLS_NOT_SUPPORTED_FOR_CRITERION_TYPE = 38 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_group_error.py b/google/ads/googleads/v6/errors/types/ad_group_error.py deleted file mode 100644 index e6fd3d54c..000000000 --- a/google/ads/googleads/v6/errors/types/ad_group_error.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdGroupErrorEnum",}, -) - - -class AdGroupErrorEnum(proto.Message): - r"""Container for enum describing possible ad group errors.""" - - class AdGroupError(proto.Enum): - r"""Enum describing possible ad group errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_ADGROUP_NAME = 2 - INVALID_ADGROUP_NAME = 3 - ADVERTISER_NOT_ON_CONTENT_NETWORK = 5 - BID_TOO_BIG = 6 - BID_TYPE_AND_BIDDING_STRATEGY_MISMATCH = 7 - MISSING_ADGROUP_NAME = 8 - ADGROUP_LABEL_DOES_NOT_EXIST = 9 - ADGROUP_LABEL_ALREADY_EXISTS = 10 - INVALID_CONTENT_BID_CRITERION_TYPE_GROUP = 11 - AD_GROUP_TYPE_NOT_VALID_FOR_ADVERTISING_CHANNEL_TYPE = 12 - ADGROUP_TYPE_NOT_SUPPORTED_FOR_CAMPAIGN_SALES_COUNTRY = 13 - CANNOT_ADD_ADGROUP_OF_TYPE_DSA_TO_CAMPAIGN_WITHOUT_DSA_SETTING = 14 - PROMOTED_HOTEL_AD_GROUPS_NOT_AVAILABLE_FOR_CUSTOMER = 15 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_group_feed_error.py b/google/ads/googleads/v6/errors/types/ad_group_feed_error.py deleted file mode 100644 index 97f54b4f1..000000000 --- a/google/ads/googleads/v6/errors/types/ad_group_feed_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdGroupFeedErrorEnum",}, -) - - -class AdGroupFeedErrorEnum(proto.Message): - r"""Container for enum describing possible ad group feed errors.""" - - class AdGroupFeedError(proto.Enum): - r"""Enum describing possible ad group feed errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 2 - CANNOT_CREATE_FOR_REMOVED_FEED = 3 - ADGROUP_FEED_ALREADY_EXISTS = 4 - CANNOT_OPERATE_ON_REMOVED_ADGROUP_FEED = 5 - INVALID_PLACEHOLDER_TYPE = 6 - MISSING_FEEDMAPPING_FOR_PLACEHOLDER_TYPE = 7 - NO_EXISTING_LOCATION_CUSTOMER_FEED = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_parameter_error.py b/google/ads/googleads/v6/errors/types/ad_parameter_error.py deleted file mode 100644 index 418452caf..000000000 --- a/google/ads/googleads/v6/errors/types/ad_parameter_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdParameterErrorEnum",}, -) - - -class AdParameterErrorEnum(proto.Message): - r"""Container for enum describing possible ad parameter errors.""" - - class AdParameterError(proto.Enum): - r"""Enum describing possible ad parameter errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_GROUP_CRITERION_MUST_BE_KEYWORD = 2 - INVALID_INSERTION_TEXT_FORMAT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/ad_sharing_error.py b/google/ads/googleads/v6/errors/types/ad_sharing_error.py deleted file mode 100644 index a23d99efc..000000000 --- a/google/ads/googleads/v6/errors/types/ad_sharing_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdSharingErrorEnum",}, -) - - -class AdSharingErrorEnum(proto.Message): - r"""Container for enum describing possible ad sharing errors.""" - - class AdSharingError(proto.Enum): - r"""Enum describing possible ad sharing errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AD_GROUP_ALREADY_CONTAINS_AD = 2 - INCOMPATIBLE_AD_UNDER_AD_GROUP = 3 - CANNOT_SHARE_INACTIVE_AD = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/adx_error.py b/google/ads/googleads/v6/errors/types/adx_error.py deleted file mode 100644 index 07b15fa12..000000000 --- a/google/ads/googleads/v6/errors/types/adx_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AdxErrorEnum",}, -) - - -class AdxErrorEnum(proto.Message): - r"""Container for enum describing possible adx errors.""" - - class AdxError(proto.Enum): - r"""Enum describing possible adx errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UNSUPPORTED_FEATURE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/asset_error.py b/google/ads/googleads/v6/errors/types/asset_error.py deleted file mode 100644 index 0ed320391..000000000 --- a/google/ads/googleads/v6/errors/types/asset_error.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AssetErrorEnum",}, -) - - -class AssetErrorEnum(proto.Message): - r"""Container for enum describing possible asset errors.""" - - class AssetError(proto.Enum): - r"""Enum describing possible asset errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CUSTOMER_NOT_ON_ALLOWLIST_FOR_ASSET_TYPE = 13 - DUPLICATE_ASSET = 3 - DUPLICATE_ASSET_NAME = 4 - ASSET_DATA_IS_MISSING = 5 - CANNOT_MODIFY_ASSET_NAME = 6 - FIELD_INCOMPATIBLE_WITH_ASSET_TYPE = 7 - INVALID_CALL_TO_ACTION_TEXT = 8 - LEAD_FORM_INVALID_FIELDS_COMBINATION = 9 - LEAD_FORM_MISSING_AGREEMENT = 10 - INVALID_ASSET_STATUS = 11 - FIELD_CANNOT_BE_MODIFIED_FOR_ASSET_TYPE = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/asset_link_error.py b/google/ads/googleads/v6/errors/types/asset_link_error.py deleted file mode 100644 index e7dcfa713..000000000 --- a/google/ads/googleads/v6/errors/types/asset_link_error.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AssetLinkErrorEnum",}, -) - - -class AssetLinkErrorEnum(proto.Message): - r"""Container for enum describing possible asset link errors.""" - - class AssetLinkError(proto.Enum): - r"""Enum describing possible asset link errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PINNING_UNSUPPORTED = 2 - UNSUPPORTED_FIELD_TYPE = 3 - FIELD_TYPE_INCOMPATIBLE_WITH_ASSET_TYPE = 4 - FIELD_TYPE_INCOMPATIBLE_WITH_CAMPAIGN_TYPE = 5 - INCOMPATIBLE_ADVERTISING_CHANNEL_TYPE = 6 - IMAGE_NOT_WITHIN_SPECIFIED_DIMENSION_RANGE = 7 - INVALID_PINNED_FIELD = 8 - MEDIA_BUNDLE_ASSET_FILE_SIZE_TOO_LARGE = 9 - NOT_ENOUGH_AVAILABLE_ASSET_LINKS_FOR_VALID_COMBINATION = 10 - NOT_ENOUGH_AVAILABLE_ASSET_LINKS_WITH_FALLBACK = 11 - NOT_ENOUGH_AVAILABLE_ASSET_LINKS_WITH_FALLBACK_FOR_VALID_COMBINATION = ( - 12 - ) - YOUTUBE_VIDEO_REMOVED = 13 - YOUTUBE_VIDEO_TOO_LONG = 14 - YOUTUBE_VIDEO_TOO_SHORT = 15 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/authentication_error.py b/google/ads/googleads/v6/errors/types/authentication_error.py deleted file mode 100644 index 67b0af96f..000000000 --- a/google/ads/googleads/v6/errors/types/authentication_error.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AuthenticationErrorEnum",}, -) - - -class AuthenticationErrorEnum(proto.Message): - r"""Container for enum describing possible authentication errors.""" - - class AuthenticationError(proto.Enum): - r"""Enum describing possible authentication errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - AUTHENTICATION_ERROR = 2 - CLIENT_CUSTOMER_ID_INVALID = 5 - CUSTOMER_NOT_FOUND = 8 - GOOGLE_ACCOUNT_DELETED = 9 - GOOGLE_ACCOUNT_COOKIE_INVALID = 10 - GOOGLE_ACCOUNT_AUTHENTICATION_FAILED = 25 - GOOGLE_ACCOUNT_USER_AND_ADS_USER_MISMATCH = 12 - LOGIN_COOKIE_REQUIRED = 13 - NOT_ADS_USER = 14 - OAUTH_TOKEN_INVALID = 15 - OAUTH_TOKEN_EXPIRED = 16 - OAUTH_TOKEN_DISABLED = 17 - OAUTH_TOKEN_REVOKED = 18 - OAUTH_TOKEN_HEADER_INVALID = 19 - LOGIN_COOKIE_INVALID = 20 - USER_ID_INVALID = 22 - TWO_STEP_VERIFICATION_NOT_ENROLLED = 23 - ADVANCED_PROTECTION_NOT_ENROLLED = 24 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/authorization_error.py b/google/ads/googleads/v6/errors/types/authorization_error.py deleted file mode 100644 index f21f50498..000000000 --- a/google/ads/googleads/v6/errors/types/authorization_error.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"AuthorizationErrorEnum",}, -) - - -class AuthorizationErrorEnum(proto.Message): - r"""Container for enum describing possible authorization errors.""" - - class AuthorizationError(proto.Enum): - r"""Enum describing possible authorization errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - USER_PERMISSION_DENIED = 2 - DEVELOPER_TOKEN_NOT_ON_ALLOWLIST = 13 - DEVELOPER_TOKEN_PROHIBITED = 4 - PROJECT_DISABLED = 5 - AUTHORIZATION_ERROR = 6 - ACTION_NOT_PERMITTED = 7 - INCOMPLETE_SIGNUP = 8 - CUSTOMER_NOT_ENABLED = 24 - MISSING_TOS = 9 - DEVELOPER_TOKEN_NOT_APPROVED = 10 - INVALID_LOGIN_CUSTOMER_ID_SERVING_CUSTOMER_ID_COMBINATION = 11 - SERVICE_ACCESS_DENIED = 12 - ACCESS_DENIED_FOR_ACCOUNT_TYPE = 25 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/batch_job_error.py b/google/ads/googleads/v6/errors/types/batch_job_error.py deleted file mode 100644 index 116eaaecf..000000000 --- a/google/ads/googleads/v6/errors/types/batch_job_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"BatchJobErrorEnum",}, -) - - -class BatchJobErrorEnum(proto.Message): - r"""Container for enum describing possible batch job errors.""" - - class BatchJobError(proto.Enum): - r"""Enum describing possible request errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_MODIFY_JOB_AFTER_JOB_STARTS_RUNNING = 2 - EMPTY_OPERATIONS = 3 - INVALID_SEQUENCE_TOKEN = 4 - RESULTS_NOT_READY = 5 - INVALID_PAGE_SIZE = 6 - CAN_ONLY_REMOVE_PENDING_JOB = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/bidding_error.py b/google/ads/googleads/v6/errors/types/bidding_error.py deleted file mode 100644 index fcfe7dc4e..000000000 --- a/google/ads/googleads/v6/errors/types/bidding_error.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"BiddingErrorEnum",}, -) - - -class BiddingErrorEnum(proto.Message): - r"""Container for enum describing possible bidding errors.""" - - class BiddingError(proto.Enum): - r"""Enum describing possible bidding errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BIDDING_STRATEGY_TRANSITION_NOT_ALLOWED = 2 - CANNOT_ATTACH_BIDDING_STRATEGY_TO_CAMPAIGN = 7 - INVALID_ANONYMOUS_BIDDING_STRATEGY_TYPE = 10 - INVALID_BIDDING_STRATEGY_TYPE = 14 - INVALID_BID = 17 - BIDDING_STRATEGY_NOT_AVAILABLE_FOR_ACCOUNT_TYPE = 18 - CONVERSION_TRACKING_NOT_ENABLED = 19 - NOT_ENOUGH_CONVERSIONS = 20 - CANNOT_CREATE_CAMPAIGN_WITH_BIDDING_STRATEGY = 21 - CANNOT_TARGET_CONTENT_NETWORK_ONLY_WITH_CAMPAIGN_LEVEL_POP_BIDDING_STRATEGY = ( - 23 - ) - BIDDING_STRATEGY_NOT_SUPPORTED_WITH_AD_SCHEDULE = 24 - PAY_PER_CONVERSION_NOT_AVAILABLE_FOR_CUSTOMER = 25 - PAY_PER_CONVERSION_NOT_ALLOWED_WITH_TARGET_CPA = 26 - BIDDING_STRATEGY_NOT_ALLOWED_FOR_SEARCH_ONLY_CAMPAIGNS = 27 - BIDDING_STRATEGY_NOT_SUPPORTED_IN_DRAFTS_OR_EXPERIMENTS = 28 - BIDDING_STRATEGY_TYPE_DOES_NOT_SUPPORT_PRODUCT_TYPE_ADGROUP_CRITERION = ( - 29 - ) - BID_TOO_SMALL = 30 - BID_TOO_BIG = 31 - BID_TOO_MANY_FRACTIONAL_DIGITS = 32 - INVALID_DOMAIN_NAME = 33 - NOT_COMPATIBLE_WITH_PAYMENT_MODE = 34 - NOT_COMPATIBLE_WITH_BUDGET_TYPE = 35 - NOT_COMPATIBLE_WITH_BIDDING_STRATEGY_TYPE = 36 - BIDDING_STRATEGY_TYPE_INCOMPATIBLE_WITH_SHARED_BUDGET = 37 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/bidding_strategy_error.py b/google/ads/googleads/v6/errors/types/bidding_strategy_error.py deleted file mode 100644 index 13de0e7ae..000000000 --- a/google/ads/googleads/v6/errors/types/bidding_strategy_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"BiddingStrategyErrorEnum",}, -) - - -class BiddingStrategyErrorEnum(proto.Message): - r"""Container for enum describing possible bidding strategy - errors. - """ - - class BiddingStrategyError(proto.Enum): - r"""Enum describing possible bidding strategy errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_NAME = 2 - CANNOT_CHANGE_BIDDING_STRATEGY_TYPE = 3 - CANNOT_REMOVE_ASSOCIATED_STRATEGY = 4 - BIDDING_STRATEGY_NOT_SUPPORTED = 5 - INCOMPATIBLE_BIDDING_STRATEGY_AND_BIDDING_STRATEGY_GOAL_TYPE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/billing_setup_error.py b/google/ads/googleads/v6/errors/types/billing_setup_error.py deleted file mode 100644 index 223b86b91..000000000 --- a/google/ads/googleads/v6/errors/types/billing_setup_error.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"BillingSetupErrorEnum",}, -) - - -class BillingSetupErrorEnum(proto.Message): - r"""Container for enum describing possible billing setup errors.""" - - class BillingSetupError(proto.Enum): - r"""Enum describing possible billing setup errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_USE_EXISTING_AND_NEW_ACCOUNT = 2 - CANNOT_REMOVE_STARTED_BILLING_SETUP = 3 - CANNOT_CHANGE_BILLING_TO_SAME_PAYMENTS_ACCOUNT = 4 - BILLING_SETUP_NOT_PERMITTED_FOR_CUSTOMER_STATUS = 5 - INVALID_PAYMENTS_ACCOUNT = 6 - BILLING_SETUP_NOT_PERMITTED_FOR_CUSTOMER_CATEGORY = 7 - INVALID_START_TIME_TYPE = 8 - THIRD_PARTY_ALREADY_HAS_BILLING = 9 - BILLING_SETUP_IN_PROGRESS = 10 - NO_SIGNUP_PERMISSION = 11 - CHANGE_OF_BILL_TO_IN_PROGRESS = 12 - PAYMENTS_PROFILE_NOT_FOUND = 13 - PAYMENTS_ACCOUNT_NOT_FOUND = 14 - PAYMENTS_PROFILE_INELIGIBLE = 15 - PAYMENTS_ACCOUNT_INELIGIBLE = 16 - CUSTOMER_NEEDS_INTERNAL_APPROVAL = 17 - PAYMENTS_ACCOUNT_INELIGIBLE_CURRENCY_CODE_MISMATCH = 19 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_budget_error.py b/google/ads/googleads/v6/errors/types/campaign_budget_error.py deleted file mode 100644 index 9d17da4cd..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_budget_error.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignBudgetErrorEnum",}, -) - - -class CampaignBudgetErrorEnum(proto.Message): - r"""Container for enum describing possible campaign budget - errors. - """ - - class CampaignBudgetError(proto.Enum): - r"""Enum describing possible campaign budget errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN_BUDGET_CANNOT_BE_SHARED = 17 - CAMPAIGN_BUDGET_REMOVED = 2 - CAMPAIGN_BUDGET_IN_USE = 3 - CAMPAIGN_BUDGET_PERIOD_NOT_AVAILABLE = 4 - CANNOT_MODIFY_FIELD_OF_IMPLICITLY_SHARED_CAMPAIGN_BUDGET = 6 - CANNOT_UPDATE_CAMPAIGN_BUDGET_TO_IMPLICITLY_SHARED = 7 - CANNOT_UPDATE_CAMPAIGN_BUDGET_TO_EXPLICITLY_SHARED_WITHOUT_NAME = 8 - CANNOT_UPDATE_CAMPAIGN_BUDGET_TO_EXPLICITLY_SHARED = 9 - CANNOT_USE_IMPLICITLY_SHARED_CAMPAIGN_BUDGET_WITH_MULTIPLE_CAMPAIGNS = ( - 10 - ) - DUPLICATE_NAME = 11 - MONEY_AMOUNT_IN_WRONG_CURRENCY = 12 - MONEY_AMOUNT_LESS_THAN_CURRENCY_MINIMUM_CPC = 13 - MONEY_AMOUNT_TOO_LARGE = 14 - NEGATIVE_MONEY_AMOUNT = 15 - NON_MULTIPLE_OF_MINIMUM_CURRENCY_UNIT = 16 - TOTAL_BUDGET_AMOUNT_MUST_BE_UNSET_FOR_BUDGET_PERIOD_DAILY = 18 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_criterion_error.py b/google/ads/googleads/v6/errors/types/campaign_criterion_error.py deleted file mode 100644 index 82a3cf1d7..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_criterion_error.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignCriterionErrorEnum",}, -) - - -class CampaignCriterionErrorEnum(proto.Message): - r"""Container for enum describing possible campaign criterion - errors. - """ - - class CampaignCriterionError(proto.Enum): - r"""Enum describing possible campaign criterion errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CONCRETE_TYPE_REQUIRED = 2 - INVALID_PLACEMENT_URL = 3 - CANNOT_EXCLUDE_CRITERIA_TYPE = 4 - CANNOT_SET_STATUS_FOR_CRITERIA_TYPE = 5 - CANNOT_SET_STATUS_FOR_EXCLUDED_CRITERIA = 6 - CANNOT_TARGET_AND_EXCLUDE = 7 - TOO_MANY_OPERATIONS = 8 - OPERATOR_NOT_SUPPORTED_FOR_CRITERION_TYPE = 9 - SHOPPING_CAMPAIGN_SALES_COUNTRY_NOT_SUPPORTED_FOR_SALES_CHANNEL = 10 - CANNOT_ADD_EXISTING_FIELD = 11 - CANNOT_UPDATE_NEGATIVE_CRITERION = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_draft_error.py b/google/ads/googleads/v6/errors/types/campaign_draft_error.py deleted file mode 100644 index 7d5b7aae3..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_draft_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignDraftErrorEnum",}, -) - - -class CampaignDraftErrorEnum(proto.Message): - r"""Container for enum describing possible campaign draft errors.""" - - class CampaignDraftError(proto.Enum): - r"""Enum describing possible campaign draft errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_DRAFT_NAME = 2 - INVALID_STATUS_TRANSITION_FROM_REMOVED = 3 - INVALID_STATUS_TRANSITION_FROM_PROMOTED = 4 - INVALID_STATUS_TRANSITION_FROM_PROMOTE_FAILED = 5 - CUSTOMER_CANNOT_CREATE_DRAFT = 6 - CAMPAIGN_CANNOT_CREATE_DRAFT = 7 - INVALID_DRAFT_CHANGE = 8 - INVALID_STATUS_TRANSITION = 9 - MAX_NUMBER_OF_DRAFTS_PER_CAMPAIGN_REACHED = 10 - LIST_ERRORS_FOR_PROMOTED_DRAFT_ONLY = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_error.py b/google/ads/googleads/v6/errors/types/campaign_error.py deleted file mode 100644 index eb350978c..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_error.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignErrorEnum",}, -) - - -class CampaignErrorEnum(proto.Message): - r"""Container for enum describing possible campaign errors.""" - - class CampaignError(proto.Enum): - r"""Enum describing possible campaign errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_TARGET_CONTENT_NETWORK = 3 - CANNOT_TARGET_SEARCH_NETWORK = 4 - CANNOT_TARGET_SEARCH_NETWORK_WITHOUT_GOOGLE_SEARCH = 5 - CANNOT_TARGET_GOOGLE_SEARCH_FOR_CPM_CAMPAIGN = 6 - CAMPAIGN_MUST_TARGET_AT_LEAST_ONE_NETWORK = 7 - CANNOT_TARGET_PARTNER_SEARCH_NETWORK = 8 - CANNOT_TARGET_CONTENT_NETWORK_ONLY_WITH_CRITERIA_LEVEL_BIDDING_STRATEGY = ( - 9 - ) - CAMPAIGN_DURATION_MUST_CONTAIN_ALL_RUNNABLE_TRIALS = 10 - CANNOT_MODIFY_FOR_TRIAL_CAMPAIGN = 11 - DUPLICATE_CAMPAIGN_NAME = 12 - INCOMPATIBLE_CAMPAIGN_FIELD = 13 - INVALID_CAMPAIGN_NAME = 14 - INVALID_AD_SERVING_OPTIMIZATION_STATUS = 15 - INVALID_TRACKING_URL = 16 - CANNOT_SET_BOTH_TRACKING_URL_TEMPLATE_AND_TRACKING_SETTING = 17 - MAX_IMPRESSIONS_NOT_IN_RANGE = 18 - TIME_UNIT_NOT_SUPPORTED = 19 - INVALID_OPERATION_IF_SERVING_STATUS_HAS_ENDED = 20 - BUDGET_CANNOT_BE_SHARED = 21 - CAMPAIGN_CANNOT_USE_SHARED_BUDGET = 22 - CANNOT_CHANGE_BUDGET_ON_CAMPAIGN_WITH_TRIALS = 23 - CAMPAIGN_LABEL_DOES_NOT_EXIST = 24 - CAMPAIGN_LABEL_ALREADY_EXISTS = 25 - MISSING_SHOPPING_SETTING = 26 - INVALID_SHOPPING_SALES_COUNTRY = 27 - ADVERTISING_CHANNEL_TYPE_NOT_AVAILABLE_FOR_ACCOUNT_TYPE = 31 - INVALID_ADVERTISING_CHANNEL_SUB_TYPE = 32 - AT_LEAST_ONE_CONVERSION_MUST_BE_SELECTED = 33 - CANNOT_SET_AD_ROTATION_MODE = 34 - CANNOT_MODIFY_START_DATE_IF_ALREADY_STARTED = 35 - CANNOT_SET_DATE_TO_PAST = 36 - MISSING_HOTEL_CUSTOMER_LINK = 37 - INVALID_HOTEL_CUSTOMER_LINK = 38 - MISSING_HOTEL_SETTING = 39 - CANNOT_USE_SHARED_CAMPAIGN_BUDGET_WHILE_PART_OF_CAMPAIGN_GROUP = 40 - APP_NOT_FOUND = 41 - SHOPPING_ENABLE_LOCAL_NOT_SUPPORTED_FOR_CAMPAIGN_TYPE = 42 - MERCHANT_NOT_ALLOWED_FOR_COMPARISON_LISTING_ADS = 43 - INSUFFICIENT_APP_INSTALLS_COUNT = 44 - SENSITIVE_CATEGORY_APP = 45 - HEC_AGREEMENT_REQUIRED = 46 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_experiment_error.py b/google/ads/googleads/v6/errors/types/campaign_experiment_error.py deleted file mode 100644 index c805304b7..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_experiment_error.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignExperimentErrorEnum",}, -) - - -class CampaignExperimentErrorEnum(proto.Message): - r"""Container for enum describing possible campaign experiment - errors. - """ - - class CampaignExperimentError(proto.Enum): - r"""Enum describing possible campaign experiment errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_NAME = 2 - INVALID_TRANSITION = 3 - CANNOT_CREATE_EXPERIMENT_WITH_SHARED_BUDGET = 4 - CANNOT_CREATE_EXPERIMENT_FOR_REMOVED_BASE_CAMPAIGN = 5 - CANNOT_CREATE_EXPERIMENT_FOR_NON_PROPOSED_DRAFT = 6 - CUSTOMER_CANNOT_CREATE_EXPERIMENT = 7 - CAMPAIGN_CANNOT_CREATE_EXPERIMENT = 8 - EXPERIMENT_DURATIONS_MUST_NOT_OVERLAP = 9 - EXPERIMENT_DURATION_MUST_BE_WITHIN_CAMPAIGN_DURATION = 10 - CANNOT_MUTATE_EXPERIMENT_DUE_TO_STATUS = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_feed_error.py b/google/ads/googleads/v6/errors/types/campaign_feed_error.py deleted file mode 100644 index 1a9bf8e59..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_feed_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignFeedErrorEnum",}, -) - - -class CampaignFeedErrorEnum(proto.Message): - r"""Container for enum describing possible campaign feed errors.""" - - class CampaignFeedError(proto.Enum): - r"""Enum describing possible campaign feed errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 2 - CANNOT_CREATE_FOR_REMOVED_FEED = 4 - CANNOT_CREATE_ALREADY_EXISTING_CAMPAIGN_FEED = 5 - CANNOT_MODIFY_REMOVED_CAMPAIGN_FEED = 6 - INVALID_PLACEHOLDER_TYPE = 7 - MISSING_FEEDMAPPING_FOR_PLACEHOLDER_TYPE = 8 - NO_EXISTING_LOCATION_CUSTOMER_FEED = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/campaign_shared_set_error.py b/google/ads/googleads/v6/errors/types/campaign_shared_set_error.py deleted file mode 100644 index 60167cdcd..000000000 --- a/google/ads/googleads/v6/errors/types/campaign_shared_set_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CampaignSharedSetErrorEnum",}, -) - - -class CampaignSharedSetErrorEnum(proto.Message): - r"""Container for enum describing possible campaign shared set - errors. - """ - - class CampaignSharedSetError(proto.Enum): - r"""Enum describing possible campaign shared set errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SHARED_SET_ACCESS_DENIED = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/change_event_error.py b/google/ads/googleads/v6/errors/types/change_event_error.py deleted file mode 100644 index ab3c9ebfa..000000000 --- a/google/ads/googleads/v6/errors/types/change_event_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ChangeEventErrorEnum",}, -) - - -class ChangeEventErrorEnum(proto.Message): - r"""Container for enum describing possible change event errors.""" - - class ChangeEventError(proto.Enum): - r"""Enum describing possible change event errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - START_DATE_TOO_OLD = 2 - CHANGE_DATE_RANGE_INFINITE = 3 - CHANGE_DATE_RANGE_NEGATIVE = 4 - LIMIT_NOT_SPECIFIED = 5 - INVALID_LIMIT_CLAUSE = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/change_status_error.py b/google/ads/googleads/v6/errors/types/change_status_error.py deleted file mode 100644 index 7630cd338..000000000 --- a/google/ads/googleads/v6/errors/types/change_status_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ChangeStatusErrorEnum",}, -) - - -class ChangeStatusErrorEnum(proto.Message): - r"""Container for enum describing possible change status errors.""" - - class ChangeStatusError(proto.Enum): - r"""Enum describing possible change status errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - START_DATE_TOO_OLD = 3 - CHANGE_DATE_RANGE_INFINITE = 4 - CHANGE_DATE_RANGE_NEGATIVE = 5 - LIMIT_NOT_SPECIFIED = 6 - INVALID_LIMIT_CLAUSE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/collection_size_error.py b/google/ads/googleads/v6/errors/types/collection_size_error.py deleted file mode 100644 index a9c4a5480..000000000 --- a/google/ads/googleads/v6/errors/types/collection_size_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CollectionSizeErrorEnum",}, -) - - -class CollectionSizeErrorEnum(proto.Message): - r"""Container for enum describing possible collection size - errors. - """ - - class CollectionSizeError(proto.Enum): - r"""Enum describing possible collection size errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TOO_FEW = 2 - TOO_MANY = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/context_error.py b/google/ads/googleads/v6/errors/types/context_error.py deleted file mode 100644 index dba8d048b..000000000 --- a/google/ads/googleads/v6/errors/types/context_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ContextErrorEnum",}, -) - - -class ContextErrorEnum(proto.Message): - r"""Container for enum describing possible context errors.""" - - class ContextError(proto.Enum): - r"""Enum describing possible context errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPERATION_NOT_PERMITTED_FOR_CONTEXT = 2 - OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/conversion_action_error.py b/google/ads/googleads/v6/errors/types/conversion_action_error.py deleted file mode 100644 index 0b0fa5b19..000000000 --- a/google/ads/googleads/v6/errors/types/conversion_action_error.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ConversionActionErrorEnum",}, -) - - -class ConversionActionErrorEnum(proto.Message): - r"""Container for enum describing possible conversion action - errors. - """ - - class ConversionActionError(proto.Enum): - r"""Enum describing possible conversion action errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_NAME = 2 - DUPLICATE_APP_ID = 3 - TWO_CONVERSION_ACTIONS_BIDDING_ON_SAME_APP_DOWNLOAD = 4 - BIDDING_ON_SAME_APP_DOWNLOAD_AS_GLOBAL_ACTION = 5 - DATA_DRIVEN_MODEL_WAS_NEVER_GENERATED = 6 - DATA_DRIVEN_MODEL_EXPIRED = 7 - DATA_DRIVEN_MODEL_STALE = 8 - DATA_DRIVEN_MODEL_UNKNOWN = 9 - CREATION_NOT_SUPPORTED = 10 - UPDATE_NOT_SUPPORTED = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/conversion_adjustment_upload_error.py b/google/ads/googleads/v6/errors/types/conversion_adjustment_upload_error.py deleted file mode 100644 index e403f53c6..000000000 --- a/google/ads/googleads/v6/errors/types/conversion_adjustment_upload_error.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ConversionAdjustmentUploadErrorEnum",}, -) - - -class ConversionAdjustmentUploadErrorEnum(proto.Message): - r"""Container for enum describing possible conversion adjustment - upload errors. - """ - - class ConversionAdjustmentUploadError(proto.Enum): - r"""Enum describing possible conversion adjustment upload errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TOO_RECENT_CONVERSION_ACTION = 2 - INVALID_CONVERSION_ACTION = 3 - CONVERSION_ALREADY_RETRACTED = 4 - CONVERSION_NOT_FOUND = 5 - CONVERSION_EXPIRED = 6 - ADJUSTMENT_PRECEDES_CONVERSION = 7 - MORE_RECENT_RESTATEMENT_FOUND = 8 - TOO_RECENT_CONVERSION = 9 - CANNOT_RESTATE_CONVERSION_ACTION_THAT_ALWAYS_USES_DEFAULT_CONVERSION_VALUE = ( - 10 - ) - TOO_MANY_ADJUSTMENTS_IN_REQUEST = 11 - TOO_MANY_ADJUSTMENTS = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/conversion_upload_error.py b/google/ads/googleads/v6/errors/types/conversion_upload_error.py deleted file mode 100644 index aff974cb3..000000000 --- a/google/ads/googleads/v6/errors/types/conversion_upload_error.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ConversionUploadErrorEnum",}, -) - - -class ConversionUploadErrorEnum(proto.Message): - r"""Container for enum describing possible conversion upload - errors. - """ - - class ConversionUploadError(proto.Enum): - r"""Enum describing possible conversion upload errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TOO_MANY_CONVERSIONS_IN_REQUEST = 2 - UNPARSEABLE_GCLID = 3 - CONVERSION_PRECEDES_GCLID = 4 - EXPIRED_GCLID = 5 - TOO_RECENT_GCLID = 6 - GCLID_NOT_FOUND = 7 - UNAUTHORIZED_CUSTOMER = 8 - INVALID_CONVERSION_ACTION = 9 - TOO_RECENT_CONVERSION_ACTION = 10 - CONVERSION_TRACKING_NOT_ENABLED_AT_IMPRESSION_TIME = 11 - EXTERNAL_ATTRIBUTION_DATA_SET_FOR_NON_EXTERNALLY_ATTRIBUTED_CONVERSION_ACTION = ( - 12 - ) - EXTERNAL_ATTRIBUTION_DATA_NOT_SET_FOR_EXTERNALLY_ATTRIBUTED_CONVERSION_ACTION = ( - 13 - ) - ORDER_ID_NOT_PERMITTED_FOR_EXTERNALLY_ATTRIBUTED_CONVERSION_ACTION = 14 - ORDER_ID_ALREADY_IN_USE = 15 - DUPLICATE_ORDER_ID = 16 - TOO_RECENT_CALL = 17 - EXPIRED_CALL = 18 - CALL_NOT_FOUND = 19 - CONVERSION_PRECEDES_CALL = 20 - CONVERSION_TRACKING_NOT_ENABLED_AT_CALL_TIME = 21 - UNPARSEABLE_CALLERS_PHONE_NUMBER = 22 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/country_code_error.py b/google/ads/googleads/v6/errors/types/country_code_error.py deleted file mode 100644 index bb67632a1..000000000 --- a/google/ads/googleads/v6/errors/types/country_code_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CountryCodeErrorEnum",}, -) - - -class CountryCodeErrorEnum(proto.Message): - r"""Container for enum describing country code errors.""" - - class CountryCodeError(proto.Enum): - r"""Enum describing country code errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_COUNTRY_CODE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/criterion_error.py b/google/ads/googleads/v6/errors/types/criterion_error.py deleted file mode 100644 index 2f46fc9e0..000000000 --- a/google/ads/googleads/v6/errors/types/criterion_error.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CriterionErrorEnum",}, -) - - -class CriterionErrorEnum(proto.Message): - r"""Container for enum describing possible criterion errors.""" - - class CriterionError(proto.Enum): - r"""Enum describing possible criterion errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CONCRETE_TYPE_REQUIRED = 2 - INVALID_EXCLUDED_CATEGORY = 3 - INVALID_KEYWORD_TEXT = 4 - KEYWORD_TEXT_TOO_LONG = 5 - KEYWORD_HAS_TOO_MANY_WORDS = 6 - KEYWORD_HAS_INVALID_CHARS = 7 - INVALID_PLACEMENT_URL = 8 - INVALID_USER_LIST = 9 - INVALID_USER_INTEREST = 10 - INVALID_FORMAT_FOR_PLACEMENT_URL = 11 - PLACEMENT_URL_IS_TOO_LONG = 12 - PLACEMENT_URL_HAS_ILLEGAL_CHAR = 13 - PLACEMENT_URL_HAS_MULTIPLE_SITES_IN_LINE = 14 - PLACEMENT_IS_NOT_AVAILABLE_FOR_TARGETING_OR_EXCLUSION = 15 - INVALID_TOPIC_PATH = 16 - INVALID_YOUTUBE_CHANNEL_ID = 17 - INVALID_YOUTUBE_VIDEO_ID = 18 - YOUTUBE_VERTICAL_CHANNEL_DEPRECATED = 19 - YOUTUBE_DEMOGRAPHIC_CHANNEL_DEPRECATED = 20 - YOUTUBE_URL_UNSUPPORTED = 21 - CANNOT_EXCLUDE_CRITERIA_TYPE = 22 - CANNOT_ADD_CRITERIA_TYPE = 23 - CANNOT_EXCLUDE_SIMILAR_USER_LIST = 26 - CANNOT_ADD_CLOSED_USER_LIST = 27 - CANNOT_ADD_DISPLAY_ONLY_LISTS_TO_SEARCH_ONLY_CAMPAIGNS = 28 - CANNOT_ADD_DISPLAY_ONLY_LISTS_TO_SEARCH_CAMPAIGNS = 29 - CANNOT_ADD_DISPLAY_ONLY_LISTS_TO_SHOPPING_CAMPAIGNS = 30 - CANNOT_ADD_USER_INTERESTS_TO_SEARCH_CAMPAIGNS = 31 - CANNOT_SET_BIDS_ON_CRITERION_TYPE_IN_SEARCH_CAMPAIGNS = 32 - CANNOT_ADD_URLS_TO_CRITERION_TYPE_FOR_CAMPAIGN_TYPE = 33 - INVALID_COMBINED_AUDIENCE = 122 - INVALID_CUSTOM_AFFINITY = 96 - INVALID_CUSTOM_INTENT = 97 - INVALID_CUSTOM_AUDIENCE = 121 - INVALID_IP_ADDRESS = 34 - INVALID_IP_FORMAT = 35 - INVALID_MOBILE_APP = 36 - INVALID_MOBILE_APP_CATEGORY = 37 - INVALID_CRITERION_ID = 38 - CANNOT_TARGET_CRITERION = 39 - CANNOT_TARGET_OBSOLETE_CRITERION = 40 - CRITERION_ID_AND_TYPE_MISMATCH = 41 - INVALID_PROXIMITY_RADIUS = 42 - INVALID_PROXIMITY_RADIUS_UNITS = 43 - INVALID_STREETADDRESS_LENGTH = 44 - INVALID_CITYNAME_LENGTH = 45 - INVALID_REGIONCODE_LENGTH = 46 - INVALID_REGIONNAME_LENGTH = 47 - INVALID_POSTALCODE_LENGTH = 48 - INVALID_COUNTRY_CODE = 49 - INVALID_LATITUDE = 50 - INVALID_LONGITUDE = 51 - PROXIMITY_GEOPOINT_AND_ADDRESS_BOTH_CANNOT_BE_NULL = 52 - INVALID_PROXIMITY_ADDRESS = 53 - INVALID_USER_DOMAIN_NAME = 54 - CRITERION_PARAMETER_TOO_LONG = 55 - AD_SCHEDULE_TIME_INTERVALS_OVERLAP = 56 - AD_SCHEDULE_INTERVAL_CANNOT_SPAN_MULTIPLE_DAYS = 57 - AD_SCHEDULE_INVALID_TIME_INTERVAL = 58 - AD_SCHEDULE_EXCEEDED_INTERVALS_PER_DAY_LIMIT = 59 - AD_SCHEDULE_CRITERION_ID_MISMATCHING_FIELDS = 60 - CANNOT_BID_MODIFY_CRITERION_TYPE = 61 - CANNOT_BID_MODIFY_CRITERION_CAMPAIGN_OPTED_OUT = 62 - CANNOT_BID_MODIFY_NEGATIVE_CRITERION = 63 - BID_MODIFIER_ALREADY_EXISTS = 64 - FEED_ID_NOT_ALLOWED = 65 - ACCOUNT_INELIGIBLE_FOR_CRITERIA_TYPE = 66 - CRITERIA_TYPE_INVALID_FOR_BIDDING_STRATEGY = 67 - CANNOT_EXCLUDE_CRITERION = 68 - CANNOT_REMOVE_CRITERION = 69 - INVALID_PRODUCT_BIDDING_CATEGORY = 76 - MISSING_SHOPPING_SETTING = 77 - INVALID_MATCHING_FUNCTION = 78 - LOCATION_FILTER_NOT_ALLOWED = 79 - INVALID_FEED_FOR_LOCATION_FILTER = 98 - LOCATION_FILTER_INVALID = 80 - CANNOT_SET_GEO_TARGET_CONSTANTS_WITH_FEED_ITEM_SETS = 123 - INVALID_LOCATION_GROUP_RADIUS = 124 - INVALID_LOCATION_GROUP_RADIUS_UNIT = 125 - CANNOT_ATTACH_CRITERIA_AT_CAMPAIGN_AND_ADGROUP = 81 - HOTEL_LENGTH_OF_STAY_OVERLAPS_WITH_EXISTING_CRITERION = 82 - HOTEL_ADVANCE_BOOKING_WINDOW_OVERLAPS_WITH_EXISTING_CRITERION = 83 - FIELD_INCOMPATIBLE_WITH_NEGATIVE_TARGETING = 84 - INVALID_WEBPAGE_CONDITION = 85 - INVALID_WEBPAGE_CONDITION_URL = 86 - WEBPAGE_CONDITION_URL_CANNOT_BE_EMPTY = 87 - WEBPAGE_CONDITION_URL_UNSUPPORTED_PROTOCOL = 88 - WEBPAGE_CONDITION_URL_CANNOT_BE_IP_ADDRESS = 89 - WEBPAGE_CONDITION_URL_DOMAIN_NOT_CONSISTENT_WITH_CAMPAIGN_SETTING = 90 - WEBPAGE_CONDITION_URL_CANNOT_BE_PUBLIC_SUFFIX = 91 - WEBPAGE_CONDITION_URL_INVALID_PUBLIC_SUFFIX = 92 - WEBPAGE_CONDITION_URL_VALUE_TRACK_VALUE_NOT_SUPPORTED = 93 - WEBPAGE_CRITERION_URL_EQUALS_CAN_HAVE_ONLY_ONE_CONDITION = 94 - WEBPAGE_CRITERION_NOT_SUPPORTED_ON_NON_DSA_AD_GROUP = 95 - CANNOT_TARGET_USER_LIST_FOR_SMART_DISPLAY_CAMPAIGNS = 99 - CANNOT_TARGET_PLACEMENTS_FOR_SEARCH_CAMPAIGNS = 126 - LISTING_SCOPE_TOO_MANY_DIMENSION_TYPES = 100 - LISTING_SCOPE_TOO_MANY_IN_OPERATORS = 101 - LISTING_SCOPE_IN_OPERATOR_NOT_SUPPORTED = 102 - DUPLICATE_LISTING_DIMENSION_TYPE = 103 - DUPLICATE_LISTING_DIMENSION_VALUE = 104 - CANNOT_SET_BIDS_ON_LISTING_GROUP_SUBDIVISION = 105 - INVALID_LISTING_GROUP_HIERARCHY = 106 - LISTING_GROUP_UNIT_CANNOT_HAVE_CHILDREN = 107 - LISTING_GROUP_SUBDIVISION_REQUIRES_OTHERS_CASE = 108 - LISTING_GROUP_REQUIRES_SAME_DIMENSION_TYPE_AS_SIBLINGS = 109 - LISTING_GROUP_ALREADY_EXISTS = 110 - LISTING_GROUP_DOES_NOT_EXIST = 111 - LISTING_GROUP_CANNOT_BE_REMOVED = 112 - INVALID_LISTING_GROUP_TYPE = 113 - LISTING_GROUP_ADD_MAY_ONLY_USE_TEMP_ID = 114 - LISTING_SCOPE_TOO_LONG = 115 - LISTING_SCOPE_TOO_MANY_DIMENSIONS = 116 - LISTING_GROUP_TOO_LONG = 117 - LISTING_GROUP_TREE_TOO_DEEP = 118 - INVALID_LISTING_DIMENSION = 119 - INVALID_LISTING_DIMENSION_TYPE = 120 - ADVERTISER_NOT_ON_ALLOWLIST_FOR_COMBINED_AUDIENCE_ON_DISPLAY = 127 - CANNOT_TARGET_REMOVED_COMBINED_AUDIENCE = 128 - INVALID_COMBINED_AUDIENCE_ID = 129 - CANNOT_TARGET_REMOVED_CUSTOM_AUDIENCE = 130 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/currency_code_error.py b/google/ads/googleads/v6/errors/types/currency_code_error.py deleted file mode 100644 index 7e4e0852f..000000000 --- a/google/ads/googleads/v6/errors/types/currency_code_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CurrencyCodeErrorEnum",}, -) - - -class CurrencyCodeErrorEnum(proto.Message): - r"""Container for enum describing possible currency code errors.""" - - class CurrencyCodeError(proto.Enum): - r"""Enum describing possible currency code errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UNSUPPORTED = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/custom_audience_error.py b/google/ads/googleads/v6/errors/types/custom_audience_error.py deleted file mode 100644 index 3e3df7c57..000000000 --- a/google/ads/googleads/v6/errors/types/custom_audience_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomAudienceErrorEnum",}, -) - - -class CustomAudienceErrorEnum(proto.Message): - r"""Container for enum describing possible custom audience - errors. - """ - - class CustomAudienceError(proto.Enum): - r"""Enum describing possible custom audience errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NAME_ALREADY_USED = 2 - CANNOT_REMOVE_WHILE_IN_USE = 3 - RESOURCE_ALREADY_REMOVED = 4 - MEMBER_TYPE_AND_PARAMETER_ALREADY_EXISTED = 5 - INVALID_MEMBER_TYPE = 6 - MEMBER_TYPE_AND_VALUE_DOES_NOT_MATCH = 7 - POLICY_VIOLATION = 8 - INVALID_TYPE_CHANGE = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/custom_interest_error.py b/google/ads/googleads/v6/errors/types/custom_interest_error.py deleted file mode 100644 index b01d122c6..000000000 --- a/google/ads/googleads/v6/errors/types/custom_interest_error.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomInterestErrorEnum",}, -) - - -class CustomInterestErrorEnum(proto.Message): - r"""Container for enum describing possible custom interest - errors. - """ - - class CustomInterestError(proto.Enum): - r"""Enum describing possible custom interest errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NAME_ALREADY_USED = 2 - CUSTOM_INTEREST_MEMBER_ID_AND_TYPE_PARAMETER_NOT_PRESENT_IN_REMOVE = 3 - TYPE_AND_PARAMETER_NOT_FOUND = 4 - TYPE_AND_PARAMETER_ALREADY_EXISTED = 5 - INVALID_CUSTOM_INTEREST_MEMBER_TYPE = 6 - CANNOT_REMOVE_WHILE_IN_USE = 7 - CANNOT_CHANGE_TYPE = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/customer_client_link_error.py b/google/ads/googleads/v6/errors/types/customer_client_link_error.py deleted file mode 100644 index cc7f812af..000000000 --- a/google/ads/googleads/v6/errors/types/customer_client_link_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomerClientLinkErrorEnum",}, -) - - -class CustomerClientLinkErrorEnum(proto.Message): - r"""Container for enum describing possible CustomeClientLink - errors. - """ - - class CustomerClientLinkError(proto.Enum): - r"""Enum describing possible CustomerClientLink errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CLIENT_ALREADY_INVITED_BY_THIS_MANAGER = 2 - CLIENT_ALREADY_MANAGED_IN_HIERARCHY = 3 - CYCLIC_LINK_NOT_ALLOWED = 4 - CUSTOMER_HAS_TOO_MANY_ACCOUNTS = 5 - CLIENT_HAS_TOO_MANY_INVITATIONS = 6 - CANNOT_HIDE_OR_UNHIDE_MANAGER_ACCOUNTS = 7 - CUSTOMER_HAS_TOO_MANY_ACCOUNTS_AT_MANAGER = 8 - CLIENT_HAS_TOO_MANY_MANAGERS = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/customer_feed_error.py b/google/ads/googleads/v6/errors/types/customer_feed_error.py deleted file mode 100644 index cad9d0672..000000000 --- a/google/ads/googleads/v6/errors/types/customer_feed_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomerFeedErrorEnum",}, -) - - -class CustomerFeedErrorEnum(proto.Message): - r"""Container for enum describing possible customer feed errors.""" - - class CustomerFeedError(proto.Enum): - r"""Enum describing possible customer feed errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 2 - CANNOT_CREATE_FOR_REMOVED_FEED = 3 - CANNOT_CREATE_ALREADY_EXISTING_CUSTOMER_FEED = 4 - CANNOT_MODIFY_REMOVED_CUSTOMER_FEED = 5 - INVALID_PLACEHOLDER_TYPE = 6 - MISSING_FEEDMAPPING_FOR_PLACEHOLDER_TYPE = 7 - PLACEHOLDER_TYPE_NOT_ALLOWED_ON_CUSTOMER_FEED = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/customer_manager_link_error.py b/google/ads/googleads/v6/errors/types/customer_manager_link_error.py deleted file mode 100644 index a5f77c192..000000000 --- a/google/ads/googleads/v6/errors/types/customer_manager_link_error.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomerManagerLinkErrorEnum",}, -) - - -class CustomerManagerLinkErrorEnum(proto.Message): - r"""Container for enum describing possible CustomerManagerLink - errors. - """ - - class CustomerManagerLinkError(proto.Enum): - r"""Enum describing possible CustomerManagerLink errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NO_PENDING_INVITE = 2 - SAME_CLIENT_MORE_THAN_ONCE_PER_CALL = 3 - MANAGER_HAS_MAX_NUMBER_OF_LINKED_ACCOUNTS = 4 - CANNOT_UNLINK_ACCOUNT_WITHOUT_ACTIVE_USER = 5 - CANNOT_REMOVE_LAST_CLIENT_ACCOUNT_OWNER = 6 - CANNOT_CHANGE_ROLE_BY_NON_ACCOUNT_OWNER = 7 - CANNOT_CHANGE_ROLE_FOR_NON_ACTIVE_LINK_ACCOUNT = 8 - DUPLICATE_CHILD_FOUND = 9 - TEST_ACCOUNT_LINKS_TOO_MANY_CHILD_ACCOUNTS = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/customer_user_access_error.py b/google/ads/googleads/v6/errors/types/customer_user_access_error.py deleted file mode 100644 index 073e1379f..000000000 --- a/google/ads/googleads/v6/errors/types/customer_user_access_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomerUserAccessErrorEnum",}, -) - - -class CustomerUserAccessErrorEnum(proto.Message): - r"""Container for enum describing possible CustomerUserAccess - errors. - """ - - class CustomerUserAccessError(proto.Enum): - r"""Enum describing possible customer user access errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_USER_ID = 2 - REMOVAL_DISALLOWED = 3 - DISALLOWED_ACCESS_ROLE = 4 - LAST_ADMIN_USER_OF_SERVING_CUSTOMER = 5 - LAST_ADMIN_USER_OF_MANAGER = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/database_error.py b/google/ads/googleads/v6/errors/types/database_error.py deleted file mode 100644 index d30a273a5..000000000 --- a/google/ads/googleads/v6/errors/types/database_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"DatabaseErrorEnum",}, -) - - -class DatabaseErrorEnum(proto.Message): - r"""Container for enum describing possible database errors.""" - - class DatabaseError(proto.Enum): - r"""Enum describing possible database errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CONCURRENT_MODIFICATION = 2 - DATA_CONSTRAINT_VIOLATION = 3 - REQUEST_TOO_LARGE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/date_error.py b/google/ads/googleads/v6/errors/types/date_error.py deleted file mode 100644 index 6f958a7f2..000000000 --- a/google/ads/googleads/v6/errors/types/date_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"DateErrorEnum",}, -) - - -class DateErrorEnum(proto.Message): - r"""Container for enum describing possible date errors.""" - - class DateError(proto.Enum): - r"""Enum describing possible date errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_FIELD_VALUES_IN_DATE = 2 - INVALID_FIELD_VALUES_IN_DATE_TIME = 3 - INVALID_STRING_DATE = 4 - INVALID_STRING_DATE_TIME_MICROS = 6 - INVALID_STRING_DATE_TIME_SECONDS = 11 - INVALID_STRING_DATE_TIME_SECONDS_WITH_OFFSET = 12 - EARLIER_THAN_MINIMUM_DATE = 7 - LATER_THAN_MAXIMUM_DATE = 8 - DATE_RANGE_MINIMUM_DATE_LATER_THAN_MAXIMUM_DATE = 9 - DATE_RANGE_MINIMUM_AND_MAXIMUM_DATES_BOTH_NULL = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/date_range_error.py b/google/ads/googleads/v6/errors/types/date_range_error.py deleted file mode 100644 index 5d0689df6..000000000 --- a/google/ads/googleads/v6/errors/types/date_range_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"DateRangeErrorEnum",}, -) - - -class DateRangeErrorEnum(proto.Message): - r"""Container for enum describing possible date range errors.""" - - class DateRangeError(proto.Enum): - r"""Enum describing possible date range errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_DATE = 2 - START_DATE_AFTER_END_DATE = 3 - CANNOT_SET_DATE_TO_PAST = 4 - AFTER_MAXIMUM_ALLOWABLE_DATE = 5 - CANNOT_MODIFY_START_DATE_IF_ALREADY_STARTED = 6 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/distinct_error.py b/google/ads/googleads/v6/errors/types/distinct_error.py deleted file mode 100644 index 1952b372e..000000000 --- a/google/ads/googleads/v6/errors/types/distinct_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"DistinctErrorEnum",}, -) - - -class DistinctErrorEnum(proto.Message): - r"""Container for enum describing possible distinct errors.""" - - class DistinctError(proto.Enum): - r"""Enum describing possible distinct errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - DUPLICATE_ELEMENT = 2 - DUPLICATE_TYPE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/enum_error.py b/google/ads/googleads/v6/errors/types/enum_error.py deleted file mode 100644 index ed2e48af7..000000000 --- a/google/ads/googleads/v6/errors/types/enum_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"EnumErrorEnum",}, -) - - -class EnumErrorEnum(proto.Message): - r"""Container for enum describing possible enum errors.""" - - class EnumError(proto.Enum): - r"""Enum describing possible enum errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ENUM_VALUE_NOT_PERMITTED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/errors.py b/google/ads/googleads/v6/errors/types/errors.py deleted file mode 100644 index a203fc74f..000000000 --- a/google/ads/googleads/v6/errors/types/errors.py +++ /dev/null @@ -1,1521 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.common.types import value -from google.ads.googleads.v6.errors.types import ( - access_invitation_error as gage_access_invitation_error, -) -from google.ads.googleads.v6.errors.types import ( - account_budget_proposal_error as gage_account_budget_proposal_error, -) -from google.ads.googleads.v6.errors.types import ( - account_link_error as gage_account_link_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_customizer_error as gage_ad_customizer_error, -) -from google.ads.googleads.v6.errors.types import ad_error as gage_ad_error -from google.ads.googleads.v6.errors.types import ( - ad_group_ad_error as gage_ad_group_ad_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_group_bid_modifier_error as gage_ad_group_bid_modifier_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_group_criterion_error as gage_ad_group_criterion_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_group_error as gage_ad_group_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_group_feed_error as gage_ad_group_feed_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_parameter_error as gage_ad_parameter_error, -) -from google.ads.googleads.v6.errors.types import ( - ad_sharing_error as gage_ad_sharing_error, -) -from google.ads.googleads.v6.errors.types import adx_error as gage_adx_error -from google.ads.googleads.v6.errors.types import asset_error as gage_asset_error -from google.ads.googleads.v6.errors.types import ( - asset_link_error as gage_asset_link_error, -) -from google.ads.googleads.v6.errors.types import ( - authentication_error as gage_authentication_error, -) -from google.ads.googleads.v6.errors.types import ( - authorization_error as gage_authorization_error, -) -from google.ads.googleads.v6.errors.types import ( - batch_job_error as gage_batch_job_error, -) -from google.ads.googleads.v6.errors.types import ( - bidding_error as gage_bidding_error, -) -from google.ads.googleads.v6.errors.types import ( - bidding_strategy_error as gage_bidding_strategy_error, -) -from google.ads.googleads.v6.errors.types import ( - billing_setup_error as gage_billing_setup_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_budget_error as gage_campaign_budget_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_criterion_error as gage_campaign_criterion_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_draft_error as gage_campaign_draft_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_error as gage_campaign_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_experiment_error as gage_campaign_experiment_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_feed_error as gage_campaign_feed_error, -) -from google.ads.googleads.v6.errors.types import ( - campaign_shared_set_error as gage_campaign_shared_set_error, -) -from google.ads.googleads.v6.errors.types import ( - change_event_error as gage_change_event_error, -) -from google.ads.googleads.v6.errors.types import ( - change_status_error as gage_change_status_error, -) -from google.ads.googleads.v6.errors.types import ( - collection_size_error as gage_collection_size_error, -) -from google.ads.googleads.v6.errors.types import ( - context_error as gage_context_error, -) -from google.ads.googleads.v6.errors.types import ( - conversion_action_error as gage_conversion_action_error, -) -from google.ads.googleads.v6.errors.types import ( - conversion_adjustment_upload_error as gage_conversion_adjustment_upload_error, -) -from google.ads.googleads.v6.errors.types import ( - conversion_upload_error as gage_conversion_upload_error, -) -from google.ads.googleads.v6.errors.types import ( - country_code_error as gage_country_code_error, -) -from google.ads.googleads.v6.errors.types import ( - criterion_error as gage_criterion_error, -) -from google.ads.googleads.v6.errors.types import ( - currency_code_error as gage_currency_code_error, -) -from google.ads.googleads.v6.errors.types import ( - custom_audience_error as gage_custom_audience_error, -) -from google.ads.googleads.v6.errors.types import ( - custom_interest_error as gage_custom_interest_error, -) -from google.ads.googleads.v6.errors.types import ( - customer_client_link_error as gage_customer_client_link_error, -) -from google.ads.googleads.v6.errors.types import ( - customer_error as gage_customer_error, -) -from google.ads.googleads.v6.errors.types import ( - customer_feed_error as gage_customer_feed_error, -) -from google.ads.googleads.v6.errors.types import ( - customer_manager_link_error as gage_customer_manager_link_error, -) -from google.ads.googleads.v6.errors.types import ( - customer_user_access_error as gage_customer_user_access_error, -) -from google.ads.googleads.v6.errors.types import ( - database_error as gage_database_error, -) -from google.ads.googleads.v6.errors.types import date_error as gage_date_error -from google.ads.googleads.v6.errors.types import ( - date_range_error as gage_date_range_error, -) -from google.ads.googleads.v6.errors.types import ( - distinct_error as gage_distinct_error, -) -from google.ads.googleads.v6.errors.types import enum_error as gage_enum_error -from google.ads.googleads.v6.errors.types import ( - extension_feed_item_error as gage_extension_feed_item_error, -) -from google.ads.googleads.v6.errors.types import ( - extension_setting_error as gage_extension_setting_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_attribute_reference_error as gage_feed_attribute_reference_error, -) -from google.ads.googleads.v6.errors.types import feed_error as gage_feed_error -from google.ads.googleads.v6.errors.types import ( - feed_item_error as gage_feed_item_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_item_set_error as gage_feed_item_set_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_item_set_link_error as gage_feed_item_set_link_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_item_target_error as gage_feed_item_target_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_item_validation_error as gage_feed_item_validation_error, -) -from google.ads.googleads.v6.errors.types import ( - feed_mapping_error as gage_feed_mapping_error, -) -from google.ads.googleads.v6.errors.types import field_error as gage_field_error -from google.ads.googleads.v6.errors.types import ( - field_mask_error as gage_field_mask_error, -) -from google.ads.googleads.v6.errors.types import ( - function_error as gage_function_error, -) -from google.ads.googleads.v6.errors.types import ( - function_parsing_error as gage_function_parsing_error, -) -from google.ads.googleads.v6.errors.types import ( - geo_target_constant_suggestion_error as gage_geo_target_constant_suggestion_error, -) -from google.ads.googleads.v6.errors.types import ( - header_error as gage_header_error, -) -from google.ads.googleads.v6.errors.types import id_error as gage_id_error -from google.ads.googleads.v6.errors.types import image_error as gage_image_error -from google.ads.googleads.v6.errors.types import ( - internal_error as gage_internal_error, -) -from google.ads.googleads.v6.errors.types import ( - invoice_error as gage_invoice_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_ad_group_error as gage_keyword_plan_ad_group_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_ad_group_keyword_error as gage_keyword_plan_ad_group_keyword_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_campaign_error as gage_keyword_plan_campaign_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_campaign_keyword_error as gage_keyword_plan_campaign_keyword_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_error as gage_keyword_plan_error, -) -from google.ads.googleads.v6.errors.types import ( - keyword_plan_idea_error as gage_keyword_plan_idea_error, -) -from google.ads.googleads.v6.errors.types import label_error as gage_label_error -from google.ads.googleads.v6.errors.types import ( - language_code_error as gage_language_code_error, -) -from google.ads.googleads.v6.errors.types import ( - list_operation_error as gage_list_operation_error, -) -from google.ads.googleads.v6.errors.types import ( - manager_link_error as gage_manager_link_error, -) -from google.ads.googleads.v6.errors.types import ( - media_bundle_error as gage_media_bundle_error, -) -from google.ads.googleads.v6.errors.types import ( - media_file_error as gage_media_file_error, -) -from google.ads.googleads.v6.errors.types import ( - media_upload_error as gage_media_upload_error, -) -from google.ads.googleads.v6.errors.types import ( - multiplier_error as gage_multiplier_error, -) -from google.ads.googleads.v6.errors.types import ( - mutate_error as gage_mutate_error, -) -from google.ads.googleads.v6.errors.types import ( - new_resource_creation_error as gage_new_resource_creation_error, -) -from google.ads.googleads.v6.errors.types import ( - not_allowlisted_error as gage_not_allowlisted_error, -) -from google.ads.googleads.v6.errors.types import ( - not_empty_error as gage_not_empty_error, -) -from google.ads.googleads.v6.errors.types import null_error as gage_null_error -from google.ads.googleads.v6.errors.types import ( - offline_user_data_job_error as gage_offline_user_data_job_error, -) -from google.ads.googleads.v6.errors.types import ( - operation_access_denied_error as gage_operation_access_denied_error, -) -from google.ads.googleads.v6.errors.types import ( - operator_error as gage_operator_error, -) -from google.ads.googleads.v6.errors.types import ( - partial_failure_error as gage_partial_failure_error, -) -from google.ads.googleads.v6.errors.types import ( - payments_account_error as gage_payments_account_error, -) -from google.ads.googleads.v6.errors.types import ( - policy_finding_error as gage_policy_finding_error, -) -from google.ads.googleads.v6.errors.types import ( - policy_validation_parameter_error as gage_policy_validation_parameter_error, -) -from google.ads.googleads.v6.errors.types import ( - policy_violation_error as gage_policy_violation_error, -) -from google.ads.googleads.v6.errors.types import query_error as gage_query_error -from google.ads.googleads.v6.errors.types import quota_error as gage_quota_error -from google.ads.googleads.v6.errors.types import range_error as gage_range_error -from google.ads.googleads.v6.errors.types import ( - reach_plan_error as gage_reach_plan_error, -) -from google.ads.googleads.v6.errors.types import ( - recommendation_error as gage_recommendation_error, -) -from google.ads.googleads.v6.errors.types import ( - region_code_error as gage_region_code_error, -) -from google.ads.googleads.v6.errors.types import ( - request_error as gage_request_error, -) -from google.ads.googleads.v6.errors.types import ( - resource_access_denied_error as gage_resource_access_denied_error, -) -from google.ads.googleads.v6.errors.types import ( - resource_count_limit_exceeded_error as gage_resource_count_limit_exceeded_error, -) -from google.ads.googleads.v6.errors.types import ( - setting_error as gage_setting_error, -) -from google.ads.googleads.v6.errors.types import ( - shared_criterion_error as gage_shared_criterion_error, -) -from google.ads.googleads.v6.errors.types import ( - shared_set_error as gage_shared_set_error, -) -from google.ads.googleads.v6.errors.types import ( - size_limit_error as gage_size_limit_error, -) -from google.ads.googleads.v6.errors.types import ( - string_format_error as gage_string_format_error, -) -from google.ads.googleads.v6.errors.types import ( - string_length_error as gage_string_length_error, -) -from google.ads.googleads.v6.errors.types import ( - third_party_app_analytics_link_error as gage_third_party_app_analytics_link_error, -) -from google.ads.googleads.v6.errors.types import ( - time_zone_error as gage_time_zone_error, -) -from google.ads.googleads.v6.errors.types import ( - url_field_error as gage_url_field_error, -) -from google.ads.googleads.v6.errors.types import ( - user_data_error as gage_user_data_error, -) -from google.ads.googleads.v6.errors.types import ( - user_list_error as gage_user_list_error, -) -from google.ads.googleads.v6.errors.types import ( - youtube_video_registration_error as gage_youtube_video_registration_error, -) -from google.protobuf import duration_pb2 as duration # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={ - "GoogleAdsFailure", - "GoogleAdsError", - "ErrorCode", - "ErrorLocation", - "ErrorDetails", - "PolicyViolationDetails", - "PolicyFindingDetails", - "QuotaErrorDetails", - }, -) - - -class GoogleAdsFailure(proto.Message): - r"""Describes how a GoogleAds API call failed. It's returned - inside google.rpc.Status.details when a call fails. - - Attributes: - errors (Sequence[google.ads.googleads.v6.errors.types.GoogleAdsError]): - The list of errors that occurred. - """ - - errors = proto.RepeatedField( - proto.MESSAGE, number=1, message="GoogleAdsError", - ) - - -class GoogleAdsError(proto.Message): - r"""GoogleAds-specific error. - - Attributes: - error_code (google.ads.googleads.v6.errors.types.ErrorCode): - An enum value that indicates which error - occurred. - message (str): - A human-readable description of the error. - trigger (google.ads.googleads.v6.common.types.Value): - The value that triggered the error. - location (google.ads.googleads.v6.errors.types.ErrorLocation): - Describes the part of the request proto that - caused the error. - details (google.ads.googleads.v6.errors.types.ErrorDetails): - Additional error details, which are returned - by certain error codes. Most error codes do not - include details. - """ - - error_code = proto.Field(proto.MESSAGE, number=1, message="ErrorCode",) - message = proto.Field(proto.STRING, number=2) - trigger = proto.Field(proto.MESSAGE, number=3, message=value.Value,) - location = proto.Field(proto.MESSAGE, number=4, message="ErrorLocation",) - details = proto.Field(proto.MESSAGE, number=5, message="ErrorDetails",) - - -class ErrorCode(proto.Message): - r"""The error reason represented by type and enum. - - Attributes: - request_error (google.ads.googleads.v6.errors.types.RequestErrorEnum.RequestError): - An error caused by the request - bidding_strategy_error (google.ads.googleads.v6.errors.types.BiddingStrategyErrorEnum.BiddingStrategyError): - An error with a Bidding Strategy mutate. - url_field_error (google.ads.googleads.v6.errors.types.UrlFieldErrorEnum.UrlFieldError): - An error with a URL field mutate. - list_operation_error (google.ads.googleads.v6.errors.types.ListOperationErrorEnum.ListOperationError): - An error with a list operation. - query_error (google.ads.googleads.v6.errors.types.QueryErrorEnum.QueryError): - An error with an AWQL query - mutate_error (google.ads.googleads.v6.errors.types.MutateErrorEnum.MutateError): - An error with a mutate - field_mask_error (google.ads.googleads.v6.errors.types.FieldMaskErrorEnum.FieldMaskError): - An error with a field mask - authorization_error (google.ads.googleads.v6.errors.types.AuthorizationErrorEnum.AuthorizationError): - An error encountered when trying to authorize - a user. - internal_error (google.ads.googleads.v6.errors.types.InternalErrorEnum.InternalError): - An unexpected server-side error. - quota_error (google.ads.googleads.v6.errors.types.QuotaErrorEnum.QuotaError): - An error with the amonut of quota remaining. - ad_error (google.ads.googleads.v6.errors.types.AdErrorEnum.AdError): - An error with an Ad Group Ad mutate. - ad_group_error (google.ads.googleads.v6.errors.types.AdGroupErrorEnum.AdGroupError): - An error with an Ad Group mutate. - campaign_budget_error (google.ads.googleads.v6.errors.types.CampaignBudgetErrorEnum.CampaignBudgetError): - An error with a Campaign Budget mutate. - campaign_error (google.ads.googleads.v6.errors.types.CampaignErrorEnum.CampaignError): - An error with a Campaign mutate. - authentication_error (google.ads.googleads.v6.errors.types.AuthenticationErrorEnum.AuthenticationError): - Indicates failure to properly authenticate - user. - ad_group_criterion_error (google.ads.googleads.v6.errors.types.AdGroupCriterionErrorEnum.AdGroupCriterionError): - Indicates failure to properly authenticate - user. - ad_customizer_error (google.ads.googleads.v6.errors.types.AdCustomizerErrorEnum.AdCustomizerError): - The reasons for the ad customizer error - ad_group_ad_error (google.ads.googleads.v6.errors.types.AdGroupAdErrorEnum.AdGroupAdError): - The reasons for the ad group ad error - ad_sharing_error (google.ads.googleads.v6.errors.types.AdSharingErrorEnum.AdSharingError): - The reasons for the ad sharing error - adx_error (google.ads.googleads.v6.errors.types.AdxErrorEnum.AdxError): - The reasons for the adx error - asset_error (google.ads.googleads.v6.errors.types.AssetErrorEnum.AssetError): - The reasons for the asset error - bidding_error (google.ads.googleads.v6.errors.types.BiddingErrorEnum.BiddingError): - The reasons for the bidding errors - campaign_criterion_error (google.ads.googleads.v6.errors.types.CampaignCriterionErrorEnum.CampaignCriterionError): - The reasons for the campaign criterion error - collection_size_error (google.ads.googleads.v6.errors.types.CollectionSizeErrorEnum.CollectionSizeError): - The reasons for the collection size error - country_code_error (google.ads.googleads.v6.errors.types.CountryCodeErrorEnum.CountryCodeError): - The reasons for the country code error - criterion_error (google.ads.googleads.v6.errors.types.CriterionErrorEnum.CriterionError): - The reasons for the criterion error - customer_error (google.ads.googleads.v6.errors.types.CustomerErrorEnum.CustomerError): - The reasons for the customer error - date_error (google.ads.googleads.v6.errors.types.DateErrorEnum.DateError): - The reasons for the date error - date_range_error (google.ads.googleads.v6.errors.types.DateRangeErrorEnum.DateRangeError): - The reasons for the date range error - distinct_error (google.ads.googleads.v6.errors.types.DistinctErrorEnum.DistinctError): - The reasons for the distinct error - feed_attribute_reference_error (google.ads.googleads.v6.errors.types.FeedAttributeReferenceErrorEnum.FeedAttributeReferenceError): - The reasons for the feed attribute reference - error - function_error (google.ads.googleads.v6.errors.types.FunctionErrorEnum.FunctionError): - The reasons for the function error - function_parsing_error (google.ads.googleads.v6.errors.types.FunctionParsingErrorEnum.FunctionParsingError): - The reasons for the function parsing error - id_error (google.ads.googleads.v6.errors.types.IdErrorEnum.IdError): - The reasons for the id error - image_error (google.ads.googleads.v6.errors.types.ImageErrorEnum.ImageError): - The reasons for the image error - language_code_error (google.ads.googleads.v6.errors.types.LanguageCodeErrorEnum.LanguageCodeError): - The reasons for the language code error - media_bundle_error (google.ads.googleads.v6.errors.types.MediaBundleErrorEnum.MediaBundleError): - The reasons for the media bundle error - media_upload_error (google.ads.googleads.v6.errors.types.MediaUploadErrorEnum.MediaUploadError): - The reasons for media uploading errors. - media_file_error (google.ads.googleads.v6.errors.types.MediaFileErrorEnum.MediaFileError): - The reasons for the media file error - multiplier_error (google.ads.googleads.v6.errors.types.MultiplierErrorEnum.MultiplierError): - The reasons for the multiplier error - new_resource_creation_error (google.ads.googleads.v6.errors.types.NewResourceCreationErrorEnum.NewResourceCreationError): - The reasons for the new resource creation - error - not_empty_error (google.ads.googleads.v6.errors.types.NotEmptyErrorEnum.NotEmptyError): - The reasons for the not empty error - null_error (google.ads.googleads.v6.errors.types.NullErrorEnum.NullError): - The reasons for the null error - operator_error (google.ads.googleads.v6.errors.types.OperatorErrorEnum.OperatorError): - The reasons for the operator error - range_error (google.ads.googleads.v6.errors.types.RangeErrorEnum.RangeError): - The reasons for the range error - recommendation_error (google.ads.googleads.v6.errors.types.RecommendationErrorEnum.RecommendationError): - The reasons for error in applying a - recommendation - region_code_error (google.ads.googleads.v6.errors.types.RegionCodeErrorEnum.RegionCodeError): - The reasons for the region code error - setting_error (google.ads.googleads.v6.errors.types.SettingErrorEnum.SettingError): - The reasons for the setting error - string_format_error (google.ads.googleads.v6.errors.types.StringFormatErrorEnum.StringFormatError): - The reasons for the string format error - string_length_error (google.ads.googleads.v6.errors.types.StringLengthErrorEnum.StringLengthError): - The reasons for the string length error - operation_access_denied_error (google.ads.googleads.v6.errors.types.OperationAccessDeniedErrorEnum.OperationAccessDeniedError): - The reasons for the operation access denied - error - resource_access_denied_error (google.ads.googleads.v6.errors.types.ResourceAccessDeniedErrorEnum.ResourceAccessDeniedError): - The reasons for the resource access denied - error - resource_count_limit_exceeded_error (google.ads.googleads.v6.errors.types.ResourceCountLimitExceededErrorEnum.ResourceCountLimitExceededError): - The reasons for the resource count limit - exceeded error - youtube_video_registration_error (google.ads.googleads.v6.errors.types.YoutubeVideoRegistrationErrorEnum.YoutubeVideoRegistrationError): - The reasons for YouTube video registration - errors. - ad_group_bid_modifier_error (google.ads.googleads.v6.errors.types.AdGroupBidModifierErrorEnum.AdGroupBidModifierError): - The reasons for the ad group bid modifier - error - context_error (google.ads.googleads.v6.errors.types.ContextErrorEnum.ContextError): - The reasons for the context error - field_error (google.ads.googleads.v6.errors.types.FieldErrorEnum.FieldError): - The reasons for the field error - shared_set_error (google.ads.googleads.v6.errors.types.SharedSetErrorEnum.SharedSetError): - The reasons for the shared set error - shared_criterion_error (google.ads.googleads.v6.errors.types.SharedCriterionErrorEnum.SharedCriterionError): - The reasons for the shared criterion error - campaign_shared_set_error (google.ads.googleads.v6.errors.types.CampaignSharedSetErrorEnum.CampaignSharedSetError): - The reasons for the campaign shared set error - conversion_action_error (google.ads.googleads.v6.errors.types.ConversionActionErrorEnum.ConversionActionError): - The reasons for the conversion action error - conversion_adjustment_upload_error (google.ads.googleads.v6.errors.types.ConversionAdjustmentUploadErrorEnum.ConversionAdjustmentUploadError): - The reasons for the conversion adjustment - upload error - conversion_upload_error (google.ads.googleads.v6.errors.types.ConversionUploadErrorEnum.ConversionUploadError): - The reasons for the conversion upload error - header_error (google.ads.googleads.v6.errors.types.HeaderErrorEnum.HeaderError): - The reasons for the header error. - database_error (google.ads.googleads.v6.errors.types.DatabaseErrorEnum.DatabaseError): - The reasons for the database error. - policy_finding_error (google.ads.googleads.v6.errors.types.PolicyFindingErrorEnum.PolicyFindingError): - The reasons for the policy finding error. - enum_error (google.ads.googleads.v6.errors.types.EnumErrorEnum.EnumError): - The reason for enum error. - keyword_plan_error (google.ads.googleads.v6.errors.types.KeywordPlanErrorEnum.KeywordPlanError): - The reason for keyword plan error. - keyword_plan_campaign_error (google.ads.googleads.v6.errors.types.KeywordPlanCampaignErrorEnum.KeywordPlanCampaignError): - The reason for keyword plan campaign error. - keyword_plan_campaign_keyword_error (google.ads.googleads.v6.errors.types.KeywordPlanCampaignKeywordErrorEnum.KeywordPlanCampaignKeywordError): - The reason for keyword plan campaign keyword - error. - keyword_plan_ad_group_error (google.ads.googleads.v6.errors.types.KeywordPlanAdGroupErrorEnum.KeywordPlanAdGroupError): - The reason for keyword plan ad group error. - keyword_plan_ad_group_keyword_error (google.ads.googleads.v6.errors.types.KeywordPlanAdGroupKeywordErrorEnum.KeywordPlanAdGroupKeywordError): - The reason for keyword plan ad group keyword - error. - keyword_plan_idea_error (google.ads.googleads.v6.errors.types.KeywordPlanIdeaErrorEnum.KeywordPlanIdeaError): - The reason for keyword idea error. - account_budget_proposal_error (google.ads.googleads.v6.errors.types.AccountBudgetProposalErrorEnum.AccountBudgetProposalError): - The reasons for account budget proposal - errors. - user_list_error (google.ads.googleads.v6.errors.types.UserListErrorEnum.UserListError): - The reasons for the user list error - change_event_error (google.ads.googleads.v6.errors.types.ChangeEventErrorEnum.ChangeEventError): - The reasons for the change event error - change_status_error (google.ads.googleads.v6.errors.types.ChangeStatusErrorEnum.ChangeStatusError): - The reasons for the change status error - feed_error (google.ads.googleads.v6.errors.types.FeedErrorEnum.FeedError): - The reasons for the feed error - geo_target_constant_suggestion_error (google.ads.googleads.v6.errors.types.GeoTargetConstantSuggestionErrorEnum.GeoTargetConstantSuggestionError): - The reasons for the geo target constant - suggestion error. - campaign_draft_error (google.ads.googleads.v6.errors.types.CampaignDraftErrorEnum.CampaignDraftError): - The reasons for the campaign draft error - feed_item_error (google.ads.googleads.v6.errors.types.FeedItemErrorEnum.FeedItemError): - The reasons for the feed item error - label_error (google.ads.googleads.v6.errors.types.LabelErrorEnum.LabelError): - The reason for the label error. - billing_setup_error (google.ads.googleads.v6.errors.types.BillingSetupErrorEnum.BillingSetupError): - The reasons for the billing setup error - customer_client_link_error (google.ads.googleads.v6.errors.types.CustomerClientLinkErrorEnum.CustomerClientLinkError): - The reasons for the customer client link - error - customer_manager_link_error (google.ads.googleads.v6.errors.types.CustomerManagerLinkErrorEnum.CustomerManagerLinkError): - The reasons for the customer manager link - error - feed_mapping_error (google.ads.googleads.v6.errors.types.FeedMappingErrorEnum.FeedMappingError): - The reasons for the feed mapping error - customer_feed_error (google.ads.googleads.v6.errors.types.CustomerFeedErrorEnum.CustomerFeedError): - The reasons for the customer feed error - ad_group_feed_error (google.ads.googleads.v6.errors.types.AdGroupFeedErrorEnum.AdGroupFeedError): - The reasons for the ad group feed error - campaign_feed_error (google.ads.googleads.v6.errors.types.CampaignFeedErrorEnum.CampaignFeedError): - The reasons for the campaign feed error - custom_interest_error (google.ads.googleads.v6.errors.types.CustomInterestErrorEnum.CustomInterestError): - The reasons for the custom interest error - campaign_experiment_error (google.ads.googleads.v6.errors.types.CampaignExperimentErrorEnum.CampaignExperimentError): - The reasons for the campaign experiment error - extension_feed_item_error (google.ads.googleads.v6.errors.types.ExtensionFeedItemErrorEnum.ExtensionFeedItemError): - The reasons for the extension feed item error - ad_parameter_error (google.ads.googleads.v6.errors.types.AdParameterErrorEnum.AdParameterError): - The reasons for the ad parameter error - feed_item_validation_error (google.ads.googleads.v6.errors.types.FeedItemValidationErrorEnum.FeedItemValidationError): - The reasons for the feed item validation - error - extension_setting_error (google.ads.googleads.v6.errors.types.ExtensionSettingErrorEnum.ExtensionSettingError): - The reasons for the extension setting error - feed_item_set_error (google.ads.googleads.v6.errors.types.FeedItemSetErrorEnum.FeedItemSetError): - The reasons for the feed item set error - feed_item_set_link_error (google.ads.googleads.v6.errors.types.FeedItemSetLinkErrorEnum.FeedItemSetLinkError): - The reasons for the feed item set link error - feed_item_target_error (google.ads.googleads.v6.errors.types.FeedItemTargetErrorEnum.FeedItemTargetError): - The reasons for the feed item target error - policy_violation_error (google.ads.googleads.v6.errors.types.PolicyViolationErrorEnum.PolicyViolationError): - The reasons for the policy violation error - partial_failure_error (google.ads.googleads.v6.errors.types.PartialFailureErrorEnum.PartialFailureError): - The reasons for the mutate job error - policy_validation_parameter_error (google.ads.googleads.v6.errors.types.PolicyValidationParameterErrorEnum.PolicyValidationParameterError): - The reasons for the policy validation - parameter error - size_limit_error (google.ads.googleads.v6.errors.types.SizeLimitErrorEnum.SizeLimitError): - The reasons for the size limit error - offline_user_data_job_error (google.ads.googleads.v6.errors.types.OfflineUserDataJobErrorEnum.OfflineUserDataJobError): - The reasons for the offline user data job - error. - not_allowlisted_error (google.ads.googleads.v6.errors.types.NotAllowlistedErrorEnum.NotAllowlistedError): - The reasons for the not allowlisted error - manager_link_error (google.ads.googleads.v6.errors.types.ManagerLinkErrorEnum.ManagerLinkError): - The reasons for the manager link error - currency_code_error (google.ads.googleads.v6.errors.types.CurrencyCodeErrorEnum.CurrencyCodeError): - The reasons for the currency code error - access_invitation_error (google.ads.googleads.v6.errors.types.AccessInvitationErrorEnum.AccessInvitationError): - The reasons for the access invitation error - reach_plan_error (google.ads.googleads.v6.errors.types.ReachPlanErrorEnum.ReachPlanError): - The reasons for the reach plan error - invoice_error (google.ads.googleads.v6.errors.types.InvoiceErrorEnum.InvoiceError): - The reasons for the invoice error - payments_account_error (google.ads.googleads.v6.errors.types.PaymentsAccountErrorEnum.PaymentsAccountError): - The reasons for errors in payments accounts - service - time_zone_error (google.ads.googleads.v6.errors.types.TimeZoneErrorEnum.TimeZoneError): - The reasons for the time zone error - asset_link_error (google.ads.googleads.v6.errors.types.AssetLinkErrorEnum.AssetLinkError): - The reasons for the asset link error - user_data_error (google.ads.googleads.v6.errors.types.UserDataErrorEnum.UserDataError): - The reasons for the user data error. - batch_job_error (google.ads.googleads.v6.errors.types.BatchJobErrorEnum.BatchJobError): - The reasons for the batch job error - account_link_error (google.ads.googleads.v6.errors.types.AccountLinkErrorEnum.AccountLinkError): - The reasons for the account link status - change error - third_party_app_analytics_link_error (google.ads.googleads.v6.errors.types.ThirdPartyAppAnalyticsLinkErrorEnum.ThirdPartyAppAnalyticsLinkError): - The reasons for the third party app analytics - link mutate error - customer_user_access_error (google.ads.googleads.v6.errors.types.CustomerUserAccessErrorEnum.CustomerUserAccessError): - The reasons for the customer user access - mutate error - custom_audience_error (google.ads.googleads.v6.errors.types.CustomAudienceErrorEnum.CustomAudienceError): - The reasons for the custom audience error - """ - - request_error = proto.Field( - proto.ENUM, - number=1, - oneof="error_code", - enum=gage_request_error.RequestErrorEnum.RequestError, - ) - bidding_strategy_error = proto.Field( - proto.ENUM, - number=2, - oneof="error_code", - enum=gage_bidding_strategy_error.BiddingStrategyErrorEnum.BiddingStrategyError, - ) - url_field_error = proto.Field( - proto.ENUM, - number=3, - oneof="error_code", - enum=gage_url_field_error.UrlFieldErrorEnum.UrlFieldError, - ) - list_operation_error = proto.Field( - proto.ENUM, - number=4, - oneof="error_code", - enum=gage_list_operation_error.ListOperationErrorEnum.ListOperationError, - ) - query_error = proto.Field( - proto.ENUM, - number=5, - oneof="error_code", - enum=gage_query_error.QueryErrorEnum.QueryError, - ) - mutate_error = proto.Field( - proto.ENUM, - number=7, - oneof="error_code", - enum=gage_mutate_error.MutateErrorEnum.MutateError, - ) - field_mask_error = proto.Field( - proto.ENUM, - number=8, - oneof="error_code", - enum=gage_field_mask_error.FieldMaskErrorEnum.FieldMaskError, - ) - authorization_error = proto.Field( - proto.ENUM, - number=9, - oneof="error_code", - enum=gage_authorization_error.AuthorizationErrorEnum.AuthorizationError, - ) - internal_error = proto.Field( - proto.ENUM, - number=10, - oneof="error_code", - enum=gage_internal_error.InternalErrorEnum.InternalError, - ) - quota_error = proto.Field( - proto.ENUM, - number=11, - oneof="error_code", - enum=gage_quota_error.QuotaErrorEnum.QuotaError, - ) - ad_error = proto.Field( - proto.ENUM, - number=12, - oneof="error_code", - enum=gage_ad_error.AdErrorEnum.AdError, - ) - ad_group_error = proto.Field( - proto.ENUM, - number=13, - oneof="error_code", - enum=gage_ad_group_error.AdGroupErrorEnum.AdGroupError, - ) - campaign_budget_error = proto.Field( - proto.ENUM, - number=14, - oneof="error_code", - enum=gage_campaign_budget_error.CampaignBudgetErrorEnum.CampaignBudgetError, - ) - campaign_error = proto.Field( - proto.ENUM, - number=15, - oneof="error_code", - enum=gage_campaign_error.CampaignErrorEnum.CampaignError, - ) - authentication_error = proto.Field( - proto.ENUM, - number=17, - oneof="error_code", - enum=gage_authentication_error.AuthenticationErrorEnum.AuthenticationError, - ) - ad_group_criterion_error = proto.Field( - proto.ENUM, - number=18, - oneof="error_code", - enum=gage_ad_group_criterion_error.AdGroupCriterionErrorEnum.AdGroupCriterionError, - ) - ad_customizer_error = proto.Field( - proto.ENUM, - number=19, - oneof="error_code", - enum=gage_ad_customizer_error.AdCustomizerErrorEnum.AdCustomizerError, - ) - ad_group_ad_error = proto.Field( - proto.ENUM, - number=21, - oneof="error_code", - enum=gage_ad_group_ad_error.AdGroupAdErrorEnum.AdGroupAdError, - ) - ad_sharing_error = proto.Field( - proto.ENUM, - number=24, - oneof="error_code", - enum=gage_ad_sharing_error.AdSharingErrorEnum.AdSharingError, - ) - adx_error = proto.Field( - proto.ENUM, - number=25, - oneof="error_code", - enum=gage_adx_error.AdxErrorEnum.AdxError, - ) - asset_error = proto.Field( - proto.ENUM, - number=107, - oneof="error_code", - enum=gage_asset_error.AssetErrorEnum.AssetError, - ) - bidding_error = proto.Field( - proto.ENUM, - number=26, - oneof="error_code", - enum=gage_bidding_error.BiddingErrorEnum.BiddingError, - ) - campaign_criterion_error = proto.Field( - proto.ENUM, - number=29, - oneof="error_code", - enum=gage_campaign_criterion_error.CampaignCriterionErrorEnum.CampaignCriterionError, - ) - collection_size_error = proto.Field( - proto.ENUM, - number=31, - oneof="error_code", - enum=gage_collection_size_error.CollectionSizeErrorEnum.CollectionSizeError, - ) - country_code_error = proto.Field( - proto.ENUM, - number=109, - oneof="error_code", - enum=gage_country_code_error.CountryCodeErrorEnum.CountryCodeError, - ) - criterion_error = proto.Field( - proto.ENUM, - number=32, - oneof="error_code", - enum=gage_criterion_error.CriterionErrorEnum.CriterionError, - ) - customer_error = proto.Field( - proto.ENUM, - number=90, - oneof="error_code", - enum=gage_customer_error.CustomerErrorEnum.CustomerError, - ) - date_error = proto.Field( - proto.ENUM, - number=33, - oneof="error_code", - enum=gage_date_error.DateErrorEnum.DateError, - ) - date_range_error = proto.Field( - proto.ENUM, - number=34, - oneof="error_code", - enum=gage_date_range_error.DateRangeErrorEnum.DateRangeError, - ) - distinct_error = proto.Field( - proto.ENUM, - number=35, - oneof="error_code", - enum=gage_distinct_error.DistinctErrorEnum.DistinctError, - ) - feed_attribute_reference_error = proto.Field( - proto.ENUM, - number=36, - oneof="error_code", - enum=gage_feed_attribute_reference_error.FeedAttributeReferenceErrorEnum.FeedAttributeReferenceError, - ) - function_error = proto.Field( - proto.ENUM, - number=37, - oneof="error_code", - enum=gage_function_error.FunctionErrorEnum.FunctionError, - ) - function_parsing_error = proto.Field( - proto.ENUM, - number=38, - oneof="error_code", - enum=gage_function_parsing_error.FunctionParsingErrorEnum.FunctionParsingError, - ) - id_error = proto.Field( - proto.ENUM, - number=39, - oneof="error_code", - enum=gage_id_error.IdErrorEnum.IdError, - ) - image_error = proto.Field( - proto.ENUM, - number=40, - oneof="error_code", - enum=gage_image_error.ImageErrorEnum.ImageError, - ) - language_code_error = proto.Field( - proto.ENUM, - number=110, - oneof="error_code", - enum=gage_language_code_error.LanguageCodeErrorEnum.LanguageCodeError, - ) - media_bundle_error = proto.Field( - proto.ENUM, - number=42, - oneof="error_code", - enum=gage_media_bundle_error.MediaBundleErrorEnum.MediaBundleError, - ) - media_upload_error = proto.Field( - proto.ENUM, - number=116, - oneof="error_code", - enum=gage_media_upload_error.MediaUploadErrorEnum.MediaUploadError, - ) - media_file_error = proto.Field( - proto.ENUM, - number=86, - oneof="error_code", - enum=gage_media_file_error.MediaFileErrorEnum.MediaFileError, - ) - multiplier_error = proto.Field( - proto.ENUM, - number=44, - oneof="error_code", - enum=gage_multiplier_error.MultiplierErrorEnum.MultiplierError, - ) - new_resource_creation_error = proto.Field( - proto.ENUM, - number=45, - oneof="error_code", - enum=gage_new_resource_creation_error.NewResourceCreationErrorEnum.NewResourceCreationError, - ) - not_empty_error = proto.Field( - proto.ENUM, - number=46, - oneof="error_code", - enum=gage_not_empty_error.NotEmptyErrorEnum.NotEmptyError, - ) - null_error = proto.Field( - proto.ENUM, - number=47, - oneof="error_code", - enum=gage_null_error.NullErrorEnum.NullError, - ) - operator_error = proto.Field( - proto.ENUM, - number=48, - oneof="error_code", - enum=gage_operator_error.OperatorErrorEnum.OperatorError, - ) - range_error = proto.Field( - proto.ENUM, - number=49, - oneof="error_code", - enum=gage_range_error.RangeErrorEnum.RangeError, - ) - recommendation_error = proto.Field( - proto.ENUM, - number=58, - oneof="error_code", - enum=gage_recommendation_error.RecommendationErrorEnum.RecommendationError, - ) - region_code_error = proto.Field( - proto.ENUM, - number=51, - oneof="error_code", - enum=gage_region_code_error.RegionCodeErrorEnum.RegionCodeError, - ) - setting_error = proto.Field( - proto.ENUM, - number=52, - oneof="error_code", - enum=gage_setting_error.SettingErrorEnum.SettingError, - ) - string_format_error = proto.Field( - proto.ENUM, - number=53, - oneof="error_code", - enum=gage_string_format_error.StringFormatErrorEnum.StringFormatError, - ) - string_length_error = proto.Field( - proto.ENUM, - number=54, - oneof="error_code", - enum=gage_string_length_error.StringLengthErrorEnum.StringLengthError, - ) - operation_access_denied_error = proto.Field( - proto.ENUM, - number=55, - oneof="error_code", - enum=gage_operation_access_denied_error.OperationAccessDeniedErrorEnum.OperationAccessDeniedError, - ) - resource_access_denied_error = proto.Field( - proto.ENUM, - number=56, - oneof="error_code", - enum=gage_resource_access_denied_error.ResourceAccessDeniedErrorEnum.ResourceAccessDeniedError, - ) - resource_count_limit_exceeded_error = proto.Field( - proto.ENUM, - number=57, - oneof="error_code", - enum=gage_resource_count_limit_exceeded_error.ResourceCountLimitExceededErrorEnum.ResourceCountLimitExceededError, - ) - youtube_video_registration_error = proto.Field( - proto.ENUM, - number=117, - oneof="error_code", - enum=gage_youtube_video_registration_error.YoutubeVideoRegistrationErrorEnum.YoutubeVideoRegistrationError, - ) - ad_group_bid_modifier_error = proto.Field( - proto.ENUM, - number=59, - oneof="error_code", - enum=gage_ad_group_bid_modifier_error.AdGroupBidModifierErrorEnum.AdGroupBidModifierError, - ) - context_error = proto.Field( - proto.ENUM, - number=60, - oneof="error_code", - enum=gage_context_error.ContextErrorEnum.ContextError, - ) - field_error = proto.Field( - proto.ENUM, - number=61, - oneof="error_code", - enum=gage_field_error.FieldErrorEnum.FieldError, - ) - shared_set_error = proto.Field( - proto.ENUM, - number=62, - oneof="error_code", - enum=gage_shared_set_error.SharedSetErrorEnum.SharedSetError, - ) - shared_criterion_error = proto.Field( - proto.ENUM, - number=63, - oneof="error_code", - enum=gage_shared_criterion_error.SharedCriterionErrorEnum.SharedCriterionError, - ) - campaign_shared_set_error = proto.Field( - proto.ENUM, - number=64, - oneof="error_code", - enum=gage_campaign_shared_set_error.CampaignSharedSetErrorEnum.CampaignSharedSetError, - ) - conversion_action_error = proto.Field( - proto.ENUM, - number=65, - oneof="error_code", - enum=gage_conversion_action_error.ConversionActionErrorEnum.ConversionActionError, - ) - conversion_adjustment_upload_error = proto.Field( - proto.ENUM, - number=115, - oneof="error_code", - enum=gage_conversion_adjustment_upload_error.ConversionAdjustmentUploadErrorEnum.ConversionAdjustmentUploadError, - ) - conversion_upload_error = proto.Field( - proto.ENUM, - number=111, - oneof="error_code", - enum=gage_conversion_upload_error.ConversionUploadErrorEnum.ConversionUploadError, - ) - header_error = proto.Field( - proto.ENUM, - number=66, - oneof="error_code", - enum=gage_header_error.HeaderErrorEnum.HeaderError, - ) - database_error = proto.Field( - proto.ENUM, - number=67, - oneof="error_code", - enum=gage_database_error.DatabaseErrorEnum.DatabaseError, - ) - policy_finding_error = proto.Field( - proto.ENUM, - number=68, - oneof="error_code", - enum=gage_policy_finding_error.PolicyFindingErrorEnum.PolicyFindingError, - ) - enum_error = proto.Field( - proto.ENUM, - number=70, - oneof="error_code", - enum=gage_enum_error.EnumErrorEnum.EnumError, - ) - keyword_plan_error = proto.Field( - proto.ENUM, - number=71, - oneof="error_code", - enum=gage_keyword_plan_error.KeywordPlanErrorEnum.KeywordPlanError, - ) - keyword_plan_campaign_error = proto.Field( - proto.ENUM, - number=72, - oneof="error_code", - enum=gage_keyword_plan_campaign_error.KeywordPlanCampaignErrorEnum.KeywordPlanCampaignError, - ) - keyword_plan_campaign_keyword_error = proto.Field( - proto.ENUM, - number=132, - oneof="error_code", - enum=gage_keyword_plan_campaign_keyword_error.KeywordPlanCampaignKeywordErrorEnum.KeywordPlanCampaignKeywordError, - ) - keyword_plan_ad_group_error = proto.Field( - proto.ENUM, - number=74, - oneof="error_code", - enum=gage_keyword_plan_ad_group_error.KeywordPlanAdGroupErrorEnum.KeywordPlanAdGroupError, - ) - keyword_plan_ad_group_keyword_error = proto.Field( - proto.ENUM, - number=133, - oneof="error_code", - enum=gage_keyword_plan_ad_group_keyword_error.KeywordPlanAdGroupKeywordErrorEnum.KeywordPlanAdGroupKeywordError, - ) - keyword_plan_idea_error = proto.Field( - proto.ENUM, - number=76, - oneof="error_code", - enum=gage_keyword_plan_idea_error.KeywordPlanIdeaErrorEnum.KeywordPlanIdeaError, - ) - account_budget_proposal_error = proto.Field( - proto.ENUM, - number=77, - oneof="error_code", - enum=gage_account_budget_proposal_error.AccountBudgetProposalErrorEnum.AccountBudgetProposalError, - ) - user_list_error = proto.Field( - proto.ENUM, - number=78, - oneof="error_code", - enum=gage_user_list_error.UserListErrorEnum.UserListError, - ) - change_event_error = proto.Field( - proto.ENUM, - number=136, - oneof="error_code", - enum=gage_change_event_error.ChangeEventErrorEnum.ChangeEventError, - ) - change_status_error = proto.Field( - proto.ENUM, - number=79, - oneof="error_code", - enum=gage_change_status_error.ChangeStatusErrorEnum.ChangeStatusError, - ) - feed_error = proto.Field( - proto.ENUM, - number=80, - oneof="error_code", - enum=gage_feed_error.FeedErrorEnum.FeedError, - ) - geo_target_constant_suggestion_error = proto.Field( - proto.ENUM, - number=81, - oneof="error_code", - enum=gage_geo_target_constant_suggestion_error.GeoTargetConstantSuggestionErrorEnum.GeoTargetConstantSuggestionError, - ) - campaign_draft_error = proto.Field( - proto.ENUM, - number=82, - oneof="error_code", - enum=gage_campaign_draft_error.CampaignDraftErrorEnum.CampaignDraftError, - ) - feed_item_error = proto.Field( - proto.ENUM, - number=83, - oneof="error_code", - enum=gage_feed_item_error.FeedItemErrorEnum.FeedItemError, - ) - label_error = proto.Field( - proto.ENUM, - number=84, - oneof="error_code", - enum=gage_label_error.LabelErrorEnum.LabelError, - ) - billing_setup_error = proto.Field( - proto.ENUM, - number=87, - oneof="error_code", - enum=gage_billing_setup_error.BillingSetupErrorEnum.BillingSetupError, - ) - customer_client_link_error = proto.Field( - proto.ENUM, - number=88, - oneof="error_code", - enum=gage_customer_client_link_error.CustomerClientLinkErrorEnum.CustomerClientLinkError, - ) - customer_manager_link_error = proto.Field( - proto.ENUM, - number=91, - oneof="error_code", - enum=gage_customer_manager_link_error.CustomerManagerLinkErrorEnum.CustomerManagerLinkError, - ) - feed_mapping_error = proto.Field( - proto.ENUM, - number=92, - oneof="error_code", - enum=gage_feed_mapping_error.FeedMappingErrorEnum.FeedMappingError, - ) - customer_feed_error = proto.Field( - proto.ENUM, - number=93, - oneof="error_code", - enum=gage_customer_feed_error.CustomerFeedErrorEnum.CustomerFeedError, - ) - ad_group_feed_error = proto.Field( - proto.ENUM, - number=94, - oneof="error_code", - enum=gage_ad_group_feed_error.AdGroupFeedErrorEnum.AdGroupFeedError, - ) - campaign_feed_error = proto.Field( - proto.ENUM, - number=96, - oneof="error_code", - enum=gage_campaign_feed_error.CampaignFeedErrorEnum.CampaignFeedError, - ) - custom_interest_error = proto.Field( - proto.ENUM, - number=97, - oneof="error_code", - enum=gage_custom_interest_error.CustomInterestErrorEnum.CustomInterestError, - ) - campaign_experiment_error = proto.Field( - proto.ENUM, - number=98, - oneof="error_code", - enum=gage_campaign_experiment_error.CampaignExperimentErrorEnum.CampaignExperimentError, - ) - extension_feed_item_error = proto.Field( - proto.ENUM, - number=100, - oneof="error_code", - enum=gage_extension_feed_item_error.ExtensionFeedItemErrorEnum.ExtensionFeedItemError, - ) - ad_parameter_error = proto.Field( - proto.ENUM, - number=101, - oneof="error_code", - enum=gage_ad_parameter_error.AdParameterErrorEnum.AdParameterError, - ) - feed_item_validation_error = proto.Field( - proto.ENUM, - number=102, - oneof="error_code", - enum=gage_feed_item_validation_error.FeedItemValidationErrorEnum.FeedItemValidationError, - ) - extension_setting_error = proto.Field( - proto.ENUM, - number=103, - oneof="error_code", - enum=gage_extension_setting_error.ExtensionSettingErrorEnum.ExtensionSettingError, - ) - feed_item_set_error = proto.Field( - proto.ENUM, - number=140, - oneof="error_code", - enum=gage_feed_item_set_error.FeedItemSetErrorEnum.FeedItemSetError, - ) - feed_item_set_link_error = proto.Field( - proto.ENUM, - number=141, - oneof="error_code", - enum=gage_feed_item_set_link_error.FeedItemSetLinkErrorEnum.FeedItemSetLinkError, - ) - feed_item_target_error = proto.Field( - proto.ENUM, - number=104, - oneof="error_code", - enum=gage_feed_item_target_error.FeedItemTargetErrorEnum.FeedItemTargetError, - ) - policy_violation_error = proto.Field( - proto.ENUM, - number=105, - oneof="error_code", - enum=gage_policy_violation_error.PolicyViolationErrorEnum.PolicyViolationError, - ) - partial_failure_error = proto.Field( - proto.ENUM, - number=112, - oneof="error_code", - enum=gage_partial_failure_error.PartialFailureErrorEnum.PartialFailureError, - ) - policy_validation_parameter_error = proto.Field( - proto.ENUM, - number=114, - oneof="error_code", - enum=gage_policy_validation_parameter_error.PolicyValidationParameterErrorEnum.PolicyValidationParameterError, - ) - size_limit_error = proto.Field( - proto.ENUM, - number=118, - oneof="error_code", - enum=gage_size_limit_error.SizeLimitErrorEnum.SizeLimitError, - ) - offline_user_data_job_error = proto.Field( - proto.ENUM, - number=119, - oneof="error_code", - enum=gage_offline_user_data_job_error.OfflineUserDataJobErrorEnum.OfflineUserDataJobError, - ) - not_allowlisted_error = proto.Field( - proto.ENUM, - number=137, - oneof="error_code", - enum=gage_not_allowlisted_error.NotAllowlistedErrorEnum.NotAllowlistedError, - ) - manager_link_error = proto.Field( - proto.ENUM, - number=121, - oneof="error_code", - enum=gage_manager_link_error.ManagerLinkErrorEnum.ManagerLinkError, - ) - currency_code_error = proto.Field( - proto.ENUM, - number=122, - oneof="error_code", - enum=gage_currency_code_error.CurrencyCodeErrorEnum.CurrencyCodeError, - ) - access_invitation_error = proto.Field( - proto.ENUM, - number=124, - oneof="error_code", - enum=gage_access_invitation_error.AccessInvitationErrorEnum.AccessInvitationError, - ) - reach_plan_error = proto.Field( - proto.ENUM, - number=125, - oneof="error_code", - enum=gage_reach_plan_error.ReachPlanErrorEnum.ReachPlanError, - ) - invoice_error = proto.Field( - proto.ENUM, - number=126, - oneof="error_code", - enum=gage_invoice_error.InvoiceErrorEnum.InvoiceError, - ) - payments_account_error = proto.Field( - proto.ENUM, - number=127, - oneof="error_code", - enum=gage_payments_account_error.PaymentsAccountErrorEnum.PaymentsAccountError, - ) - time_zone_error = proto.Field( - proto.ENUM, - number=128, - oneof="error_code", - enum=gage_time_zone_error.TimeZoneErrorEnum.TimeZoneError, - ) - asset_link_error = proto.Field( - proto.ENUM, - number=129, - oneof="error_code", - enum=gage_asset_link_error.AssetLinkErrorEnum.AssetLinkError, - ) - user_data_error = proto.Field( - proto.ENUM, - number=130, - oneof="error_code", - enum=gage_user_data_error.UserDataErrorEnum.UserDataError, - ) - batch_job_error = proto.Field( - proto.ENUM, - number=131, - oneof="error_code", - enum=gage_batch_job_error.BatchJobErrorEnum.BatchJobError, - ) - account_link_error = proto.Field( - proto.ENUM, - number=134, - oneof="error_code", - enum=gage_account_link_error.AccountLinkErrorEnum.AccountLinkError, - ) - third_party_app_analytics_link_error = proto.Field( - proto.ENUM, - number=135, - oneof="error_code", - enum=gage_third_party_app_analytics_link_error.ThirdPartyAppAnalyticsLinkErrorEnum.ThirdPartyAppAnalyticsLinkError, - ) - customer_user_access_error = proto.Field( - proto.ENUM, - number=138, - oneof="error_code", - enum=gage_customer_user_access_error.CustomerUserAccessErrorEnum.CustomerUserAccessError, - ) - custom_audience_error = proto.Field( - proto.ENUM, - number=139, - oneof="error_code", - enum=gage_custom_audience_error.CustomAudienceErrorEnum.CustomAudienceError, - ) - - -class ErrorLocation(proto.Message): - r"""Describes the part of the request proto that caused the - error. - - Attributes: - field_path_elements (Sequence[google.ads.googleads.v6.errors.types.ErrorLocation.FieldPathElement]): - A field path that indicates which field was - invalid in the request. - """ - - class FieldPathElement(proto.Message): - r"""A part of a field path. - - Attributes: - field_name (str): - The name of a field or a oneof - index (int): - If field_name is a repeated field, this is the element that - failed - """ - - field_name = proto.Field(proto.STRING, number=1) - index = proto.Field(proto.INT32, number=3, optional=True) - - field_path_elements = proto.RepeatedField( - proto.MESSAGE, number=2, message=FieldPathElement, - ) - - -class ErrorDetails(proto.Message): - r"""Additional error details. - - Attributes: - unpublished_error_code (str): - The error code that should have been - returned, but wasn't. This is used when the - error code is not published in the client - specified version. - policy_violation_details (google.ads.googleads.v6.errors.types.PolicyViolationDetails): - Describes an ad policy violation. - policy_finding_details (google.ads.googleads.v6.errors.types.PolicyFindingDetails): - Describes policy violation findings. - quota_error_details (google.ads.googleads.v6.errors.types.QuotaErrorDetails): - Details on the quota error, including the - scope (account or developer), the rate bucket - name and the retry delay. - """ - - unpublished_error_code = proto.Field(proto.STRING, number=1) - policy_violation_details = proto.Field( - proto.MESSAGE, number=2, message="PolicyViolationDetails", - ) - policy_finding_details = proto.Field( - proto.MESSAGE, number=3, message="PolicyFindingDetails", - ) - quota_error_details = proto.Field( - proto.MESSAGE, number=4, message="QuotaErrorDetails", - ) - - -class PolicyViolationDetails(proto.Message): - r"""Error returned as part of a mutate response. - This error indicates single policy violation by some text in one - of the fields. - - Attributes: - external_policy_description (str): - Human readable description of policy - violation. - key (google.ads.googleads.v6.common.types.PolicyViolationKey): - Unique identifier for this violation. - If policy is exemptible, this key may be used to - request exemption. - external_policy_name (str): - Human readable name of the policy. - is_exemptible (bool): - Whether user can file an exemption request - for this violation. - """ - - external_policy_description = proto.Field(proto.STRING, number=2) - key = proto.Field( - proto.MESSAGE, number=4, message=policy.PolicyViolationKey, - ) - external_policy_name = proto.Field(proto.STRING, number=5) - is_exemptible = proto.Field(proto.BOOL, number=6) - - -class PolicyFindingDetails(proto.Message): - r"""Error returned as part of a mutate response. - This error indicates one or more policy findings in the fields - of a resource. - - Attributes: - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - The list of policy topics for the resource. Contains the - PROHIBITED or FULLY_LIMITED policy topic entries that - prevented the resource from being saved (among any other - entries the resource may also have). - """ - - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=1, message=policy.PolicyTopicEntry, - ) - - -class QuotaErrorDetails(proto.Message): - r"""Additional quota error details when there is QuotaError. - - Attributes: - rate_scope (google.ads.googleads.v6.errors.types.QuotaErrorDetails.QuotaRateScope): - The rate scope of the quota limit. - rate_name (str): - The high level description of the quota - bucket. Examples are "Get requests for standard - access" or "Requests per account". - retry_delay (google.protobuf.duration_pb2.Duration): - Backoff period that customers should wait - before sending next request. - """ - - class QuotaRateScope(proto.Enum): - r"""Enum of possible scopes that quota buckets belong to.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ACCOUNT = 2 - DEVELOPER = 3 - - rate_scope = proto.Field(proto.ENUM, number=1, enum=QuotaRateScope,) - rate_name = proto.Field(proto.STRING, number=2) - retry_delay = proto.Field( - proto.MESSAGE, number=3, message=duration.Duration, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/extension_feed_item_error.py b/google/ads/googleads/v6/errors/types/extension_feed_item_error.py deleted file mode 100644 index 42355c5a9..000000000 --- a/google/ads/googleads/v6/errors/types/extension_feed_item_error.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ExtensionFeedItemErrorEnum",}, -) - - -class ExtensionFeedItemErrorEnum(proto.Message): - r"""Container for enum describing possible extension feed item - error. - """ - - class ExtensionFeedItemError(proto.Enum): - r"""Enum describing possible extension feed item errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - VALUE_OUT_OF_RANGE = 2 - URL_LIST_TOO_LONG = 3 - CANNOT_HAVE_RESTRICTION_ON_EMPTY_GEO_TARGETING = 4 - CANNOT_SET_WITH_FINAL_URLS = 5 - CANNOT_SET_WITHOUT_FINAL_URLS = 6 - INVALID_PHONE_NUMBER = 7 - PHONE_NUMBER_NOT_SUPPORTED_FOR_COUNTRY = 8 - CARRIER_SPECIFIC_SHORT_NUMBER_NOT_ALLOWED = 9 - PREMIUM_RATE_NUMBER_NOT_ALLOWED = 10 - DISALLOWED_NUMBER_TYPE = 11 - INVALID_DOMESTIC_PHONE_NUMBER_FORMAT = 12 - VANITY_PHONE_NUMBER_NOT_ALLOWED = 13 - INVALID_CALL_CONVERSION_ACTION = 14 - CUSTOMER_NOT_ON_ALLOWLIST_FOR_CALLTRACKING = 47 - CALLTRACKING_NOT_SUPPORTED_FOR_COUNTRY = 16 - CUSTOMER_CONSENT_FOR_CALL_RECORDING_REQUIRED = 17 - INVALID_APP_ID = 18 - QUOTES_IN_REVIEW_EXTENSION_SNIPPET = 19 - HYPHENS_IN_REVIEW_EXTENSION_SNIPPET = 20 - REVIEW_EXTENSION_SOURCE_INELIGIBLE = 21 - SOURCE_NAME_IN_REVIEW_EXTENSION_TEXT = 22 - INCONSISTENT_CURRENCY_CODES = 23 - PRICE_EXTENSION_HAS_DUPLICATED_HEADERS = 24 - PRICE_ITEM_HAS_DUPLICATED_HEADER_AND_DESCRIPTION = 25 - PRICE_EXTENSION_HAS_TOO_FEW_ITEMS = 26 - PRICE_EXTENSION_HAS_TOO_MANY_ITEMS = 27 - UNSUPPORTED_VALUE = 28 - UNSUPPORTED_VALUE_IN_SELECTED_LANGUAGE = 29 - INVALID_DEVICE_PREFERENCE = 30 - INVALID_SCHEDULE_END = 31 - DATE_TIME_MUST_BE_IN_ACCOUNT_TIME_ZONE = 32 - INVALID_SNIPPETS_HEADER = 33 - CANNOT_OPERATE_ON_REMOVED_FEED_ITEM = 34 - PHONE_NUMBER_NOT_SUPPORTED_WITH_CALLTRACKING_FOR_COUNTRY = 35 - CONFLICTING_CALL_CONVERSION_SETTINGS = 36 - EXTENSION_TYPE_MISMATCH = 37 - EXTENSION_SUBTYPE_REQUIRED = 38 - EXTENSION_TYPE_UNSUPPORTED = 39 - CANNOT_OPERATE_ON_FEED_WITH_MULTIPLE_MAPPINGS = 40 - CANNOT_OPERATE_ON_FEED_WITH_KEY_ATTRIBUTES = 41 - INVALID_PRICE_FORMAT = 42 - PROMOTION_INVALID_TIME = 43 - TOO_MANY_DECIMAL_PLACES_SPECIFIED = 44 - CONCRETE_EXTENSION_TYPE_REQUIRED = 45 - SCHEDULE_END_NOT_AFTER_START = 46 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/extension_setting_error.py b/google/ads/googleads/v6/errors/types/extension_setting_error.py deleted file mode 100644 index 154f31c5c..000000000 --- a/google/ads/googleads/v6/errors/types/extension_setting_error.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ExtensionSettingErrorEnum",}, -) - - -class ExtensionSettingErrorEnum(proto.Message): - r"""Container for enum describing validation errors of extension - settings. - """ - - class ExtensionSettingError(proto.Enum): - r"""Enum describing possible extension setting errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EXTENSIONS_REQUIRED = 2 - FEED_TYPE_EXTENSION_TYPE_MISMATCH = 3 - INVALID_FEED_TYPE = 4 - INVALID_FEED_TYPE_FOR_CUSTOMER_EXTENSION_SETTING = 5 - CANNOT_CHANGE_FEED_ITEM_ON_CREATE = 6 - CANNOT_UPDATE_NEWLY_CREATED_EXTENSION = 7 - NO_EXISTING_AD_GROUP_EXTENSION_SETTING_FOR_TYPE = 8 - NO_EXISTING_CAMPAIGN_EXTENSION_SETTING_FOR_TYPE = 9 - NO_EXISTING_CUSTOMER_EXTENSION_SETTING_FOR_TYPE = 10 - AD_GROUP_EXTENSION_SETTING_ALREADY_EXISTS = 11 - CAMPAIGN_EXTENSION_SETTING_ALREADY_EXISTS = 12 - CUSTOMER_EXTENSION_SETTING_ALREADY_EXISTS = 13 - AD_GROUP_FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 14 - CAMPAIGN_FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 15 - CUSTOMER_FEED_ALREADY_EXISTS_FOR_PLACEHOLDER_TYPE = 16 - VALUE_OUT_OF_RANGE = 17 - CANNOT_SET_FIELD_WITH_FINAL_URLS = 18 - FINAL_URLS_NOT_SET = 19 - INVALID_PHONE_NUMBER = 20 - PHONE_NUMBER_NOT_SUPPORTED_FOR_COUNTRY = 21 - CARRIER_SPECIFIC_SHORT_NUMBER_NOT_ALLOWED = 22 - PREMIUM_RATE_NUMBER_NOT_ALLOWED = 23 - DISALLOWED_NUMBER_TYPE = 24 - INVALID_DOMESTIC_PHONE_NUMBER_FORMAT = 25 - VANITY_PHONE_NUMBER_NOT_ALLOWED = 26 - INVALID_COUNTRY_CODE = 27 - INVALID_CALL_CONVERSION_TYPE_ID = 28 - CUSTOMER_NOT_IN_ALLOWLIST_FOR_CALLTRACKING = 69 - CALLTRACKING_NOT_SUPPORTED_FOR_COUNTRY = 30 - INVALID_APP_ID = 31 - QUOTES_IN_REVIEW_EXTENSION_SNIPPET = 32 - HYPHENS_IN_REVIEW_EXTENSION_SNIPPET = 33 - REVIEW_EXTENSION_SOURCE_NOT_ELIGIBLE = 34 - SOURCE_NAME_IN_REVIEW_EXTENSION_TEXT = 35 - MISSING_FIELD = 36 - INCONSISTENT_CURRENCY_CODES = 37 - PRICE_EXTENSION_HAS_DUPLICATED_HEADERS = 38 - PRICE_ITEM_HAS_DUPLICATED_HEADER_AND_DESCRIPTION = 39 - PRICE_EXTENSION_HAS_TOO_FEW_ITEMS = 40 - PRICE_EXTENSION_HAS_TOO_MANY_ITEMS = 41 - UNSUPPORTED_VALUE = 42 - INVALID_DEVICE_PREFERENCE = 43 - INVALID_SCHEDULE_END = 45 - DATE_TIME_MUST_BE_IN_ACCOUNT_TIME_ZONE = 47 - OVERLAPPING_SCHEDULES_NOT_ALLOWED = 48 - SCHEDULE_END_NOT_AFTER_START = 49 - TOO_MANY_SCHEDULES_PER_DAY = 50 - DUPLICATE_EXTENSION_FEED_ITEM_EDIT = 51 - INVALID_SNIPPETS_HEADER = 52 - PHONE_NUMBER_NOT_SUPPORTED_WITH_CALLTRACKING_FOR_COUNTRY = 53 - CAMPAIGN_TARGETING_MISMATCH = 54 - CANNOT_OPERATE_ON_REMOVED_FEED = 55 - EXTENSION_TYPE_REQUIRED = 56 - INCOMPATIBLE_UNDERLYING_MATCHING_FUNCTION = 57 - START_DATE_AFTER_END_DATE = 58 - INVALID_PRICE_FORMAT = 59 - PROMOTION_INVALID_TIME = 60 - PROMOTION_CANNOT_SET_PERCENT_DISCOUNT_AND_MONEY_DISCOUNT = 61 - PROMOTION_CANNOT_SET_PROMOTION_CODE_AND_ORDERS_OVER_AMOUNT = 62 - TOO_MANY_DECIMAL_PLACES_SPECIFIED = 63 - INVALID_LANGUAGE_CODE = 64 - UNSUPPORTED_LANGUAGE = 65 - CUSTOMER_CONSENT_FOR_CALL_RECORDING_REQUIRED = 66 - EXTENSION_SETTING_UPDATE_IS_A_NOOP = 67 - DISALLOWED_TEXT = 68 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_attribute_reference_error.py b/google/ads/googleads/v6/errors/types/feed_attribute_reference_error.py deleted file mode 100644 index 56e5082b3..000000000 --- a/google/ads/googleads/v6/errors/types/feed_attribute_reference_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedAttributeReferenceErrorEnum",}, -) - - -class FeedAttributeReferenceErrorEnum(proto.Message): - r"""Container for enum describing possible feed attribute - reference errors. - """ - - class FeedAttributeReferenceError(proto.Enum): - r"""Enum describing possible feed attribute reference errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_REFERENCE_REMOVED_FEED = 2 - INVALID_FEED_NAME = 3 - INVALID_FEED_ATTRIBUTE_NAME = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_error.py b/google/ads/googleads/v6/errors/types/feed_error.py deleted file mode 100644 index cc8d99ba9..000000000 --- a/google/ads/googleads/v6/errors/types/feed_error.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedErrorEnum",}, -) - - -class FeedErrorEnum(proto.Message): - r"""Container for enum describing possible feed errors.""" - - class FeedError(proto.Enum): - r"""Enum describing possible feed errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ATTRIBUTE_NAMES_NOT_UNIQUE = 2 - ATTRIBUTES_DO_NOT_MATCH_EXISTING_ATTRIBUTES = 3 - CANNOT_SPECIFY_USER_ORIGIN_FOR_SYSTEM_FEED = 4 - CANNOT_SPECIFY_GOOGLE_ORIGIN_FOR_NON_SYSTEM_FEED = 5 - CANNOT_SPECIFY_FEED_ATTRIBUTES_FOR_SYSTEM_FEED = 6 - CANNOT_UPDATE_FEED_ATTRIBUTES_WITH_ORIGIN_GOOGLE = 7 - FEED_REMOVED = 8 - INVALID_ORIGIN_VALUE = 9 - FEED_ORIGIN_IS_NOT_USER = 10 - INVALID_AUTH_TOKEN_FOR_EMAIL = 11 - INVALID_EMAIL = 12 - DUPLICATE_FEED_NAME = 13 - INVALID_FEED_NAME = 14 - MISSING_OAUTH_INFO = 15 - NEW_ATTRIBUTE_CANNOT_BE_PART_OF_UNIQUE_KEY = 16 - TOO_MANY_ATTRIBUTES = 17 - INVALID_BUSINESS_ACCOUNT = 18 - BUSINESS_ACCOUNT_CANNOT_ACCESS_LOCATION_ACCOUNT = 19 - INVALID_AFFILIATE_CHAIN_ID = 20 - DUPLICATE_SYSTEM_FEED = 21 - GMB_ACCESS_ERROR = 22 - CANNOT_HAVE_LOCATION_AND_AFFILIATE_LOCATION_FEEDS = 23 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_item_error.py b/google/ads/googleads/v6/errors/types/feed_item_error.py deleted file mode 100644 index e853c6254..000000000 --- a/google/ads/googleads/v6/errors/types/feed_item_error.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedItemErrorEnum",}, -) - - -class FeedItemErrorEnum(proto.Message): - r"""Container for enum describing possible feed item errors.""" - - class FeedItemError(proto.Enum): - r"""Enum describing possible feed item errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_CONVERT_ATTRIBUTE_VALUE_FROM_STRING = 2 - CANNOT_OPERATE_ON_REMOVED_FEED_ITEM = 3 - DATE_TIME_MUST_BE_IN_ACCOUNT_TIME_ZONE = 4 - KEY_ATTRIBUTES_NOT_FOUND = 5 - INVALID_URL = 6 - MISSING_KEY_ATTRIBUTES = 7 - KEY_ATTRIBUTES_NOT_UNIQUE = 8 - CANNOT_MODIFY_KEY_ATTRIBUTE_VALUE = 9 - SIZE_TOO_LARGE_FOR_MULTI_VALUE_ATTRIBUTE = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_item_set_error.py b/google/ads/googleads/v6/errors/types/feed_item_set_error.py deleted file mode 100644 index 7b8f2eed6..000000000 --- a/google/ads/googleads/v6/errors/types/feed_item_set_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSetErrorEnum",}, -) - - -class FeedItemSetErrorEnum(proto.Message): - r"""Container for enum describing possible feed item set errors.""" - - class FeedItemSetError(proto.Enum): - r"""Enum describing possible feed item set errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ITEM_SET_REMOVED = 2 - CANNOT_CLEAR_DYNAMIC_FILTER = 3 - CANNOT_CREATE_DYNAMIC_FILTER = 4 - INVALID_FEED_TYPE = 5 - DUPLICATE_NAME = 6 - WRONG_DYNAMIC_FILTER_FOR_FEED_TYPE = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_item_set_link_error.py b/google/ads/googleads/v6/errors/types/feed_item_set_link_error.py deleted file mode 100644 index 20b69dcae..000000000 --- a/google/ads/googleads/v6/errors/types/feed_item_set_link_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSetLinkErrorEnum",}, -) - - -class FeedItemSetLinkErrorEnum(proto.Message): - r"""Container for enum describing possible feed item set link - errors. - """ - - class FeedItemSetLinkError(proto.Enum): - r"""Enum describing possible feed item set link errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FEED_ID_MISMATCH = 2 - NO_MUTATE_ALLOWED_FOR_DYNAMIC_SET = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_item_target_error.py b/google/ads/googleads/v6/errors/types/feed_item_target_error.py deleted file mode 100644 index 37fd3a671..000000000 --- a/google/ads/googleads/v6/errors/types/feed_item_target_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedItemTargetErrorEnum",}, -) - - -class FeedItemTargetErrorEnum(proto.Message): - r"""Container for enum describing possible feed item target - errors. - """ - - class FeedItemTargetError(proto.Enum): - r"""Enum describing possible feed item target errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MUST_SET_TARGET_ONEOF_ON_CREATE = 2 - FEED_ITEM_TARGET_ALREADY_EXISTS = 3 - FEED_ITEM_SCHEDULES_CANNOT_OVERLAP = 4 - TARGET_LIMIT_EXCEEDED_FOR_GIVEN_TYPE = 5 - TOO_MANY_SCHEDULES_PER_DAY = 6 - CANNOT_HAVE_ENABLED_CAMPAIGN_AND_ENABLED_AD_GROUP_TARGETS = 7 - DUPLICATE_AD_SCHEDULE = 8 - DUPLICATE_KEYWORD = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_item_validation_error.py b/google/ads/googleads/v6/errors/types/feed_item_validation_error.py deleted file mode 100644 index 475422694..000000000 --- a/google/ads/googleads/v6/errors/types/feed_item_validation_error.py +++ /dev/null @@ -1,144 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedItemValidationErrorEnum",}, -) - - -class FeedItemValidationErrorEnum(proto.Message): - r"""Container for enum describing possible validation errors of a - feed item. - """ - - class FeedItemValidationError(proto.Enum): - r"""The possible validation errors of a feed item.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - STRING_TOO_SHORT = 2 - STRING_TOO_LONG = 3 - VALUE_NOT_SPECIFIED = 4 - INVALID_DOMESTIC_PHONE_NUMBER_FORMAT = 5 - INVALID_PHONE_NUMBER = 6 - PHONE_NUMBER_NOT_SUPPORTED_FOR_COUNTRY = 7 - PREMIUM_RATE_NUMBER_NOT_ALLOWED = 8 - DISALLOWED_NUMBER_TYPE = 9 - VALUE_OUT_OF_RANGE = 10 - CALLTRACKING_NOT_SUPPORTED_FOR_COUNTRY = 11 - CUSTOMER_NOT_IN_ALLOWLIST_FOR_CALLTRACKING = 99 - INVALID_COUNTRY_CODE = 13 - INVALID_APP_ID = 14 - MISSING_ATTRIBUTES_FOR_FIELDS = 15 - INVALID_TYPE_ID = 16 - INVALID_EMAIL_ADDRESS = 17 - INVALID_HTTPS_URL = 18 - MISSING_DELIVERY_ADDRESS = 19 - START_DATE_AFTER_END_DATE = 20 - MISSING_FEED_ITEM_START_TIME = 21 - MISSING_FEED_ITEM_END_TIME = 22 - MISSING_FEED_ITEM_ID = 23 - VANITY_PHONE_NUMBER_NOT_ALLOWED = 24 - INVALID_REVIEW_EXTENSION_SNIPPET = 25 - INVALID_NUMBER_FORMAT = 26 - INVALID_DATE_FORMAT = 27 - INVALID_PRICE_FORMAT = 28 - UNKNOWN_PLACEHOLDER_FIELD = 29 - MISSING_ENHANCED_SITELINK_DESCRIPTION_LINE = 30 - REVIEW_EXTENSION_SOURCE_INELIGIBLE = 31 - HYPHENS_IN_REVIEW_EXTENSION_SNIPPET = 32 - DOUBLE_QUOTES_IN_REVIEW_EXTENSION_SNIPPET = 33 - QUOTES_IN_REVIEW_EXTENSION_SNIPPET = 34 - INVALID_FORM_ENCODED_PARAMS = 35 - INVALID_URL_PARAMETER_NAME = 36 - NO_GEOCODING_RESULT = 37 - SOURCE_NAME_IN_REVIEW_EXTENSION_TEXT = 38 - CARRIER_SPECIFIC_SHORT_NUMBER_NOT_ALLOWED = 39 - INVALID_PLACEHOLDER_FIELD_ID = 40 - INVALID_URL_TAG = 41 - LIST_TOO_LONG = 42 - INVALID_ATTRIBUTES_COMBINATION = 43 - DUPLICATE_VALUES = 44 - INVALID_CALL_CONVERSION_ACTION_ID = 45 - CANNOT_SET_WITHOUT_FINAL_URLS = 46 - APP_ID_DOESNT_EXIST_IN_APP_STORE = 47 - INVALID_FINAL_URL = 48 - INVALID_TRACKING_URL = 49 - INVALID_FINAL_URL_FOR_APP_DOWNLOAD_URL = 50 - LIST_TOO_SHORT = 51 - INVALID_USER_ACTION = 52 - INVALID_TYPE_NAME = 53 - INVALID_EVENT_CHANGE_STATUS = 54 - INVALID_SNIPPETS_HEADER = 55 - INVALID_ANDROID_APP_LINK = 56 - NUMBER_TYPE_WITH_CALLTRACKING_NOT_SUPPORTED_FOR_COUNTRY = 57 - RESERVED_KEYWORD_OTHER = 58 - DUPLICATE_OPTION_LABELS = 59 - DUPLICATE_OPTION_PREFILLS = 60 - UNEQUAL_LIST_LENGTHS = 61 - INCONSISTENT_CURRENCY_CODES = 62 - PRICE_EXTENSION_HAS_DUPLICATED_HEADERS = 63 - ITEM_HAS_DUPLICATED_HEADER_AND_DESCRIPTION = 64 - PRICE_EXTENSION_HAS_TOO_FEW_ITEMS = 65 - UNSUPPORTED_VALUE = 66 - INVALID_FINAL_MOBILE_URL = 67 - INVALID_KEYWORDLESS_AD_RULE_LABEL = 68 - VALUE_TRACK_PARAMETER_NOT_SUPPORTED = 69 - UNSUPPORTED_VALUE_IN_SELECTED_LANGUAGE = 70 - INVALID_IOS_APP_LINK = 71 - MISSING_IOS_APP_LINK_OR_IOS_APP_STORE_ID = 72 - PROMOTION_INVALID_TIME = 73 - PROMOTION_CANNOT_SET_PERCENT_OFF_AND_MONEY_AMOUNT_OFF = 74 - PROMOTION_CANNOT_SET_PROMOTION_CODE_AND_ORDERS_OVER_AMOUNT = 75 - TOO_MANY_DECIMAL_PLACES_SPECIFIED = 76 - AD_CUSTOMIZERS_NOT_ALLOWED = 77 - INVALID_LANGUAGE_CODE = 78 - UNSUPPORTED_LANGUAGE = 79 - IF_FUNCTION_NOT_ALLOWED = 80 - INVALID_FINAL_URL_SUFFIX = 81 - INVALID_TAG_IN_FINAL_URL_SUFFIX = 82 - INVALID_FINAL_URL_SUFFIX_FORMAT = 83 - CUSTOMER_CONSENT_FOR_CALL_RECORDING_REQUIRED = 84 - ONLY_ONE_DELIVERY_OPTION_IS_ALLOWED = 85 - NO_DELIVERY_OPTION_IS_SET = 86 - INVALID_CONVERSION_REPORTING_STATE = 87 - IMAGE_SIZE_WRONG = 88 - EMAIL_DELIVERY_NOT_AVAILABLE_IN_COUNTRY = 89 - AUTO_REPLY_NOT_AVAILABLE_IN_COUNTRY = 90 - INVALID_LATITUDE_VALUE = 91 - INVALID_LONGITUDE_VALUE = 92 - TOO_MANY_LABELS = 93 - INVALID_IMAGE_URL = 94 - MISSING_LATITUDE_VALUE = 95 - MISSING_LONGITUDE_VALUE = 96 - ADDRESS_NOT_FOUND = 97 - ADDRESS_NOT_TARGETABLE = 98 - INVALID_ASSET_ID = 100 - INCOMPATIBLE_ASSET_TYPE = 101 - IMAGE_ERROR_UNEXPECTED_SIZE = 102 - IMAGE_ERROR_ASPECT_RATIO_NOT_ALLOWED = 103 - IMAGE_ERROR_FILE_TOO_LARGE = 104 - IMAGE_ERROR_FORMAT_NOT_ALLOWED = 105 - IMAGE_ERROR_CONSTRAINTS_VIOLATED = 106 - IMAGE_ERROR_SERVER_ERROR = 107 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/feed_mapping_error.py b/google/ads/googleads/v6/errors/types/feed_mapping_error.py deleted file mode 100644 index 86da62954..000000000 --- a/google/ads/googleads/v6/errors/types/feed_mapping_error.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FeedMappingErrorEnum",}, -) - - -class FeedMappingErrorEnum(proto.Message): - r"""Container for enum describing possible feed item errors.""" - - class FeedMappingError(proto.Enum): - r"""Enum describing possible feed item errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_PLACEHOLDER_FIELD = 2 - INVALID_CRITERION_FIELD = 3 - INVALID_PLACEHOLDER_TYPE = 4 - INVALID_CRITERION_TYPE = 5 - NO_ATTRIBUTE_FIELD_MAPPINGS = 7 - FEED_ATTRIBUTE_TYPE_MISMATCH = 8 - CANNOT_OPERATE_ON_MAPPINGS_FOR_SYSTEM_GENERATED_FEED = 9 - MULTIPLE_MAPPINGS_FOR_PLACEHOLDER_TYPE = 10 - MULTIPLE_MAPPINGS_FOR_CRITERION_TYPE = 11 - MULTIPLE_MAPPINGS_FOR_PLACEHOLDER_FIELD = 12 - MULTIPLE_MAPPINGS_FOR_CRITERION_FIELD = 13 - UNEXPECTED_ATTRIBUTE_FIELD_MAPPINGS = 14 - LOCATION_PLACEHOLDER_ONLY_FOR_PLACES_FEEDS = 15 - CANNOT_MODIFY_MAPPINGS_FOR_TYPED_FEED = 16 - INVALID_PLACEHOLDER_TYPE_FOR_NON_SYSTEM_GENERATED_FEED = 17 - INVALID_PLACEHOLDER_TYPE_FOR_SYSTEM_GENERATED_FEED_TYPE = 18 - ATTRIBUTE_FIELD_MAPPING_MISSING_FIELD = 19 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/field_error.py b/google/ads/googleads/v6/errors/types/field_error.py deleted file mode 100644 index 13cfe1ba6..000000000 --- a/google/ads/googleads/v6/errors/types/field_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FieldErrorEnum",}, -) - - -class FieldErrorEnum(proto.Message): - r"""Container for enum describing possible field errors.""" - - class FieldError(proto.Enum): - r"""Enum describing possible field errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REQUIRED = 2 - IMMUTABLE_FIELD = 3 - INVALID_VALUE = 4 - VALUE_MUST_BE_UNSET = 5 - REQUIRED_NONEMPTY_LIST = 6 - FIELD_CANNOT_BE_CLEARED = 7 - BLOCKED_VALUE = 9 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/field_mask_error.py b/google/ads/googleads/v6/errors/types/field_mask_error.py deleted file mode 100644 index a9300c258..000000000 --- a/google/ads/googleads/v6/errors/types/field_mask_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FieldMaskErrorEnum",}, -) - - -class FieldMaskErrorEnum(proto.Message): - r"""Container for enum describing possible field mask errors.""" - - class FieldMaskError(proto.Enum): - r"""Enum describing possible field mask errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FIELD_MASK_MISSING = 5 - FIELD_MASK_NOT_ALLOWED = 4 - FIELD_NOT_FOUND = 2 - FIELD_HAS_SUBFIELDS = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/function_error.py b/google/ads/googleads/v6/errors/types/function_error.py deleted file mode 100644 index 196c476bc..000000000 --- a/google/ads/googleads/v6/errors/types/function_error.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FunctionErrorEnum",}, -) - - -class FunctionErrorEnum(proto.Message): - r"""Container for enum describing possible function errors.""" - - class FunctionError(proto.Enum): - r"""Enum describing possible function errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_FUNCTION_FORMAT = 2 - DATA_TYPE_MISMATCH = 3 - INVALID_CONJUNCTION_OPERANDS = 4 - INVALID_NUMBER_OF_OPERANDS = 5 - INVALID_OPERAND_TYPE = 6 - INVALID_OPERATOR = 7 - INVALID_REQUEST_CONTEXT_TYPE = 8 - INVALID_FUNCTION_FOR_CALL_PLACEHOLDER = 9 - INVALID_FUNCTION_FOR_PLACEHOLDER = 10 - INVALID_OPERAND = 11 - MISSING_CONSTANT_OPERAND_VALUE = 12 - INVALID_CONSTANT_OPERAND_VALUE = 13 - INVALID_NESTING = 14 - MULTIPLE_FEED_IDS_NOT_SUPPORTED = 15 - INVALID_FUNCTION_FOR_FEED_WITH_FIXED_SCHEMA = 16 - INVALID_ATTRIBUTE_NAME = 17 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/function_parsing_error.py b/google/ads/googleads/v6/errors/types/function_parsing_error.py deleted file mode 100644 index d901e571c..000000000 --- a/google/ads/googleads/v6/errors/types/function_parsing_error.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"FunctionParsingErrorEnum",}, -) - - -class FunctionParsingErrorEnum(proto.Message): - r"""Container for enum describing possible function parsing - errors. - """ - - class FunctionParsingError(proto.Enum): - r"""Enum describing possible function parsing errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NO_MORE_INPUT = 2 - EXPECTED_CHARACTER = 3 - UNEXPECTED_SEPARATOR = 4 - UNMATCHED_LEFT_BRACKET = 5 - UNMATCHED_RIGHT_BRACKET = 6 - TOO_MANY_NESTED_FUNCTIONS = 7 - MISSING_RIGHT_HAND_OPERAND = 8 - INVALID_OPERATOR_NAME = 9 - FEED_ATTRIBUTE_OPERAND_ARGUMENT_NOT_INTEGER = 10 - NO_OPERANDS = 11 - TOO_MANY_OPERANDS = 12 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/geo_target_constant_suggestion_error.py b/google/ads/googleads/v6/errors/types/geo_target_constant_suggestion_error.py deleted file mode 100644 index 57208f40f..000000000 --- a/google/ads/googleads/v6/errors/types/geo_target_constant_suggestion_error.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"GeoTargetConstantSuggestionErrorEnum",}, -) - - -class GeoTargetConstantSuggestionErrorEnum(proto.Message): - r"""Container for enum describing possible geo target constant - suggestion errors. - """ - - class GeoTargetConstantSuggestionError(proto.Enum): - r"""Enum describing possible geo target constant suggestion - errors. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - LOCATION_NAME_SIZE_LIMIT = 2 - LOCATION_NAME_LIMIT = 3 - INVALID_COUNTRY_CODE = 4 - REQUEST_PARAMETERS_UNSET = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/header_error.py b/google/ads/googleads/v6/errors/types/header_error.py deleted file mode 100644 index 539386a2a..000000000 --- a/google/ads/googleads/v6/errors/types/header_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"HeaderErrorEnum",}, -) - - -class HeaderErrorEnum(proto.Message): - r"""Container for enum describing possible header errors.""" - - class HeaderError(proto.Enum): - r"""Enum describing possible header errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_LOGIN_CUSTOMER_ID = 3 - INVALID_LINKED_CUSTOMER_ID = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/id_error.py b/google/ads/googleads/v6/errors/types/id_error.py deleted file mode 100644 index 69364212b..000000000 --- a/google/ads/googleads/v6/errors/types/id_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"IdErrorEnum",}, -) - - -class IdErrorEnum(proto.Message): - r"""Container for enum describing possible id errors.""" - - class IdError(proto.Enum): - r"""Enum describing possible id errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NOT_FOUND = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/image_error.py b/google/ads/googleads/v6/errors/types/image_error.py deleted file mode 100644 index 94e0daba2..000000000 --- a/google/ads/googleads/v6/errors/types/image_error.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ImageErrorEnum",}, -) - - -class ImageErrorEnum(proto.Message): - r"""Container for enum describing possible image errors.""" - - class ImageError(proto.Enum): - r"""Enum describing possible image errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_IMAGE = 2 - STORAGE_ERROR = 3 - BAD_REQUEST = 4 - UNEXPECTED_SIZE = 5 - ANIMATED_NOT_ALLOWED = 6 - ANIMATION_TOO_LONG = 7 - SERVER_ERROR = 8 - CMYK_JPEG_NOT_ALLOWED = 9 - FLASH_NOT_ALLOWED = 10 - FLASH_WITHOUT_CLICKTAG = 11 - FLASH_ERROR_AFTER_FIXING_CLICK_TAG = 12 - ANIMATED_VISUAL_EFFECT = 13 - FLASH_ERROR = 14 - LAYOUT_PROBLEM = 15 - PROBLEM_READING_IMAGE_FILE = 16 - ERROR_STORING_IMAGE = 17 - ASPECT_RATIO_NOT_ALLOWED = 18 - FLASH_HAS_NETWORK_OBJECTS = 19 - FLASH_HAS_NETWORK_METHODS = 20 - FLASH_HAS_URL = 21 - FLASH_HAS_MOUSE_TRACKING = 22 - FLASH_HAS_RANDOM_NUM = 23 - FLASH_SELF_TARGETS = 24 - FLASH_BAD_GETURL_TARGET = 25 - FLASH_VERSION_NOT_SUPPORTED = 26 - FLASH_WITHOUT_HARD_CODED_CLICK_URL = 27 - INVALID_FLASH_FILE = 28 - FAILED_TO_FIX_CLICK_TAG_IN_FLASH = 29 - FLASH_ACCESSES_NETWORK_RESOURCES = 30 - FLASH_EXTERNAL_JS_CALL = 31 - FLASH_EXTERNAL_FS_CALL = 32 - FILE_TOO_LARGE = 33 - IMAGE_DATA_TOO_LARGE = 34 - IMAGE_PROCESSING_ERROR = 35 - IMAGE_TOO_SMALL = 36 - INVALID_INPUT = 37 - PROBLEM_READING_FILE = 38 - IMAGE_CONSTRAINTS_VIOLATED = 39 - FORMAT_NOT_ALLOWED = 40 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/internal_error.py b/google/ads/googleads/v6/errors/types/internal_error.py deleted file mode 100644 index a9176ac1d..000000000 --- a/google/ads/googleads/v6/errors/types/internal_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"InternalErrorEnum",}, -) - - -class InternalErrorEnum(proto.Message): - r"""Container for enum describing possible internal errors.""" - - class InternalError(proto.Enum): - r"""Enum describing possible internal errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INTERNAL_ERROR = 2 - ERROR_CODE_NOT_PUBLISHED = 3 - TRANSIENT_ERROR = 4 - DEADLINE_EXCEEDED = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/invoice_error.py b/google/ads/googleads/v6/errors/types/invoice_error.py deleted file mode 100644 index ccc99a658..000000000 --- a/google/ads/googleads/v6/errors/types/invoice_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"InvoiceErrorEnum",}, -) - - -class InvoiceErrorEnum(proto.Message): - r"""Container for enum describing possible invoice errors.""" - - class InvoiceError(proto.Enum): - r"""Enum describing possible invoice errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - YEAR_MONTH_TOO_OLD = 2 - NOT_INVOICED_CUSTOMER = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_error.py deleted file mode 100644 index 29eb5a58f..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_error.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanAdGroupErrorEnum",}, -) - - -class KeywordPlanAdGroupErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying a - keyword plan ad group. - """ - - class KeywordPlanAdGroupError(proto.Enum): - r"""Enum describing possible errors from applying a keyword plan - ad group. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_NAME = 2 - DUPLICATE_NAME = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_keyword_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_keyword_error.py deleted file mode 100644 index c4e4c0dc2..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_ad_group_keyword_error.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanAdGroupKeywordErrorEnum",}, -) - - -class KeywordPlanAdGroupKeywordErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying - an ad group keyword or a campaign keyword from a keyword plan. - """ - - class KeywordPlanAdGroupKeywordError(proto.Enum): - r"""Enum describing possible errors from applying a keyword plan - ad group keyword or keyword plan campaign keyword. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_KEYWORD_MATCH_TYPE = 2 - DUPLICATE_KEYWORD = 3 - KEYWORD_TEXT_TOO_LONG = 4 - KEYWORD_HAS_INVALID_CHARS = 5 - KEYWORD_HAS_TOO_MANY_WORDS = 6 - INVALID_KEYWORD_TEXT = 7 - NEGATIVE_KEYWORD_HAS_CPC_BID = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_campaign_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_campaign_error.py deleted file mode 100644 index a2089b7fa..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_campaign_error.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanCampaignErrorEnum",}, -) - - -class KeywordPlanCampaignErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying a - keyword plan campaign. - """ - - class KeywordPlanCampaignError(proto.Enum): - r"""Enum describing possible errors from applying a keyword plan - campaign. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_NAME = 2 - INVALID_LANGUAGES = 3 - INVALID_GEOS = 4 - DUPLICATE_NAME = 5 - MAX_GEOS_EXCEEDED = 6 - MAX_LANGUAGES_EXCEEDED = 7 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_campaign_keyword_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_campaign_keyword_error.py deleted file mode 100644 index 7e5f1f5af..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_campaign_keyword_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanCampaignKeywordErrorEnum",}, -) - - -class KeywordPlanCampaignKeywordErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying a - keyword plan campaign keyword. - """ - - class KeywordPlanCampaignKeywordError(proto.Enum): - r"""Enum describing possible errors from applying a keyword plan - campaign keyword. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - CAMPAIGN_KEYWORD_IS_POSITIVE = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_error.py deleted file mode 100644 index 0c7a26869..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_error.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanErrorEnum",}, -) - - -class KeywordPlanErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying a - keyword plan resource (keyword plan, keyword plan campaign, - keyword plan ad group or keyword plan keyword) or - KeywordPlanService RPC. - """ - - class KeywordPlanError(proto.Enum): - r"""Enum describing possible errors from applying a keyword plan.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BID_MULTIPLIER_OUT_OF_RANGE = 2 - BID_TOO_HIGH = 3 - BID_TOO_LOW = 4 - BID_TOO_MANY_FRACTIONAL_DIGITS = 5 - DAILY_BUDGET_TOO_LOW = 6 - DAILY_BUDGET_TOO_MANY_FRACTIONAL_DIGITS = 7 - INVALID_VALUE = 8 - KEYWORD_PLAN_HAS_NO_KEYWORDS = 9 - KEYWORD_PLAN_NOT_ENABLED = 10 - KEYWORD_PLAN_NOT_FOUND = 11 - MISSING_BID = 13 - MISSING_FORECAST_PERIOD = 14 - INVALID_FORECAST_DATE_RANGE = 15 - INVALID_NAME = 16 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/keyword_plan_idea_error.py b/google/ads/googleads/v6/errors/types/keyword_plan_idea_error.py deleted file mode 100644 index 4a3f3ebdc..000000000 --- a/google/ads/googleads/v6/errors/types/keyword_plan_idea_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanIdeaErrorEnum",}, -) - - -class KeywordPlanIdeaErrorEnum(proto.Message): - r"""Container for enum describing possible errors from - KeywordPlanIdeaService. - """ - - class KeywordPlanIdeaError(proto.Enum): - r"""Enum describing possible errors from KeywordPlanIdeaService.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - URL_CRAWL_ERROR = 2 - INVALID_VALUE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/label_error.py b/google/ads/googleads/v6/errors/types/label_error.py deleted file mode 100644 index da1ce5eaf..000000000 --- a/google/ads/googleads/v6/errors/types/label_error.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"LabelErrorEnum",}, -) - - -class LabelErrorEnum(proto.Message): - r"""Container for enum describing possible label errors.""" - - class LabelError(proto.Enum): - r"""Enum describing possible label errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_APPLY_INACTIVE_LABEL = 2 - CANNOT_APPLY_LABEL_TO_DISABLED_AD_GROUP_CRITERION = 3 - CANNOT_APPLY_LABEL_TO_NEGATIVE_AD_GROUP_CRITERION = 4 - EXCEEDED_LABEL_LIMIT_PER_TYPE = 5 - INVALID_RESOURCE_FOR_MANAGER_LABEL = 6 - DUPLICATE_NAME = 7 - INVALID_LABEL_NAME = 8 - CANNOT_ATTACH_LABEL_TO_DRAFT = 9 - CANNOT_ATTACH_NON_MANAGER_LABEL_TO_CUSTOMER = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/language_code_error.py b/google/ads/googleads/v6/errors/types/language_code_error.py deleted file mode 100644 index 7a0f61b67..000000000 --- a/google/ads/googleads/v6/errors/types/language_code_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"LanguageCodeErrorEnum",}, -) - - -class LanguageCodeErrorEnum(proto.Message): - r"""Container for enum describing language code errors.""" - - class LanguageCodeError(proto.Enum): - r"""Enum describing language code errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - LANGUAGE_CODE_NOT_FOUND = 2 - INVALID_LANGUAGE_CODE = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/list_operation_error.py b/google/ads/googleads/v6/errors/types/list_operation_error.py deleted file mode 100644 index 0813eec2d..000000000 --- a/google/ads/googleads/v6/errors/types/list_operation_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ListOperationErrorEnum",}, -) - - -class ListOperationErrorEnum(proto.Message): - r"""Container for enum describing possible list operation errors.""" - - class ListOperationError(proto.Enum): - r"""Enum describing possible list operation errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REQUIRED_FIELD_MISSING = 7 - DUPLICATE_VALUES = 8 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/manager_link_error.py b/google/ads/googleads/v6/errors/types/manager_link_error.py deleted file mode 100644 index 5f1ca209d..000000000 --- a/google/ads/googleads/v6/errors/types/manager_link_error.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ManagerLinkErrorEnum",}, -) - - -class ManagerLinkErrorEnum(proto.Message): - r"""Container for enum describing possible ManagerLink errors.""" - - class ManagerLinkError(proto.Enum): - r"""Enum describing possible ManagerLink errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ACCOUNTS_NOT_COMPATIBLE_FOR_LINKING = 2 - TOO_MANY_MANAGERS = 3 - TOO_MANY_INVITES = 4 - ALREADY_INVITED_BY_THIS_MANAGER = 5 - ALREADY_MANAGED_BY_THIS_MANAGER = 6 - ALREADY_MANAGED_IN_HIERARCHY = 7 - DUPLICATE_CHILD_FOUND = 8 - CLIENT_HAS_NO_ADMIN_USER = 9 - MAX_DEPTH_EXCEEDED = 10 - CYCLE_NOT_ALLOWED = 11 - TOO_MANY_ACCOUNTS = 12 - TOO_MANY_ACCOUNTS_AT_MANAGER = 13 - NON_OWNER_USER_CANNOT_MODIFY_LINK = 14 - SUSPENDED_ACCOUNT_CANNOT_ADD_CLIENTS = 15 - CLIENT_OUTSIDE_TREE = 16 - INVALID_STATUS_CHANGE = 17 - INVALID_CHANGE = 18 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/media_bundle_error.py b/google/ads/googleads/v6/errors/types/media_bundle_error.py deleted file mode 100644 index 4bdc987e7..000000000 --- a/google/ads/googleads/v6/errors/types/media_bundle_error.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"MediaBundleErrorEnum",}, -) - - -class MediaBundleErrorEnum(proto.Message): - r"""Container for enum describing possible media bundle errors.""" - - class MediaBundleError(proto.Enum): - r"""Enum describing possible media bundle errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - BAD_REQUEST = 3 - DOUBLECLICK_BUNDLE_NOT_ALLOWED = 4 - EXTERNAL_URL_NOT_ALLOWED = 5 - FILE_TOO_LARGE = 6 - GOOGLE_WEB_DESIGNER_ZIP_FILE_NOT_PUBLISHED = 7 - INVALID_INPUT = 8 - INVALID_MEDIA_BUNDLE = 9 - INVALID_MEDIA_BUNDLE_ENTRY = 10 - INVALID_MIME_TYPE = 11 - INVALID_PATH = 12 - INVALID_URL_REFERENCE = 13 - MEDIA_DATA_TOO_LARGE = 14 - MISSING_PRIMARY_MEDIA_BUNDLE_ENTRY = 15 - SERVER_ERROR = 16 - STORAGE_ERROR = 17 - SWIFFY_BUNDLE_NOT_ALLOWED = 18 - TOO_MANY_FILES = 19 - UNEXPECTED_SIZE = 20 - UNSUPPORTED_GOOGLE_WEB_DESIGNER_ENVIRONMENT = 21 - UNSUPPORTED_HTML5_FEATURE = 22 - URL_IN_MEDIA_BUNDLE_NOT_SSL_COMPLIANT = 23 - CUSTOM_EXIT_NOT_ALLOWED = 24 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/media_file_error.py b/google/ads/googleads/v6/errors/types/media_file_error.py deleted file mode 100644 index 16d7d731e..000000000 --- a/google/ads/googleads/v6/errors/types/media_file_error.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"MediaFileErrorEnum",}, -) - - -class MediaFileErrorEnum(proto.Message): - r"""Container for enum describing possible media file errors.""" - - class MediaFileError(proto.Enum): - r"""Enum describing possible media file errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_CREATE_STANDARD_ICON = 2 - CANNOT_SELECT_STANDARD_ICON_WITH_OTHER_TYPES = 3 - CANNOT_SPECIFY_MEDIA_FILE_ID_AND_DATA = 4 - DUPLICATE_MEDIA = 5 - EMPTY_FIELD = 6 - RESOURCE_REFERENCED_IN_MULTIPLE_OPS = 7 - FIELD_NOT_SUPPORTED_FOR_MEDIA_SUB_TYPE = 8 - INVALID_MEDIA_FILE_ID = 9 - INVALID_MEDIA_SUB_TYPE = 10 - INVALID_MEDIA_FILE_TYPE = 11 - INVALID_MIME_TYPE = 12 - INVALID_REFERENCE_ID = 13 - INVALID_YOU_TUBE_ID = 14 - MEDIA_FILE_FAILED_TRANSCODING = 15 - MEDIA_NOT_TRANSCODED = 16 - MEDIA_TYPE_DOES_NOT_MATCH_MEDIA_FILE_TYPE = 17 - NO_FIELDS_SPECIFIED = 18 - NULL_REFERENCE_ID_AND_MEDIA_ID = 19 - TOO_LONG = 20 - UNSUPPORTED_TYPE = 21 - YOU_TUBE_SERVICE_UNAVAILABLE = 22 - YOU_TUBE_VIDEO_HAS_NON_POSITIVE_DURATION = 23 - YOU_TUBE_VIDEO_NOT_FOUND = 24 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/media_upload_error.py b/google/ads/googleads/v6/errors/types/media_upload_error.py deleted file mode 100644 index 08717cedd..000000000 --- a/google/ads/googleads/v6/errors/types/media_upload_error.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"MediaUploadErrorEnum",}, -) - - -class MediaUploadErrorEnum(proto.Message): - r"""Container for enum describing possible media uploading - errors. - """ - - class MediaUploadError(proto.Enum): - r"""Enum describing possible media uploading errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - FILE_TOO_BIG = 2 - UNPARSEABLE_IMAGE = 3 - ANIMATED_IMAGE_NOT_ALLOWED = 4 - FORMAT_NOT_ALLOWED = 5 - EXTERNAL_URL_NOT_ALLOWED = 6 - INVALID_URL_REFERENCE = 7 - MISSING_PRIMARY_MEDIA_BUNDLE_ENTRY = 8 - ANIMATED_VISUAL_EFFECT = 9 - ANIMATION_TOO_LONG = 10 - ASPECT_RATIO_NOT_ALLOWED = 11 - AUDIO_NOT_ALLOWED_IN_MEDIA_BUNDLE = 12 - CMYK_JPEG_NOT_ALLOWED = 13 - FLASH_NOT_ALLOWED = 14 - FRAME_RATE_TOO_HIGH = 15 - GOOGLE_WEB_DESIGNER_ZIP_FILE_NOT_PUBLISHED = 16 - IMAGE_CONSTRAINTS_VIOLATED = 17 - INVALID_MEDIA_BUNDLE = 18 - INVALID_MEDIA_BUNDLE_ENTRY = 19 - INVALID_MIME_TYPE = 20 - INVALID_PATH = 21 - LAYOUT_PROBLEM = 22 - MALFORMED_URL = 23 - MEDIA_BUNDLE_NOT_ALLOWED = 24 - MEDIA_BUNDLE_NOT_COMPATIBLE_TO_PRODUCT_TYPE = 25 - MEDIA_BUNDLE_REJECTED_BY_MULTIPLE_ASSET_SPECS = 26 - TOO_MANY_FILES_IN_MEDIA_BUNDLE = 27 - UNSUPPORTED_GOOGLE_WEB_DESIGNER_ENVIRONMENT = 28 - UNSUPPORTED_HTML5_FEATURE = 29 - URL_IN_MEDIA_BUNDLE_NOT_SSL_COMPLIANT = 30 - VIDEO_FILE_NAME_TOO_LONG = 31 - VIDEO_MULTIPLE_FILES_WITH_SAME_NAME = 32 - VIDEO_NOT_ALLOWED_IN_MEDIA_BUNDLE = 33 - CANNOT_UPLOAD_MEDIA_TYPE_THROUGH_API = 34 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/multiplier_error.py b/google/ads/googleads/v6/errors/types/multiplier_error.py deleted file mode 100644 index 8b7f54aab..000000000 --- a/google/ads/googleads/v6/errors/types/multiplier_error.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"MultiplierErrorEnum",}, -) - - -class MultiplierErrorEnum(proto.Message): - r"""Container for enum describing possible multiplier errors.""" - - class MultiplierError(proto.Enum): - r"""Enum describing possible multiplier errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - MULTIPLIER_TOO_HIGH = 2 - MULTIPLIER_TOO_LOW = 3 - TOO_MANY_FRACTIONAL_DIGITS = 4 - MULTIPLIER_NOT_ALLOWED_FOR_BIDDING_STRATEGY = 5 - MULTIPLIER_NOT_ALLOWED_WHEN_BASE_BID_IS_MISSING = 6 - NO_MULTIPLIER_SPECIFIED = 7 - MULTIPLIER_CAUSES_BID_TO_EXCEED_DAILY_BUDGET = 8 - MULTIPLIER_CAUSES_BID_TO_EXCEED_MONTHLY_BUDGET = 9 - MULTIPLIER_CAUSES_BID_TO_EXCEED_CUSTOM_BUDGET = 10 - MULTIPLIER_CAUSES_BID_TO_EXCEED_MAX_ALLOWED_BID = 11 - BID_LESS_THAN_MIN_ALLOWED_BID_WITH_MULTIPLIER = 12 - MULTIPLIER_AND_BIDDING_STRATEGY_TYPE_MISMATCH = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/mutate_error.py b/google/ads/googleads/v6/errors/types/mutate_error.py deleted file mode 100644 index 1437e40c2..000000000 --- a/google/ads/googleads/v6/errors/types/mutate_error.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"MutateErrorEnum",}, -) - - -class MutateErrorEnum(proto.Message): - r"""Container for enum describing possible mutate errors.""" - - class MutateError(proto.Enum): - r"""Enum describing possible mutate errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - RESOURCE_NOT_FOUND = 3 - ID_EXISTS_IN_MULTIPLE_MUTATES = 7 - INCONSISTENT_FIELD_VALUES = 8 - MUTATE_NOT_ALLOWED = 9 - RESOURCE_NOT_IN_GOOGLE_ADS = 10 - RESOURCE_ALREADY_EXISTS = 11 - RESOURCE_DOES_NOT_SUPPORT_VALIDATE_ONLY = 12 - RESOURCE_READ_ONLY = 13 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/new_resource_creation_error.py b/google/ads/googleads/v6/errors/types/new_resource_creation_error.py deleted file mode 100644 index 5ad8be6c2..000000000 --- a/google/ads/googleads/v6/errors/types/new_resource_creation_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"NewResourceCreationErrorEnum",}, -) - - -class NewResourceCreationErrorEnum(proto.Message): - r"""Container for enum describing possible new resource creation - errors. - """ - - class NewResourceCreationError(proto.Enum): - r"""Enum describing possible new resource creation errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CANNOT_SET_ID_FOR_CREATE = 2 - DUPLICATE_TEMP_IDS = 3 - TEMP_ID_RESOURCE_HAD_ERRORS = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/not_allowlisted_error.py b/google/ads/googleads/v6/errors/types/not_allowlisted_error.py deleted file mode 100644 index a83e943dc..000000000 --- a/google/ads/googleads/v6/errors/types/not_allowlisted_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"NotAllowlistedErrorEnum",}, -) - - -class NotAllowlistedErrorEnum(proto.Message): - r"""Container for enum describing possible not allowlisted - errors. - """ - - class NotAllowlistedError(proto.Enum): - r"""Enum describing possible not allowlisted errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CUSTOMER_NOT_ALLOWLISTED_FOR_THIS_FEATURE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/not_empty_error.py b/google/ads/googleads/v6/errors/types/not_empty_error.py deleted file mode 100644 index 41022bf1a..000000000 --- a/google/ads/googleads/v6/errors/types/not_empty_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"NotEmptyErrorEnum",}, -) - - -class NotEmptyErrorEnum(proto.Message): - r"""Container for enum describing possible not empty errors.""" - - class NotEmptyError(proto.Enum): - r"""Enum describing possible not empty errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EMPTY_LIST = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/null_error.py b/google/ads/googleads/v6/errors/types/null_error.py deleted file mode 100644 index 4b05614d6..000000000 --- a/google/ads/googleads/v6/errors/types/null_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"NullErrorEnum",}, -) - - -class NullErrorEnum(proto.Message): - r"""Container for enum describing possible null errors.""" - - class NullError(proto.Enum): - r"""Enum describing possible null errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NULL_CONTENT = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/offline_user_data_job_error.py b/google/ads/googleads/v6/errors/types/offline_user_data_job_error.py deleted file mode 100644 index cade3bfdd..000000000 --- a/google/ads/googleads/v6/errors/types/offline_user_data_job_error.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"OfflineUserDataJobErrorEnum",}, -) - - -class OfflineUserDataJobErrorEnum(proto.Message): - r"""Container for enum describing possible offline user data job - errors. - """ - - class OfflineUserDataJobError(proto.Enum): - r"""Enum describing possible request errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_USER_LIST_ID = 3 - INVALID_USER_LIST_TYPE = 4 - NOT_ON_ALLOWLIST_FOR_USER_ID = 33 - INCOMPATIBLE_UPLOAD_KEY_TYPE = 6 - MISSING_USER_IDENTIFIER = 7 - INVALID_MOBILE_ID_FORMAT = 8 - TOO_MANY_USER_IDENTIFIERS = 9 - NOT_ON_ALLOWLIST_FOR_STORE_SALES_DIRECT = 31 - NOT_ON_ALLOWLIST_FOR_UNIFIED_STORE_SALES = 32 - INVALID_PARTNER_ID = 11 - INVALID_ENCODING = 12 - INVALID_COUNTRY_CODE = 13 - INCOMPATIBLE_USER_IDENTIFIER = 14 - FUTURE_TRANSACTION_TIME = 15 - INVALID_CONVERSION_ACTION = 16 - MOBILE_ID_NOT_SUPPORTED = 17 - INVALID_OPERATION_ORDER = 18 - CONFLICTING_OPERATION = 19 - EXTERNAL_UPDATE_ID_ALREADY_EXISTS = 21 - JOB_ALREADY_STARTED = 22 - REMOVE_NOT_SUPPORTED = 23 - REMOVE_ALL_NOT_SUPPORTED = 24 - INVALID_SHA256_FORMAT = 25 - CUSTOM_KEY_DISABLED = 26 - CUSTOM_KEY_NOT_PREDEFINED = 27 - CUSTOM_KEY_NOT_SET = 29 - CUSTOMER_NOT_ACCEPTED_CUSTOMER_DATA_TERMS = 30 - ATTRIBUTES_NOT_APPLICABLE_FOR_CUSTOMER_MATCH_USER_LIST = 34 - LIFETIME_VALUE_BUCKET_NOT_IN_RANGE = 35 - INCOMPATIBLE_USER_IDENTIFIER_FOR_ATTRIBUTES = 36 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/operation_access_denied_error.py b/google/ads/googleads/v6/errors/types/operation_access_denied_error.py deleted file mode 100644 index 5ecdd6178..000000000 --- a/google/ads/googleads/v6/errors/types/operation_access_denied_error.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"OperationAccessDeniedErrorEnum",}, -) - - -class OperationAccessDeniedErrorEnum(proto.Message): - r"""Container for enum describing possible operation access - denied errors. - """ - - class OperationAccessDeniedError(proto.Enum): - r"""Enum describing possible operation access denied errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ACTION_NOT_PERMITTED = 2 - CREATE_OPERATION_NOT_PERMITTED = 3 - REMOVE_OPERATION_NOT_PERMITTED = 4 - UPDATE_OPERATION_NOT_PERMITTED = 5 - MUTATE_ACTION_NOT_PERMITTED_FOR_CLIENT = 6 - OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE = 7 - CREATE_AS_REMOVED_NOT_PERMITTED = 8 - OPERATION_NOT_PERMITTED_FOR_REMOVED_RESOURCE = 9 - OPERATION_NOT_PERMITTED_FOR_AD_GROUP_TYPE = 10 - MUTATE_NOT_PERMITTED_FOR_CUSTOMER = 11 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/operator_error.py b/google/ads/googleads/v6/errors/types/operator_error.py deleted file mode 100644 index ad5de78e3..000000000 --- a/google/ads/googleads/v6/errors/types/operator_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"OperatorErrorEnum",}, -) - - -class OperatorErrorEnum(proto.Message): - r"""Container for enum describing possible operator errors.""" - - class OperatorError(proto.Enum): - r"""Enum describing possible operator errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPERATOR_NOT_SUPPORTED = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/partial_failure_error.py b/google/ads/googleads/v6/errors/types/partial_failure_error.py deleted file mode 100644 index 670989a27..000000000 --- a/google/ads/googleads/v6/errors/types/partial_failure_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"PartialFailureErrorEnum",}, -) - - -class PartialFailureErrorEnum(proto.Message): - r"""Container for enum describing possible partial failure - errors. - """ - - class PartialFailureError(proto.Enum): - r"""Enum describing possible partial failure errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - PARTIAL_FAILURE_MODE_REQUIRED = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/payments_account_error.py b/google/ads/googleads/v6/errors/types/payments_account_error.py deleted file mode 100644 index 884463bb6..000000000 --- a/google/ads/googleads/v6/errors/types/payments_account_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"PaymentsAccountErrorEnum",}, -) - - -class PaymentsAccountErrorEnum(proto.Message): - r"""Container for enum describing possible errors in payments - account service. - """ - - class PaymentsAccountError(proto.Enum): - r"""Enum describing possible errors in payments account service.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NOT_SUPPORTED_FOR_MANAGER_CUSTOMER = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/policy_finding_error.py b/google/ads/googleads/v6/errors/types/policy_finding_error.py deleted file mode 100644 index cccfadd2c..000000000 --- a/google/ads/googleads/v6/errors/types/policy_finding_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"PolicyFindingErrorEnum",}, -) - - -class PolicyFindingErrorEnum(proto.Message): - r"""Container for enum describing possible policy finding errors.""" - - class PolicyFindingError(proto.Enum): - r"""Enum describing possible policy finding errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - POLICY_FINDING = 2 - POLICY_TOPIC_NOT_FOUND = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/policy_validation_parameter_error.py b/google/ads/googleads/v6/errors/types/policy_validation_parameter_error.py deleted file mode 100644 index 8c9af2977..000000000 --- a/google/ads/googleads/v6/errors/types/policy_validation_parameter_error.py +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"PolicyValidationParameterErrorEnum",}, -) - - -class PolicyValidationParameterErrorEnum(proto.Message): - r"""Container for enum describing possible policy validation - parameter errors. - """ - - class PolicyValidationParameterError(proto.Enum): - r"""Enum describing possible policy validation parameter errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - UNSUPPORTED_AD_TYPE_FOR_IGNORABLE_POLICY_TOPICS = 2 - UNSUPPORTED_AD_TYPE_FOR_EXEMPT_POLICY_VIOLATION_KEYS = 3 - CANNOT_SET_BOTH_IGNORABLE_POLICY_TOPICS_AND_EXEMPT_POLICY_VIOLATION_KEYS = ( - 4 - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/policy_violation_error.py b/google/ads/googleads/v6/errors/types/policy_violation_error.py deleted file mode 100644 index 9206b3985..000000000 --- a/google/ads/googleads/v6/errors/types/policy_violation_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"PolicyViolationErrorEnum",}, -) - - -class PolicyViolationErrorEnum(proto.Message): - r"""Container for enum describing possible policy violation - errors. - """ - - class PolicyViolationError(proto.Enum): - r"""Enum describing possible policy violation errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - POLICY_ERROR = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/query_error.py b/google/ads/googleads/v6/errors/types/query_error.py deleted file mode 100644 index eb33b5346..000000000 --- a/google/ads/googleads/v6/errors/types/query_error.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"QueryErrorEnum",}, -) - - -class QueryErrorEnum(proto.Message): - r"""Container for enum describing possible query errors.""" - - class QueryError(proto.Enum): - r"""Enum describing possible query errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - QUERY_ERROR = 50 - BAD_ENUM_CONSTANT = 18 - BAD_ESCAPE_SEQUENCE = 7 - BAD_FIELD_NAME = 12 - BAD_LIMIT_VALUE = 15 - BAD_NUMBER = 5 - BAD_OPERATOR = 3 - BAD_PARAMETER_NAME = 61 - BAD_PARAMETER_VALUE = 62 - BAD_RESOURCE_TYPE_IN_FROM_CLAUSE = 45 - BAD_SYMBOL = 2 - BAD_VALUE = 4 - DATE_RANGE_TOO_WIDE = 36 - DATE_RANGE_TOO_NARROW = 60 - EXPECTED_AND = 30 - EXPECTED_BY = 14 - EXPECTED_DIMENSION_FIELD_IN_SELECT_CLAUSE = 37 - EXPECTED_FILTERS_ON_DATE_RANGE = 55 - EXPECTED_FROM = 44 - EXPECTED_LIST = 41 - EXPECTED_REFERENCED_FIELD_IN_SELECT_CLAUSE = 16 - EXPECTED_SELECT = 13 - EXPECTED_SINGLE_VALUE = 42 - EXPECTED_VALUE_WITH_BETWEEN_OPERATOR = 29 - INVALID_DATE_FORMAT = 38 - INVALID_STRING_VALUE = 57 - INVALID_VALUE_WITH_BETWEEN_OPERATOR = 26 - INVALID_VALUE_WITH_DURING_OPERATOR = 22 - INVALID_VALUE_WITH_LIKE_OPERATOR = 56 - OPERATOR_FIELD_MISMATCH = 35 - PROHIBITED_EMPTY_LIST_IN_CONDITION = 28 - PROHIBITED_ENUM_CONSTANT = 54 - PROHIBITED_FIELD_COMBINATION_IN_SELECT_CLAUSE = 31 - PROHIBITED_FIELD_IN_ORDER_BY_CLAUSE = 40 - PROHIBITED_FIELD_IN_SELECT_CLAUSE = 23 - PROHIBITED_FIELD_IN_WHERE_CLAUSE = 24 - PROHIBITED_RESOURCE_TYPE_IN_FROM_CLAUSE = 43 - PROHIBITED_RESOURCE_TYPE_IN_SELECT_CLAUSE = 48 - PROHIBITED_RESOURCE_TYPE_IN_WHERE_CLAUSE = 58 - PROHIBITED_METRIC_IN_SELECT_OR_WHERE_CLAUSE = 49 - PROHIBITED_SEGMENT_IN_SELECT_OR_WHERE_CLAUSE = 51 - PROHIBITED_SEGMENT_WITH_METRIC_IN_SELECT_OR_WHERE_CLAUSE = 53 - LIMIT_VALUE_TOO_LOW = 25 - PROHIBITED_NEWLINE_IN_STRING = 8 - PROHIBITED_VALUE_COMBINATION_IN_LIST = 10 - PROHIBITED_VALUE_COMBINATION_WITH_BETWEEN_OPERATOR = 21 - STRING_NOT_TERMINATED = 6 - TOO_MANY_SEGMENTS = 34 - UNEXPECTED_END_OF_QUERY = 9 - UNEXPECTED_FROM_CLAUSE = 47 - UNRECOGNIZED_FIELD = 32 - UNEXPECTED_INPUT = 11 - REQUESTED_METRICS_FOR_MANAGER = 59 - FILTER_HAS_TOO_MANY_VALUES = 63 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/quota_error.py b/google/ads/googleads/v6/errors/types/quota_error.py deleted file mode 100644 index cb8ae7f58..000000000 --- a/google/ads/googleads/v6/errors/types/quota_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"QuotaErrorEnum",}, -) - - -class QuotaErrorEnum(proto.Message): - r"""Container for enum describing possible quota errors.""" - - class QuotaError(proto.Enum): - r"""Enum describing possible quota errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - RESOURCE_EXHAUSTED = 2 - ACCESS_PROHIBITED = 3 - RESOURCE_TEMPORARILY_EXHAUSTED = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/range_error.py b/google/ads/googleads/v6/errors/types/range_error.py deleted file mode 100644 index e709fb6c4..000000000 --- a/google/ads/googleads/v6/errors/types/range_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"RangeErrorEnum",}, -) - - -class RangeErrorEnum(proto.Message): - r"""Container for enum describing possible range errors.""" - - class RangeError(proto.Enum): - r"""Enum describing possible range errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - TOO_LOW = 2 - TOO_HIGH = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/reach_plan_error.py b/google/ads/googleads/v6/errors/types/reach_plan_error.py deleted file mode 100644 index b2aa9560d..000000000 --- a/google/ads/googleads/v6/errors/types/reach_plan_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ReachPlanErrorEnum",}, -) - - -class ReachPlanErrorEnum(proto.Message): - r"""Container for enum describing possible errors returned from - the ReachPlanService. - """ - - class ReachPlanError(proto.Enum): - r"""Enum describing possible errors from ReachPlanService.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - NOT_FORECASTABLE_MISSING_RATE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/recommendation_error.py b/google/ads/googleads/v6/errors/types/recommendation_error.py deleted file mode 100644 index 378dbdc0f..000000000 --- a/google/ads/googleads/v6/errors/types/recommendation_error.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"RecommendationErrorEnum",}, -) - - -class RecommendationErrorEnum(proto.Message): - r"""Container for enum describing possible errors from applying a - recommendation. - """ - - class RecommendationError(proto.Enum): - r"""Enum describing possible errors from applying a - recommendation. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - BUDGET_AMOUNT_TOO_SMALL = 2 - BUDGET_AMOUNT_TOO_LARGE = 3 - INVALID_BUDGET_AMOUNT = 4 - POLICY_ERROR = 5 - INVALID_BID_AMOUNT = 6 - ADGROUP_KEYWORD_LIMIT = 7 - RECOMMENDATION_ALREADY_APPLIED = 8 - RECOMMENDATION_INVALIDATED = 9 - TOO_MANY_OPERATIONS = 10 - NO_OPERATIONS = 11 - DIFFERENT_TYPES_NOT_SUPPORTED = 12 - DUPLICATE_RESOURCE_NAME = 13 - RECOMMENDATION_ALREADY_DISMISSED = 14 - INVALID_APPLY_REQUEST = 15 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/region_code_error.py b/google/ads/googleads/v6/errors/types/region_code_error.py deleted file mode 100644 index 2d06947af..000000000 --- a/google/ads/googleads/v6/errors/types/region_code_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"RegionCodeErrorEnum",}, -) - - -class RegionCodeErrorEnum(proto.Message): - r"""Container for enum describing possible region code errors.""" - - class RegionCodeError(proto.Enum): - r"""Enum describing possible region code errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_REGION_CODE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/request_error.py b/google/ads/googleads/v6/errors/types/request_error.py deleted file mode 100644 index f01732e64..000000000 --- a/google/ads/googleads/v6/errors/types/request_error.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"RequestErrorEnum",}, -) - - -class RequestErrorEnum(proto.Message): - r"""Container for enum describing possible request errors.""" - - class RequestError(proto.Enum): - r"""Enum describing possible request errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - RESOURCE_NAME_MISSING = 3 - RESOURCE_NAME_MALFORMED = 4 - BAD_RESOURCE_ID = 17 - INVALID_CUSTOMER_ID = 16 - OPERATION_REQUIRED = 5 - RESOURCE_NOT_FOUND = 6 - INVALID_PAGE_TOKEN = 7 - EXPIRED_PAGE_TOKEN = 8 - INVALID_PAGE_SIZE = 22 - REQUIRED_FIELD_MISSING = 9 - IMMUTABLE_FIELD = 11 - TOO_MANY_MUTATE_OPERATIONS = 13 - CANNOT_BE_EXECUTED_BY_MANAGER_ACCOUNT = 14 - CANNOT_MODIFY_FOREIGN_FIELD = 15 - INVALID_ENUM_VALUE = 18 - DEVELOPER_TOKEN_PARAMETER_MISSING = 19 - LOGIN_CUSTOMER_ID_PARAMETER_MISSING = 20 - VALIDATE_ONLY_REQUEST_HAS_PAGE_TOKEN = 21 - CANNOT_RETURN_SUMMARY_ROW_FOR_REQUEST_WITHOUT_METRICS = 29 - CANNOT_RETURN_SUMMARY_ROW_FOR_VALIDATE_ONLY_REQUESTS = 30 - INCONSISTENT_RETURN_SUMMARY_ROW_VALUE = 31 - TOTAL_RESULTS_COUNT_NOT_ORIGINALLY_REQUESTED = 32 - RPC_DEADLINE_TOO_SHORT = 33 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/resource_access_denied_error.py b/google/ads/googleads/v6/errors/types/resource_access_denied_error.py deleted file mode 100644 index 1e8894407..000000000 --- a/google/ads/googleads/v6/errors/types/resource_access_denied_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ResourceAccessDeniedErrorEnum",}, -) - - -class ResourceAccessDeniedErrorEnum(proto.Message): - r"""Container for enum describing possible resource access denied - errors. - """ - - class ResourceAccessDeniedError(proto.Enum): - r"""Enum describing possible resource access denied errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - WRITE_ACCESS_DENIED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/resource_count_limit_exceeded_error.py b/google/ads/googleads/v6/errors/types/resource_count_limit_exceeded_error.py deleted file mode 100644 index a442650f8..000000000 --- a/google/ads/googleads/v6/errors/types/resource_count_limit_exceeded_error.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ResourceCountLimitExceededErrorEnum",}, -) - - -class ResourceCountLimitExceededErrorEnum(proto.Message): - r"""Container for enum describing possible resource count limit - exceeded errors. - """ - - class ResourceCountLimitExceededError(proto.Enum): - r"""Enum describing possible resource count limit exceeded - errors. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - ACCOUNT_LIMIT = 2 - CAMPAIGN_LIMIT = 3 - ADGROUP_LIMIT = 4 - AD_GROUP_AD_LIMIT = 5 - AD_GROUP_CRITERION_LIMIT = 6 - SHARED_SET_LIMIT = 7 - MATCHING_FUNCTION_LIMIT = 8 - RESPONSE_ROW_LIMIT_EXCEEDED = 9 - RESOURCE_LIMIT = 10 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/setting_error.py b/google/ads/googleads/v6/errors/types/setting_error.py deleted file mode 100644 index 742e9784a..000000000 --- a/google/ads/googleads/v6/errors/types/setting_error.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"SettingErrorEnum",}, -) - - -class SettingErrorEnum(proto.Message): - r"""Container for enum describing possible setting errors.""" - - class SettingError(proto.Enum): - r"""Enum describing possible setting errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - SETTING_TYPE_IS_NOT_AVAILABLE = 3 - SETTING_TYPE_IS_NOT_COMPATIBLE_WITH_CAMPAIGN = 4 - TARGETING_SETTING_CONTAINS_INVALID_CRITERION_TYPE_GROUP = 5 - TARGETING_SETTING_DEMOGRAPHIC_CRITERION_TYPE_GROUPS_MUST_BE_SET_TO_TARGET_ALL = ( - 6 - ) - TARGETING_SETTING_CANNOT_CHANGE_TARGET_ALL_TO_FALSE_FOR_DEMOGRAPHIC_CRITERION_TYPE_GROUP = ( - 7 - ) - DYNAMIC_SEARCH_ADS_SETTING_AT_LEAST_ONE_FEED_ID_MUST_BE_PRESENT = 8 - DYNAMIC_SEARCH_ADS_SETTING_CONTAINS_INVALID_DOMAIN_NAME = 9 - DYNAMIC_SEARCH_ADS_SETTING_CONTAINS_SUBDOMAIN_NAME = 10 - DYNAMIC_SEARCH_ADS_SETTING_CONTAINS_INVALID_LANGUAGE_CODE = 11 - TARGET_ALL_IS_NOT_ALLOWED_FOR_PLACEMENT_IN_SEARCH_CAMPAIGN = 12 - SETTING_VALUE_NOT_COMPATIBLE_WITH_CAMPAIGN = 20 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/shared_criterion_error.py b/google/ads/googleads/v6/errors/types/shared_criterion_error.py deleted file mode 100644 index 5dc92d46f..000000000 --- a/google/ads/googleads/v6/errors/types/shared_criterion_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"SharedCriterionErrorEnum",}, -) - - -class SharedCriterionErrorEnum(proto.Message): - r"""Container for enum describing possible shared criterion - errors. - """ - - class SharedCriterionError(proto.Enum): - r"""Enum describing possible shared criterion errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CRITERION_TYPE_NOT_ALLOWED_FOR_SHARED_SET_TYPE = 2 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/shared_set_error.py b/google/ads/googleads/v6/errors/types/shared_set_error.py deleted file mode 100644 index 72c57060e..000000000 --- a/google/ads/googleads/v6/errors/types/shared_set_error.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"SharedSetErrorEnum",}, -) - - -class SharedSetErrorEnum(proto.Message): - r"""Container for enum describing possible shared set errors.""" - - class SharedSetError(proto.Enum): - r"""Enum describing possible shared set errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - CUSTOMER_CANNOT_CREATE_SHARED_SET_OF_THIS_TYPE = 2 - DUPLICATE_NAME = 3 - SHARED_SET_REMOVED = 4 - SHARED_SET_IN_USE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/size_limit_error.py b/google/ads/googleads/v6/errors/types/size_limit_error.py deleted file mode 100644 index b1f325eeb..000000000 --- a/google/ads/googleads/v6/errors/types/size_limit_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"SizeLimitErrorEnum",}, -) - - -class SizeLimitErrorEnum(proto.Message): - r"""Container for enum describing possible size limit errors.""" - - class SizeLimitError(proto.Enum): - r"""Enum describing possible size limit errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - REQUEST_SIZE_LIMIT_EXCEEDED = 2 - RESPONSE_SIZE_LIMIT_EXCEEDED = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/string_format_error.py b/google/ads/googleads/v6/errors/types/string_format_error.py deleted file mode 100644 index ee32eba0d..000000000 --- a/google/ads/googleads/v6/errors/types/string_format_error.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"StringFormatErrorEnum",}, -) - - -class StringFormatErrorEnum(proto.Message): - r"""Container for enum describing possible string format errors.""" - - class StringFormatError(proto.Enum): - r"""Enum describing possible string format errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ILLEGAL_CHARS = 2 - INVALID_FORMAT = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/string_length_error.py b/google/ads/googleads/v6/errors/types/string_length_error.py deleted file mode 100644 index 1edfe61db..000000000 --- a/google/ads/googleads/v6/errors/types/string_length_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"StringLengthErrorEnum",}, -) - - -class StringLengthErrorEnum(proto.Message): - r"""Container for enum describing possible string length errors.""" - - class StringLengthError(proto.Enum): - r"""Enum describing possible string length errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EMPTY = 4 - TOO_SHORT = 2 - TOO_LONG = 3 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/third_party_app_analytics_link_error.py b/google/ads/googleads/v6/errors/types/third_party_app_analytics_link_error.py deleted file mode 100644 index 4062b6970..000000000 --- a/google/ads/googleads/v6/errors/types/third_party_app_analytics_link_error.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"ThirdPartyAppAnalyticsLinkErrorEnum",}, -) - - -class ThirdPartyAppAnalyticsLinkErrorEnum(proto.Message): - r"""Container for enum describing possible third party app - analytics link errors. - """ - - class ThirdPartyAppAnalyticsLinkError(proto.Enum): - r"""Enum describing possible third party app analytics link - errors. - """ - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_ANALYTICS_PROVIDER_ID = 2 - INVALID_MOBILE_APP_ID = 3 - MOBILE_APP_IS_NOT_ENABLED = 4 - CANNOT_REGENERATE_SHAREABLE_LINK_ID_FOR_REMOVED_LINK = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/time_zone_error.py b/google/ads/googleads/v6/errors/types/time_zone_error.py deleted file mode 100644 index bbd358d68..000000000 --- a/google/ads/googleads/v6/errors/types/time_zone_error.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"TimeZoneErrorEnum",}, -) - - -class TimeZoneErrorEnum(proto.Message): - r"""Container for enum describing possible time zone errors.""" - - class TimeZoneError(proto.Enum): - r"""Enum describing possible currency code errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_TIME_ZONE = 5 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/url_field_error.py b/google/ads/googleads/v6/errors/types/url_field_error.py deleted file mode 100644 index ad88b5c8c..000000000 --- a/google/ads/googleads/v6/errors/types/url_field_error.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"UrlFieldErrorEnum",}, -) - - -class UrlFieldErrorEnum(proto.Message): - r"""Container for enum describing possible url field errors.""" - - class UrlFieldError(proto.Enum): - r"""Enum describing possible url field errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - INVALID_TRACKING_URL_TEMPLATE = 2 - INVALID_TAG_IN_TRACKING_URL_TEMPLATE = 3 - MISSING_TRACKING_URL_TEMPLATE_TAG = 4 - MISSING_PROTOCOL_IN_TRACKING_URL_TEMPLATE = 5 - INVALID_PROTOCOL_IN_TRACKING_URL_TEMPLATE = 6 - MALFORMED_TRACKING_URL_TEMPLATE = 7 - MISSING_HOST_IN_TRACKING_URL_TEMPLATE = 8 - INVALID_TLD_IN_TRACKING_URL_TEMPLATE = 9 - REDUNDANT_NESTED_TRACKING_URL_TEMPLATE_TAG = 10 - INVALID_FINAL_URL = 11 - INVALID_TAG_IN_FINAL_URL = 12 - REDUNDANT_NESTED_FINAL_URL_TAG = 13 - MISSING_PROTOCOL_IN_FINAL_URL = 14 - INVALID_PROTOCOL_IN_FINAL_URL = 15 - MALFORMED_FINAL_URL = 16 - MISSING_HOST_IN_FINAL_URL = 17 - INVALID_TLD_IN_FINAL_URL = 18 - INVALID_FINAL_MOBILE_URL = 19 - INVALID_TAG_IN_FINAL_MOBILE_URL = 20 - REDUNDANT_NESTED_FINAL_MOBILE_URL_TAG = 21 - MISSING_PROTOCOL_IN_FINAL_MOBILE_URL = 22 - INVALID_PROTOCOL_IN_FINAL_MOBILE_URL = 23 - MALFORMED_FINAL_MOBILE_URL = 24 - MISSING_HOST_IN_FINAL_MOBILE_URL = 25 - INVALID_TLD_IN_FINAL_MOBILE_URL = 26 - INVALID_FINAL_APP_URL = 27 - INVALID_TAG_IN_FINAL_APP_URL = 28 - REDUNDANT_NESTED_FINAL_APP_URL_TAG = 29 - MULTIPLE_APP_URLS_FOR_OSTYPE = 30 - INVALID_OSTYPE = 31 - INVALID_PROTOCOL_FOR_APP_URL = 32 - INVALID_PACKAGE_ID_FOR_APP_URL = 33 - URL_CUSTOM_PARAMETERS_COUNT_EXCEEDS_LIMIT = 34 - INVALID_CHARACTERS_IN_URL_CUSTOM_PARAMETER_KEY = 39 - INVALID_CHARACTERS_IN_URL_CUSTOM_PARAMETER_VALUE = 40 - INVALID_TAG_IN_URL_CUSTOM_PARAMETER_VALUE = 41 - REDUNDANT_NESTED_URL_CUSTOM_PARAMETER_TAG = 42 - MISSING_PROTOCOL = 43 - INVALID_PROTOCOL = 52 - INVALID_URL = 44 - DESTINATION_URL_DEPRECATED = 45 - INVALID_TAG_IN_URL = 46 - MISSING_URL_TAG = 47 - DUPLICATE_URL_ID = 48 - INVALID_URL_ID = 49 - FINAL_URL_SUFFIX_MALFORMED = 50 - INVALID_TAG_IN_FINAL_URL_SUFFIX = 51 - INVALID_TOP_LEVEL_DOMAIN = 53 - MALFORMED_TOP_LEVEL_DOMAIN = 54 - MALFORMED_URL = 55 - MISSING_HOST = 56 - NULL_CUSTOM_PARAMETER_VALUE = 57 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/user_data_error.py b/google/ads/googleads/v6/errors/types/user_data_error.py deleted file mode 100644 index f1c614a3f..000000000 --- a/google/ads/googleads/v6/errors/types/user_data_error.py +++ /dev/null @@ -1,40 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"UserDataErrorEnum",}, -) - - -class UserDataErrorEnum(proto.Message): - r"""Container for enum describing possible user data errors.""" - - class UserDataError(proto.Enum): - r"""Enum describing possible request errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - OPERATIONS_FOR_CUSTOMER_MATCH_NOT_ALLOWED = 2 - TOO_MANY_USER_IDENTIFIERS = 3 - USER_LIST_NOT_APPLICABLE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/user_list_error.py b/google/ads/googleads/v6/errors/types/user_list_error.py deleted file mode 100644 index 50574bf5f..000000000 --- a/google/ads/googleads/v6/errors/types/user_list_error.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"UserListErrorEnum",}, -) - - -class UserListErrorEnum(proto.Message): - r"""Container for enum describing possible user list errors.""" - - class UserListError(proto.Enum): - r"""Enum describing possible user list errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - EXTERNAL_REMARKETING_USER_LIST_MUTATE_NOT_SUPPORTED = 2 - CONCRETE_TYPE_REQUIRED = 3 - CONVERSION_TYPE_ID_REQUIRED = 4 - DUPLICATE_CONVERSION_TYPES = 5 - INVALID_CONVERSION_TYPE = 6 - INVALID_DESCRIPTION = 7 - INVALID_NAME = 8 - INVALID_TYPE = 9 - CAN_NOT_ADD_LOGICAL_LIST_AS_LOGICAL_LIST_OPERAND = 10 - INVALID_USER_LIST_LOGICAL_RULE_OPERAND = 11 - NAME_ALREADY_USED = 12 - NEW_CONVERSION_TYPE_NAME_REQUIRED = 13 - CONVERSION_TYPE_NAME_ALREADY_USED = 14 - OWNERSHIP_REQUIRED_FOR_SET = 15 - USER_LIST_MUTATE_NOT_SUPPORTED = 16 - INVALID_RULE = 17 - INVALID_DATE_RANGE = 27 - CAN_NOT_MUTATE_SENSITIVE_USERLIST = 28 - MAX_NUM_RULEBASED_USERLISTS = 29 - CANNOT_MODIFY_BILLABLE_RECORD_COUNT = 30 - APP_ID_NOT_SET = 31 - USERLIST_NAME_IS_RESERVED_FOR_SYSTEM_LIST = 32 - ADVERTISER_NOT_ON_ALLOWLIST_FOR_USING_UPLOADED_DATA = 37 - RULE_TYPE_IS_NOT_SUPPORTED = 34 - CAN_NOT_ADD_A_SIMILAR_USERLIST_AS_LOGICAL_LIST_OPERAND = 35 - CAN_NOT_MIX_CRM_BASED_IN_LOGICAL_LIST_WITH_OTHER_LISTS = 36 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/youtube_video_registration_error.py b/google/ads/googleads/v6/errors/types/youtube_video_registration_error.py deleted file mode 100644 index ec05afc0d..000000000 --- a/google/ads/googleads/v6/errors/types/youtube_video_registration_error.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"YoutubeVideoRegistrationErrorEnum",}, -) - - -class YoutubeVideoRegistrationErrorEnum(proto.Message): - r"""Container for enum describing YouTube video registration - errors. - """ - - class YoutubeVideoRegistrationError(proto.Enum): - r"""Enum describing YouTube video registration errors.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - VIDEO_NOT_FOUND = 2 - VIDEO_NOT_ACCESSIBLE = 3 - VIDEO_NOT_ELIGIBLE = 4 - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/__init__.py b/google/ads/googleads/v6/resources/__init__.py deleted file mode 100644 index e47176e13..000000000 --- a/google/ads/googleads/v6/resources/__init__.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - - -__all__ = ( - "AccountBudgetProposal", - "AccountLink", - "Ad", - "AdGroup", - "AdGroupAd", - "AdGroupAdAssetPolicySummary", - "AdGroupAdAssetView", - "AdGroupAdLabel", - "AdGroupAdPolicySummary", - "AdGroupAudienceView", - "AdGroupBidModifier", - "AdGroupCriterion", - "AdGroupCriterionLabel", - "AdGroupCriterionSimulation", - "AdGroupExtensionSetting", - "AdGroupFeed", - "AdGroupLabel", - "AdGroupSimulation", - "AdParameter", - "AdScheduleView", - "AgeRangeView", - "Asset", - "AssetPolicySummary", - "AttributeFieldMapping", - "BatchJob", - "BiddingStrategy", - "BillingSetup", - "CallReportingSetting", - "CallView", - "Campaign", - "CampaignAsset", - "CampaignAudienceView", - "CampaignBidModifier", - "CampaignBudget", - "CampaignCriterion", - "CampaignCriterionSimulation", - "CampaignDraft", - "CampaignExperiment", - "CampaignExtensionSetting", - "CampaignFeed", - "CampaignLabel", - "CampaignSharedSet", - "CarrierConstant", - "ChangeEvent", - "ChangeStatus", - "ClickView", - "CombinedAudience", - "ConversionAction", - "ConversionTrackingSetting", - "CurrencyConstant", - "CustomAudience", - "CustomAudienceMember", - "CustomInterest", - "CustomInterestMember", - "Customer", - "CustomerClient", - "CustomerClientLink", - "CustomerExtensionSetting", - "CustomerFeed", - "CustomerLabel", - "CustomerManagerLink", - "CustomerNegativeCriterion", - "CustomerUserAccess", - "CustomerUserAccessInvitation", - "DataPartnerLinkIdentifier", - "DetailPlacementView", - "DisplayKeywordView", - "DistanceView", - "DomainCategory", - "DynamicSearchAdsSearchTermView", - "ExpandedLandingPageView", - "ExtensionFeedItem", - "Feed", - "FeedAttribute", - "FeedAttributeOperation", - "FeedItem", - "FeedItemAttributeValue", - "FeedItemPlaceholderPolicyInfo", - "FeedItemSet", - "FeedItemSetLink", - "FeedItemTarget", - "FeedItemValidationError", - "FeedMapping", - "FeedPlaceholderView", - "GenderView", - "GeoTargetConstant", - "GeographicView", - "GoogleAdsField", - "GoogleAdsLinkIdentifier", - "GroupPlacementView", - "HotelGroupView", - "HotelPerformanceView", - "IncomeRangeView", - "Invoice", - "KeywordPlan", - "KeywordPlanAdGroup", - "KeywordPlanAdGroupKeyword", - "KeywordPlanCampaign", - "KeywordPlanCampaignKeyword", - "KeywordPlanForecastPeriod", - "KeywordPlanGeoTarget", - "KeywordView", - "Label", - "LandingPageView", - "LanguageConstant", - "LocationView", - "ManagedPlacementView", - "MediaAudio", - "MediaBundle", - "MediaFile", - "MediaImage", - "MediaVideo", - "MerchantCenterLink", - "MobileAppCategoryConstant", - "MobileDeviceConstant", - "OfflineUserDataJob", - "OperatingSystemVersionConstant", - "PaidOrganicSearchTermView", - "ParentalStatusView", - "PaymentsAccount", - "ProductBiddingCategoryConstant", - "ProductGroupView", - "Recommendation", - "RemarketingAction", - "RemarketingSetting", - "SearchTermView", - "SharedCriterion", - "SharedSet", - "ShoppingPerformanceView", - "ThirdPartyAppAnalyticsLink", - "ThirdPartyAppAnalyticsLinkIdentifier", - "TopicConstant", - "TopicView", - "UserInterest", - "UserList", - "UserLocationView", - "Video", - "AccountBudget", -) diff --git a/google/ads/googleads/v6/resources/services/__init__.py b/google/ads/googleads/v6/resources/services/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/resources/services/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/resources/types/__init__.py b/google/ads/googleads/v6/resources/types/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/resources/types/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/resources/types/account_budget.py b/google/ads/googleads/v6/resources/types/account_budget.py deleted file mode 100644 index fde983fdc..000000000 --- a/google/ads/googleads/v6/resources/types/account_budget.py +++ /dev/null @@ -1,306 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import account_budget_proposal_type -from google.ads.googleads.v6.enums.types import account_budget_status -from google.ads.googleads.v6.enums.types import ( - spending_limit_type as gage_spending_limit_type, -) -from google.ads.googleads.v6.enums.types import time_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AccountBudget",}, -) - - -class AccountBudget(proto.Message): - r"""An account-level budget. It contains information about the budget - itself, as well as the most recently approved changes to the budget - and proposed changes that are pending approval. The proposed changes - that are pending approval, if any, are found in 'pending_proposal'. - Effective details about the budget are found in fields prefixed - 'approved_', 'adjusted_' and those without a prefix. Since some - effective details may differ from what the user had originally - requested (e.g. spending limit), these differences are juxtaposed - via 'proposed_', 'approved_', and possibly 'adjusted_' fields. - - This resource is mutated using AccountBudgetProposal and cannot be - mutated directly. A budget may have at most one pending proposal at - any given time. It is read through pending_proposal. - - Once approved, a budget may be subject to adjustments, such as - credit adjustments. Adjustments create differences between the - 'approved' and 'adjusted' fields, which would otherwise be - identical. - - Attributes: - resource_name (str): - Output only. The resource name of the account-level budget. - AccountBudget resource names have the form: - - ``customers/{customer_id}/accountBudgets/{account_budget_id}`` - id (int): - Output only. The ID of the account-level - budget. - billing_setup (str): - Output only. The resource name of the billing setup - associated with this account-level budget. BillingSetup - resource names have the form: - - ``customers/{customer_id}/billingSetups/{billing_setup_id}`` - status (google.ads.googleads.v6.enums.types.AccountBudgetStatusEnum.AccountBudgetStatus): - Output only. The status of this account-level - budget. - name (str): - Output only. The name of the account-level - budget. - proposed_start_date_time (str): - Output only. The proposed start time of the - account-level budget in yyyy-MM-dd HH:mm:ss - format. If a start time type of NOW was - proposed, this is the time of request. - approved_start_date_time (str): - Output only. The approved start time of the - account-level budget in yyyy-MM-dd HH:mm:ss - format. - For example, if a new budget is approved after - the proposed start time, the approved start time - is the time of approval. - total_adjustments_micros (int): - Output only. The total adjustments amount. - An example of an adjustment is courtesy credits. - amount_served_micros (int): - Output only. The value of Ads that have been served, in - micros. - - This includes overdelivery costs, in which case a credit - might be automatically applied to the budget (see - total_adjustments_micros). - purchase_order_number (str): - Output only. A purchase order number is a - value that helps users reference this budget in - their monthly invoices. - notes (str): - Output only. Notes associated with the - budget. - pending_proposal (google.ads.googleads.v6.resources.types.AccountBudget.PendingAccountBudgetProposal): - Output only. The pending proposal to modify - this budget, if applicable. - proposed_end_date_time (str): - Output only. The proposed end time in yyyy- - M-dd HH:mm:ss format. - proposed_end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Output only. The proposed end time as a well- - efined type, e.g. FOREVER. - approved_end_date_time (str): - Output only. The approved end time in yyyy- - M-dd HH:mm:ss format. - approved_end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Output only. The approved end time as a well- - efined type, e.g. FOREVER. - proposed_spending_limit_micros (int): - Output only. The proposed spending limit in - micros. One million is equivalent to one unit. - proposed_spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Output only. The proposed spending limit as a - well-defined type, e.g. INFINITE. - approved_spending_limit_micros (int): - Output only. The approved spending limit in - micros. One million is equivalent to one unit. - This will only be populated if the proposed - spending limit is finite, and will always be - greater than or equal to the proposed spending - limit. - approved_spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Output only. The approved spending limit as a - well-defined type, e.g. INFINITE. This will - only be populated if the approved spending limit - is INFINITE. - adjusted_spending_limit_micros (int): - Output only. The adjusted spending limit in - micros. One million is equivalent to one unit. - If the approved spending limit is finite, the - adjusted spending limit may vary depending on - the types of adjustments applied to this budget, - if applicable. - - The different kinds of adjustments are described - here: https://support.google.com/google- - ads/answer/1704323 - For example, a debit adjustment reduces how much - the account is allowed to spend. - adjusted_spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Output only. The adjusted spending limit as a - well-defined type, e.g. INFINITE. This will only - be populated if the adjusted spending limit is - INFINITE, which is guaranteed to be true if the - approved spending limit is INFINITE. - """ - - class PendingAccountBudgetProposal(proto.Message): - r"""A pending proposal associated with the enclosing account- - evel budget, if applicable. - - Attributes: - account_budget_proposal (str): - Output only. The resource name of the proposal. - AccountBudgetProposal resource names have the form: - - ``customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}`` - proposal_type (google.ads.googleads.v6.enums.types.AccountBudgetProposalTypeEnum.AccountBudgetProposalType): - Output only. The type of this proposal, e.g. - END to end the budget associated with this - proposal. - name (str): - Output only. The name to assign to the - account-level budget. - start_date_time (str): - Output only. The start time in yyyy-MM-dd - HH:mm:ss format. - purchase_order_number (str): - Output only. A purchase order number is a - value that helps users reference this budget in - their monthly invoices. - notes (str): - Output only. Notes associated with this - budget. - creation_date_time (str): - Output only. The time when this account-level - budget proposal was created. Formatted as yyyy- - MM-dd HH:mm:ss. - end_date_time (str): - Output only. The end time in yyyy-MM-dd - HH:mm:ss format. - end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Output only. The end time as a well-defined - type, e.g. FOREVER. - spending_limit_micros (int): - Output only. The spending limit in micros. - One million is equivalent to one unit. - spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Output only. The spending limit as a well- - efined type, e.g. INFINITE. - """ - - account_budget_proposal = proto.Field( - proto.STRING, number=12, optional=True - ) - proposal_type = proto.Field( - proto.ENUM, - number=2, - enum=account_budget_proposal_type.AccountBudgetProposalTypeEnum.AccountBudgetProposalType, - ) - name = proto.Field(proto.STRING, number=13, optional=True) - start_date_time = proto.Field(proto.STRING, number=14, optional=True) - purchase_order_number = proto.Field( - proto.STRING, number=17, optional=True - ) - notes = proto.Field(proto.STRING, number=18, optional=True) - creation_date_time = proto.Field(proto.STRING, number=19, optional=True) - end_date_time = proto.Field(proto.STRING, number=15, oneof="end_time") - end_time_type = proto.Field( - proto.ENUM, - number=6, - oneof="end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - spending_limit_micros = proto.Field( - proto.INT64, number=16, oneof="spending_limit" - ) - spending_limit_type = proto.Field( - proto.ENUM, - number=8, - oneof="spending_limit", - enum=gage_spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=23, optional=True) - billing_setup = proto.Field(proto.STRING, number=24, optional=True) - status = proto.Field( - proto.ENUM, - number=4, - enum=account_budget_status.AccountBudgetStatusEnum.AccountBudgetStatus, - ) - name = proto.Field(proto.STRING, number=25, optional=True) - proposed_start_date_time = proto.Field( - proto.STRING, number=26, optional=True - ) - approved_start_date_time = proto.Field( - proto.STRING, number=27, optional=True - ) - total_adjustments_micros = proto.Field(proto.INT64, number=33) - amount_served_micros = proto.Field(proto.INT64, number=34) - purchase_order_number = proto.Field(proto.STRING, number=35, optional=True) - notes = proto.Field(proto.STRING, number=36, optional=True) - pending_proposal = proto.Field( - proto.MESSAGE, number=22, message=PendingAccountBudgetProposal, - ) - proposed_end_date_time = proto.Field( - proto.STRING, number=28, oneof="proposed_end_time" - ) - proposed_end_time_type = proto.Field( - proto.ENUM, - number=9, - oneof="proposed_end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - approved_end_date_time = proto.Field( - proto.STRING, number=29, oneof="approved_end_time" - ) - approved_end_time_type = proto.Field( - proto.ENUM, - number=11, - oneof="approved_end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - proposed_spending_limit_micros = proto.Field( - proto.INT64, number=30, oneof="proposed_spending_limit" - ) - proposed_spending_limit_type = proto.Field( - proto.ENUM, - number=13, - oneof="proposed_spending_limit", - enum=gage_spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - approved_spending_limit_micros = proto.Field( - proto.INT64, number=31, oneof="approved_spending_limit" - ) - approved_spending_limit_type = proto.Field( - proto.ENUM, - number=15, - oneof="approved_spending_limit", - enum=gage_spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - adjusted_spending_limit_micros = proto.Field( - proto.INT64, number=32, oneof="adjusted_spending_limit" - ) - adjusted_spending_limit_type = proto.Field( - proto.ENUM, - number=17, - oneof="adjusted_spending_limit", - enum=gage_spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/account_budget_proposal.py b/google/ads/googleads/v6/resources/types/account_budget_proposal.py deleted file mode 100644 index a3ac013e3..000000000 --- a/google/ads/googleads/v6/resources/types/account_budget_proposal.py +++ /dev/null @@ -1,190 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import account_budget_proposal_status -from google.ads.googleads.v6.enums.types import account_budget_proposal_type -from google.ads.googleads.v6.enums.types import spending_limit_type -from google.ads.googleads.v6.enums.types import time_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AccountBudgetProposal",}, -) - - -class AccountBudgetProposal(proto.Message): - r"""An account-level budget proposal. - - All fields prefixed with 'proposed' may not necessarily be applied - directly. For example, proposed spending limits may be adjusted - before their application. This is true if the 'proposed' field has - an 'approved' counterpart, e.g. spending limits. - - Please note that the proposal type (proposal_type) changes which - fields are required and which must remain empty. - - Attributes: - resource_name (str): - Immutable. The resource name of the proposal. - AccountBudgetProposal resource names have the form: - - ``customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}`` - id (int): - Output only. The ID of the proposal. - billing_setup (str): - Immutable. The resource name of the billing - setup associated with this proposal. - account_budget (str): - Immutable. The resource name of the account- - evel budget associated with this proposal. - proposal_type (google.ads.googleads.v6.enums.types.AccountBudgetProposalTypeEnum.AccountBudgetProposalType): - Immutable. The type of this proposal, e.g. - END to end the budget associated with this - proposal. - status (google.ads.googleads.v6.enums.types.AccountBudgetProposalStatusEnum.AccountBudgetProposalStatus): - Output only. The status of this proposal. - When a new proposal is created, the status - defaults to PENDING. - proposed_name (str): - Immutable. The name to assign to the account- - evel budget. - approved_start_date_time (str): - Output only. The approved start date time in - yyyy-mm-dd hh:mm:ss format. - proposed_purchase_order_number (str): - Immutable. A purchase order number is a value - that enables the user to help them reference - this budget in their monthly invoices. - proposed_notes (str): - Immutable. Notes associated with this budget. - creation_date_time (str): - Output only. The date time when this account- - evel budget proposal was created, which is not - the same as its approval date time, if - applicable. - approval_date_time (str): - Output only. The date time when this account- - evel budget was approved, if applicable. - proposed_start_date_time (str): - Immutable. The proposed start date time in - yyyy-mm-dd hh:mm:ss format. - proposed_start_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Immutable. The proposed start date time as a - well-defined type, e.g. NOW. - proposed_end_date_time (str): - Immutable. The proposed end date time in - yyyy-mm-dd hh:mm:ss format. - proposed_end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Immutable. The proposed end date time as a - well-defined type, e.g. FOREVER. - approved_end_date_time (str): - Output only. The approved end date time in - yyyy-mm-dd hh:mm:ss format. - approved_end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Output only. The approved end date time as a - well-defined type, e.g. FOREVER. - proposed_spending_limit_micros (int): - Immutable. The proposed spending limit in - micros. One million is equivalent to one unit. - proposed_spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Immutable. The proposed spending limit as a - well-defined type, e.g. INFINITE. - approved_spending_limit_micros (int): - Output only. The approved spending limit in - micros. One million is equivalent to one unit. - approved_spending_limit_type (google.ads.googleads.v6.enums.types.SpendingLimitTypeEnum.SpendingLimitType): - Output only. The approved spending limit as a - well-defined type, e.g. INFINITE. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=25, optional=True) - billing_setup = proto.Field(proto.STRING, number=26, optional=True) - account_budget = proto.Field(proto.STRING, number=27, optional=True) - proposal_type = proto.Field( - proto.ENUM, - number=4, - enum=account_budget_proposal_type.AccountBudgetProposalTypeEnum.AccountBudgetProposalType, - ) - status = proto.Field( - proto.ENUM, - number=15, - enum=account_budget_proposal_status.AccountBudgetProposalStatusEnum.AccountBudgetProposalStatus, - ) - proposed_name = proto.Field(proto.STRING, number=28, optional=True) - approved_start_date_time = proto.Field( - proto.STRING, number=30, optional=True - ) - proposed_purchase_order_number = proto.Field( - proto.STRING, number=35, optional=True - ) - proposed_notes = proto.Field(proto.STRING, number=36, optional=True) - creation_date_time = proto.Field(proto.STRING, number=37, optional=True) - approval_date_time = proto.Field(proto.STRING, number=38, optional=True) - proposed_start_date_time = proto.Field( - proto.STRING, number=29, oneof="proposed_start_time" - ) - proposed_start_time_type = proto.Field( - proto.ENUM, - number=7, - oneof="proposed_start_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - proposed_end_date_time = proto.Field( - proto.STRING, number=31, oneof="proposed_end_time" - ) - proposed_end_time_type = proto.Field( - proto.ENUM, - number=9, - oneof="proposed_end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - approved_end_date_time = proto.Field( - proto.STRING, number=32, oneof="approved_end_time" - ) - approved_end_time_type = proto.Field( - proto.ENUM, - number=22, - oneof="approved_end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - proposed_spending_limit_micros = proto.Field( - proto.INT64, number=33, oneof="proposed_spending_limit" - ) - proposed_spending_limit_type = proto.Field( - proto.ENUM, - number=11, - oneof="proposed_spending_limit", - enum=spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - approved_spending_limit_micros = proto.Field( - proto.INT64, number=34, oneof="approved_spending_limit" - ) - approved_spending_limit_type = proto.Field( - proto.ENUM, - number=24, - oneof="approved_spending_limit", - enum=spending_limit_type.SpendingLimitTypeEnum.SpendingLimitType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/account_link.py b/google/ads/googleads/v6/resources/types/account_link.py deleted file mode 100644 index abf73cd9b..000000000 --- a/google/ads/googleads/v6/resources/types/account_link.py +++ /dev/null @@ -1,168 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import account_link_status -from google.ads.googleads.v6.enums.types import linked_account_type -from google.ads.googleads.v6.enums.types import mobile_app_vendor - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={ - "AccountLink", - "ThirdPartyAppAnalyticsLinkIdentifier", - "DataPartnerLinkIdentifier", - "GoogleAdsLinkIdentifier", - }, -) - - -class AccountLink(proto.Message): - r"""Represents the data sharing connection between a Google Ads - account and another account - - Attributes: - resource_name (str): - Immutable. Resource name of the account link. AccountLink - resource names have the form: - ``customers/{customer_id}/accountLinks/{account_link_id}`` - account_link_id (int): - Output only. The ID of the link. - This field is read only. - status (google.ads.googleads.v6.enums.types.AccountLinkStatusEnum.AccountLinkStatus): - The status of the link. - type_ (google.ads.googleads.v6.enums.types.LinkedAccountTypeEnum.LinkedAccountType): - Output only. The type of the linked account. - third_party_app_analytics (google.ads.googleads.v6.resources.types.ThirdPartyAppAnalyticsLinkIdentifier): - Immutable. A third party app analytics link. - data_partner (google.ads.googleads.v6.resources.types.DataPartnerLinkIdentifier): - Output only. Data partner link. - google_ads (google.ads.googleads.v6.resources.types.GoogleAdsLinkIdentifier): - Output only. Google Ads link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - account_link_id = proto.Field(proto.INT64, number=8, optional=True) - status = proto.Field( - proto.ENUM, - number=3, - enum=account_link_status.AccountLinkStatusEnum.AccountLinkStatus, - ) - type_ = proto.Field( - proto.ENUM, - number=4, - enum=linked_account_type.LinkedAccountTypeEnum.LinkedAccountType, - ) - third_party_app_analytics = proto.Field( - proto.MESSAGE, - number=5, - oneof="linked_account", - message="ThirdPartyAppAnalyticsLinkIdentifier", - ) - data_partner = proto.Field( - proto.MESSAGE, - number=6, - oneof="linked_account", - message="DataPartnerLinkIdentifier", - ) - google_ads = proto.Field( - proto.MESSAGE, - number=7, - oneof="linked_account", - message="GoogleAdsLinkIdentifier", - ) - - -class ThirdPartyAppAnalyticsLinkIdentifier(proto.Message): - r"""The identifiers of a Third Party App Analytics Link. - - Attributes: - app_analytics_provider_id (int): - Immutable. The ID of the app analytics - provider. This field should not be empty when - creating a new third party app analytics link. - It is unable to be modified after the creation - of the link. - app_id (str): - Immutable. A string that uniquely identifies - a mobile application from which the data was - collected to the Google Ads API. For iOS, the ID - string is the 9 digit string that appears at the - end of an App Store URL (e.g., "422689480" for - "Gmail" whose App Store link is - https://apps.apple.com/us/app/gmail-email-by- - google/id422689480). For Android, the ID string - is the application's package name (e.g., - "com.google.android.gm" for "Gmail" given Google - Play link - https://play.google.com/store/apps/details?id=com.google.android.gm) - This field should not be empty when creating a - new third party app analytics link. It is unable - to be modified after the creation of the link. - app_vendor (google.ads.googleads.v6.enums.types.MobileAppVendorEnum.MobileAppVendor): - Immutable. The vendor of the app. - This field should not be empty when creating a - new third party app analytics link. It is unable - to be modified after the creation of the link. - """ - - app_analytics_provider_id = proto.Field( - proto.INT64, number=4, optional=True - ) - app_id = proto.Field(proto.STRING, number=5, optional=True) - app_vendor = proto.Field( - proto.ENUM, - number=3, - enum=mobile_app_vendor.MobileAppVendorEnum.MobileAppVendor, - ) - - -class DataPartnerLinkIdentifier(proto.Message): - r"""The identifier for Data Partner account. - - Attributes: - data_partner_id (int): - Immutable. The customer ID of the Data - partner account. This field is required and - should not be empty when creating a new data - partner link. It is unable to be modified after - the creation of the link. - """ - - data_partner_id = proto.Field(proto.INT64, number=1, optional=True) - - -class GoogleAdsLinkIdentifier(proto.Message): - r"""The identifier for Google Ads account. - - Attributes: - customer (str): - Immutable. The resource name of the Google - Ads account. This field is required and should - not be empty when creating a new Google Ads - link. It is unable to be modified after the - creation of the link. - """ - - customer = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad.py b/google/ads/googleads/v6/resources/types/ad.py deleted file mode 100644 index 85a7d4e8a..000000000 --- a/google/ads/googleads/v6/resources/types/ad.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import ad_type_infos -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.common.types import final_app_url -from google.ads.googleads.v6.common.types import url_collection -from google.ads.googleads.v6.enums.types import ad_type -from google.ads.googleads.v6.enums.types import device -from google.ads.googleads.v6.enums.types import system_managed_entity_source - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Ad",}, -) - - -class Ad(proto.Message): - r"""An ad. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad. Ad resource names - have the form: - - ``customers/{customer_id}/ads/{ad_id}`` - id (int): - Output only. The ID of the ad. - final_urls (Sequence[str]): - The list of possible final URLs after all - cross-domain redirects for the ad. - final_app_urls (Sequence[google.ads.googleads.v6.common.types.FinalAppUrl]): - A list of final app URLs that will be used on - mobile if the user has the specific app - installed. - final_mobile_urls (Sequence[str]): - The list of possible final mobile URLs after - all cross-domain redirects for the ad. - tracking_url_template (str): - The URL template for constructing a tracking - URL. - final_url_suffix (str): - The suffix to use when constructing a final - URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - The list of mappings that can be used to substitute custom - parameter tags in a ``tracking_url_template``, - ``final_urls``, or ``mobile_final_urls``. For mutates, - please use url custom parameter operations. - display_url (str): - The URL that appears in the ad description - for some ad formats. - type_ (google.ads.googleads.v6.enums.types.AdTypeEnum.AdType): - Output only. The type of ad. - added_by_google_ads (bool): - Output only. Indicates if this ad was - automatically added by Google Ads and not by a - user. For example, this could happen when ads - are automatically created as suggestions for new - ads based on knowledge of how existing ads are - performing. - device_preference (google.ads.googleads.v6.enums.types.DeviceEnum.Device): - The device preference for the ad. You can - only specify a preference for mobile devices. - When this preference is set the ad will be - preferred over other ads when being displayed on - a mobile device. The ad can still be displayed - on other device types, e.g. if no other ads are - available. If unspecified (no device - preference), all devices are targeted. This is - only supported by some ad types. - url_collections (Sequence[google.ads.googleads.v6.common.types.UrlCollection]): - Additional URLs for the ad that are tagged - with a unique identifier that can be referenced - from other fields in the ad. - name (str): - Immutable. The name of the ad. This is only - used to be able to identify the ad. It does not - need to be unique and does not affect the served - ad. The name field is currently only supported - for DisplayUploadAd, ImageAd, - ShoppingComparisonListingAd and VideoAd. - system_managed_resource_source (google.ads.googleads.v6.enums.types.SystemManagedResourceSourceEnum.SystemManagedResourceSource): - Output only. If this ad is system managed, - then this field will indicate the source. This - field is read-only. - text_ad (google.ads.googleads.v6.common.types.TextAdInfo): - Immutable. Details pertaining to a text ad. - expanded_text_ad (google.ads.googleads.v6.common.types.ExpandedTextAdInfo): - Details pertaining to an expanded text ad. - call_only_ad (google.ads.googleads.v6.common.types.CallOnlyAdInfo): - Details pertaining to a call-only ad. - expanded_dynamic_search_ad (google.ads.googleads.v6.common.types.ExpandedDynamicSearchAdInfo): - Immutable. Details pertaining to an Expanded Dynamic Search - Ad. This type of ad has its headline, final URLs, and - display URL auto-generated at serving time according to - domain name specific information provided by - ``dynamic_search_ads_setting`` linked at the campaign level. - hotel_ad (google.ads.googleads.v6.common.types.HotelAdInfo): - Details pertaining to a hotel ad. - shopping_smart_ad (google.ads.googleads.v6.common.types.ShoppingSmartAdInfo): - Details pertaining to a Smart Shopping ad. - shopping_product_ad (google.ads.googleads.v6.common.types.ShoppingProductAdInfo): - Details pertaining to a Shopping product ad. - gmail_ad (google.ads.googleads.v6.common.types.GmailAdInfo): - Immutable. Details pertaining to a Gmail ad. - image_ad (google.ads.googleads.v6.common.types.ImageAdInfo): - Immutable. Details pertaining to an Image ad. - video_ad (google.ads.googleads.v6.common.types.VideoAdInfo): - Details pertaining to a Video ad. - video_responsive_ad (google.ads.googleads.v6.common.types.VideoResponsiveAdInfo): - Details pertaining to a Video responsive ad. - responsive_search_ad (google.ads.googleads.v6.common.types.ResponsiveSearchAdInfo): - Details pertaining to a responsive search ad. - legacy_responsive_display_ad (google.ads.googleads.v6.common.types.LegacyResponsiveDisplayAdInfo): - Details pertaining to a legacy responsive - display ad. - app_ad (google.ads.googleads.v6.common.types.AppAdInfo): - Details pertaining to an app ad. - legacy_app_install_ad (google.ads.googleads.v6.common.types.LegacyAppInstallAdInfo): - Immutable. Details pertaining to a legacy app - install ad. - responsive_display_ad (google.ads.googleads.v6.common.types.ResponsiveDisplayAdInfo): - Details pertaining to a responsive display - ad. - local_ad (google.ads.googleads.v6.common.types.LocalAdInfo): - Details pertaining to a local ad. - display_upload_ad (google.ads.googleads.v6.common.types.DisplayUploadAdInfo): - Details pertaining to a display upload ad. - app_engagement_ad (google.ads.googleads.v6.common.types.AppEngagementAdInfo): - Details pertaining to an app engagement ad. - shopping_comparison_listing_ad (google.ads.googleads.v6.common.types.ShoppingComparisonListingAdInfo): - Details pertaining to a Shopping Comparison - Listing ad. - """ - - resource_name = proto.Field(proto.STRING, number=37) - id = proto.Field(proto.INT64, number=40, optional=True) - final_urls = proto.RepeatedField(proto.STRING, number=41) - final_app_urls = proto.RepeatedField( - proto.MESSAGE, number=35, message=final_app_url.FinalAppUrl, - ) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=42) - tracking_url_template = proto.Field(proto.STRING, number=43, optional=True) - final_url_suffix = proto.Field(proto.STRING, number=44, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=10, message=custom_parameter.CustomParameter, - ) - display_url = proto.Field(proto.STRING, number=45, optional=True) - type_ = proto.Field(proto.ENUM, number=5, enum=ad_type.AdTypeEnum.AdType,) - added_by_google_ads = proto.Field(proto.BOOL, number=46, optional=True) - device_preference = proto.Field( - proto.ENUM, number=20, enum=device.DeviceEnum.Device, - ) - url_collections = proto.RepeatedField( - proto.MESSAGE, number=26, message=url_collection.UrlCollection, - ) - name = proto.Field(proto.STRING, number=47, optional=True) - system_managed_resource_source = proto.Field( - proto.ENUM, - number=27, - enum=system_managed_entity_source.SystemManagedResourceSourceEnum.SystemManagedResourceSource, - ) - text_ad = proto.Field( - proto.MESSAGE, - number=6, - oneof="ad_data", - message=ad_type_infos.TextAdInfo, - ) - expanded_text_ad = proto.Field( - proto.MESSAGE, - number=7, - oneof="ad_data", - message=ad_type_infos.ExpandedTextAdInfo, - ) - call_only_ad = proto.Field( - proto.MESSAGE, - number=13, - oneof="ad_data", - message=ad_type_infos.CallOnlyAdInfo, - ) - expanded_dynamic_search_ad = proto.Field( - proto.MESSAGE, - number=14, - oneof="ad_data", - message=ad_type_infos.ExpandedDynamicSearchAdInfo, - ) - hotel_ad = proto.Field( - proto.MESSAGE, - number=15, - oneof="ad_data", - message=ad_type_infos.HotelAdInfo, - ) - shopping_smart_ad = proto.Field( - proto.MESSAGE, - number=17, - oneof="ad_data", - message=ad_type_infos.ShoppingSmartAdInfo, - ) - shopping_product_ad = proto.Field( - proto.MESSAGE, - number=18, - oneof="ad_data", - message=ad_type_infos.ShoppingProductAdInfo, - ) - gmail_ad = proto.Field( - proto.MESSAGE, - number=21, - oneof="ad_data", - message=ad_type_infos.GmailAdInfo, - ) - image_ad = proto.Field( - proto.MESSAGE, - number=22, - oneof="ad_data", - message=ad_type_infos.ImageAdInfo, - ) - video_ad = proto.Field( - proto.MESSAGE, - number=24, - oneof="ad_data", - message=ad_type_infos.VideoAdInfo, - ) - video_responsive_ad = proto.Field( - proto.MESSAGE, - number=39, - oneof="ad_data", - message=ad_type_infos.VideoResponsiveAdInfo, - ) - responsive_search_ad = proto.Field( - proto.MESSAGE, - number=25, - oneof="ad_data", - message=ad_type_infos.ResponsiveSearchAdInfo, - ) - legacy_responsive_display_ad = proto.Field( - proto.MESSAGE, - number=28, - oneof="ad_data", - message=ad_type_infos.LegacyResponsiveDisplayAdInfo, - ) - app_ad = proto.Field( - proto.MESSAGE, - number=29, - oneof="ad_data", - message=ad_type_infos.AppAdInfo, - ) - legacy_app_install_ad = proto.Field( - proto.MESSAGE, - number=30, - oneof="ad_data", - message=ad_type_infos.LegacyAppInstallAdInfo, - ) - responsive_display_ad = proto.Field( - proto.MESSAGE, - number=31, - oneof="ad_data", - message=ad_type_infos.ResponsiveDisplayAdInfo, - ) - local_ad = proto.Field( - proto.MESSAGE, - number=32, - oneof="ad_data", - message=ad_type_infos.LocalAdInfo, - ) - display_upload_ad = proto.Field( - proto.MESSAGE, - number=33, - oneof="ad_data", - message=ad_type_infos.DisplayUploadAdInfo, - ) - app_engagement_ad = proto.Field( - proto.MESSAGE, - number=34, - oneof="ad_data", - message=ad_type_infos.AppEngagementAdInfo, - ) - shopping_comparison_listing_ad = proto.Field( - proto.MESSAGE, - number=36, - oneof="ad_data", - message=ad_type_infos.ShoppingComparisonListingAdInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group.py b/google/ads/googleads/v6/resources/types/ad_group.py deleted file mode 100644 index bbe5dad6f..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group.py +++ /dev/null @@ -1,206 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.common.types import ( - explorer_auto_optimizer_setting as gagc_explorer_auto_optimizer_setting, -) -from google.ads.googleads.v6.common.types import ( - targeting_setting as gagc_targeting_setting, -) -from google.ads.googleads.v6.enums.types import ad_group_ad_rotation_mode -from google.ads.googleads.v6.enums.types import ad_group_status -from google.ads.googleads.v6.enums.types import ad_group_type -from google.ads.googleads.v6.enums.types import bidding_source -from google.ads.googleads.v6.enums.types import targeting_dimension - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroup",}, -) - - -class AdGroup(proto.Message): - r"""An ad group. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group. Ad group - resource names have the form: - - ``customers/{customer_id}/adGroups/{ad_group_id}`` - id (int): - Output only. The ID of the ad group. - name (str): - The name of the ad group. - This field is required and should not be empty - when creating new ad groups. - - It must contain fewer than 255 UTF-8 full-width - characters. - It must not contain any null (code point 0x0), - NL line feed (code point 0xA) or carriage return - (code point 0xD) characters. - status (google.ads.googleads.v6.enums.types.AdGroupStatusEnum.AdGroupStatus): - The status of the ad group. - type_ (google.ads.googleads.v6.enums.types.AdGroupTypeEnum.AdGroupType): - Immutable. The type of the ad group. - ad_rotation_mode (google.ads.googleads.v6.enums.types.AdGroupAdRotationModeEnum.AdGroupAdRotationMode): - The ad rotation mode of the ad group. - base_ad_group (str): - Output only. For draft or experiment ad - groups, this field is the resource name of the - base ad group from which this ad group was - created. If a draft or experiment ad group does - not have a base ad group, then this field is - null. - For base ad groups, this field equals the ad - group resource name. - This field is read-only. - tracking_url_template (str): - The URL template for constructing a tracking - URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - The list of mappings used to substitute custom parameter - tags in a ``tracking_url_template``, ``final_urls``, or - ``mobile_final_urls``. - campaign (str): - Immutable. The campaign to which the ad group - belongs. - cpc_bid_micros (int): - The maximum CPC (cost-per-click) bid. - cpm_bid_micros (int): - The maximum CPM (cost-per-thousand viewable - impressions) bid. - target_cpa_micros (int): - The target CPA (cost-per-acquisition). - cpv_bid_micros (int): - Output only. The CPV (cost-per-view) bid. - target_cpm_micros (int): - Average amount in micros that the advertiser - is willing to pay for every thousand times the - ad is shown. - target_roas (float): - The target ROAS (return-on-ad-spend) - override. If the ad group's campaign bidding - strategy is a standard Target ROAS strategy, - then this field overrides the target ROAS - specified in the campaign's bidding strategy. - Otherwise, this value is ignored. - percent_cpc_bid_micros (int): - The percent cpc bid amount, expressed as a fraction of the - advertised price for some good or service. The valid range - for the fraction is [0,1) and the value stored here is - 1,000,000 \* [fraction]. - explorer_auto_optimizer_setting (google.ads.googleads.v6.common.types.ExplorerAutoOptimizerSetting): - Settings for the Display Campaign Optimizer, - initially termed "Explorer". - display_custom_bid_dimension (google.ads.googleads.v6.enums.types.TargetingDimensionEnum.TargetingDimension): - Allows advertisers to specify a targeting - dimension on which to place absolute bids. This - is only applicable for campaigns that target - only the display network and not search. - final_url_suffix (str): - URL template for appending params to Final - URL. - targeting_setting (google.ads.googleads.v6.common.types.TargetingSetting): - Setting for targeting related features. - effective_target_cpa_micros (int): - Output only. The effective target CPA (cost- - er-acquisition). This field is read-only. - effective_target_cpa_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective target - CPA. This field is read-only. - effective_target_roas (float): - Output only. The effective target ROAS - (return-on-ad-spend). This field is read-only. - effective_target_roas_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective target - ROAS. This field is read-only. - labels (Sequence[str]): - Output only. The resource names of labels - attached to this ad group. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=34, optional=True) - name = proto.Field(proto.STRING, number=35, optional=True) - status = proto.Field( - proto.ENUM, - number=5, - enum=ad_group_status.AdGroupStatusEnum.AdGroupStatus, - ) - type_ = proto.Field( - proto.ENUM, number=12, enum=ad_group_type.AdGroupTypeEnum.AdGroupType, - ) - ad_rotation_mode = proto.Field( - proto.ENUM, - number=22, - enum=ad_group_ad_rotation_mode.AdGroupAdRotationModeEnum.AdGroupAdRotationMode, - ) - base_ad_group = proto.Field(proto.STRING, number=36, optional=True) - tracking_url_template = proto.Field(proto.STRING, number=37, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=6, message=custom_parameter.CustomParameter, - ) - campaign = proto.Field(proto.STRING, number=38, optional=True) - cpc_bid_micros = proto.Field(proto.INT64, number=39, optional=True) - cpm_bid_micros = proto.Field(proto.INT64, number=40, optional=True) - target_cpa_micros = proto.Field(proto.INT64, number=41, optional=True) - cpv_bid_micros = proto.Field(proto.INT64, number=42, optional=True) - target_cpm_micros = proto.Field(proto.INT64, number=43, optional=True) - target_roas = proto.Field(proto.DOUBLE, number=44, optional=True) - percent_cpc_bid_micros = proto.Field(proto.INT64, number=45, optional=True) - explorer_auto_optimizer_setting = proto.Field( - proto.MESSAGE, - number=21, - message=gagc_explorer_auto_optimizer_setting.ExplorerAutoOptimizerSetting, - ) - display_custom_bid_dimension = proto.Field( - proto.ENUM, - number=23, - enum=targeting_dimension.TargetingDimensionEnum.TargetingDimension, - ) - final_url_suffix = proto.Field(proto.STRING, number=46, optional=True) - targeting_setting = proto.Field( - proto.MESSAGE, - number=25, - message=gagc_targeting_setting.TargetingSetting, - ) - effective_target_cpa_micros = proto.Field( - proto.INT64, number=47, optional=True - ) - effective_target_cpa_source = proto.Field( - proto.ENUM, - number=29, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - effective_target_roas = proto.Field(proto.DOUBLE, number=48, optional=True) - effective_target_roas_source = proto.Field( - proto.ENUM, - number=32, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - labels = proto.RepeatedField(proto.STRING, number=49) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_ad.py b/google/ads/googleads/v6/resources/types/ad_group_ad.py deleted file mode 100644 index 384e87fa2..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_ad.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import ad_group_ad_status -from google.ads.googleads.v6.enums.types import ad_strength as gage_ad_strength -from google.ads.googleads.v6.enums.types import policy_approval_status -from google.ads.googleads.v6.enums.types import policy_review_status -from google.ads.googleads.v6.resources.types import ad as gagr_ad - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAd", "AdGroupAdPolicySummary",}, -) - - -class AdGroupAd(proto.Message): - r"""An ad group ad. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad. Ad group ad resource - names have the form: - - ``customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}`` - status (google.ads.googleads.v6.enums.types.AdGroupAdStatusEnum.AdGroupAdStatus): - The status of the ad. - ad_group (str): - Immutable. The ad group to which the ad - belongs. - ad (google.ads.googleads.v6.resources.types.Ad): - Immutable. The ad. - policy_summary (google.ads.googleads.v6.resources.types.AdGroupAdPolicySummary): - Output only. Policy information for the ad. - ad_strength (google.ads.googleads.v6.enums.types.AdStrengthEnum.AdStrength): - Output only. Overall ad strength for this ad - group ad. - """ - - resource_name = proto.Field(proto.STRING, number=1) - status = proto.Field( - proto.ENUM, - number=3, - enum=ad_group_ad_status.AdGroupAdStatusEnum.AdGroupAdStatus, - ) - ad_group = proto.Field(proto.STRING, number=9, optional=True) - ad = proto.Field(proto.MESSAGE, number=5, message=gagr_ad.Ad,) - policy_summary = proto.Field( - proto.MESSAGE, number=6, message="AdGroupAdPolicySummary", - ) - ad_strength = proto.Field( - proto.ENUM, number=7, enum=gage_ad_strength.AdStrengthEnum.AdStrength, - ) - - -class AdGroupAdPolicySummary(proto.Message): - r"""Contains policy information for an ad. - - Attributes: - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - Output only. The list of policy findings for - this ad. - review_status (google.ads.googleads.v6.enums.types.PolicyReviewStatusEnum.PolicyReviewStatus): - Output only. Where in the review process this - ad is. - approval_status (google.ads.googleads.v6.enums.types.PolicyApprovalStatusEnum.PolicyApprovalStatus): - Output only. The overall approval status of - this ad, calculated based on the status of its - individual policy topic entries. - """ - - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=1, message=policy.PolicyTopicEntry, - ) - review_status = proto.Field( - proto.ENUM, - number=2, - enum=policy_review_status.PolicyReviewStatusEnum.PolicyReviewStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=3, - enum=policy_approval_status.PolicyApprovalStatusEnum.PolicyApprovalStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_ad_asset_view.py b/google/ads/googleads/v6/resources/types/ad_group_ad_asset_view.py deleted file mode 100644 index 51a093bb9..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_ad_asset_view.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import asset_field_type -from google.ads.googleads.v6.enums.types import asset_performance_label -from google.ads.googleads.v6.enums.types import policy_approval_status -from google.ads.googleads.v6.enums.types import policy_review_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAdAssetView", "AdGroupAdAssetPolicySummary",}, -) - - -class AdGroupAdAssetView(proto.Message): - r"""A link between an AdGroupAd and an Asset. - Currently we only support AdGroupAdAssetView for AppAds. - - Attributes: - resource_name (str): - Output only. The resource name of the ad group ad asset - view. Ad group ad asset view resource names have the form - (Before V4): - - ``customers/{customer_id}/adGroupAdAssets/{AdGroupAdAsset.ad_group_id}~{AdGroupAdAsset.ad.ad_id}~{AdGroupAdAsset.asset_id}~{AdGroupAdAsset.field_type}`` - - Ad group ad asset view resource names have the form - (Beginning from V4): - - ``customers/{customer_id}/adGroupAdAssetViews/{AdGroupAdAsset.ad_group_id}~{AdGroupAdAsset.ad_id}~{AdGroupAdAsset.asset_id}~{AdGroupAdAsset.field_type}`` - ad_group_ad (str): - Output only. The ad group ad to which the - asset is linked. - asset (str): - Output only. The asset which is linked to the - ad group ad. - field_type (google.ads.googleads.v6.enums.types.AssetFieldTypeEnum.AssetFieldType): - Output only. Role that the asset takes in the - ad. - enabled (bool): - Output only. The status between the asset and - the latest version of the ad. If true, the asset - is linked to the latest version of the ad. If - false, it means the link once existed but has - been removed and is no longer present in the - latest version of the ad. - policy_summary (google.ads.googleads.v6.resources.types.AdGroupAdAssetPolicySummary): - Output only. Policy information for the ad - group ad asset. - performance_label (google.ads.googleads.v6.enums.types.AssetPerformanceLabelEnum.AssetPerformanceLabel): - Output only. Performance of an asset linkage. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_ad = proto.Field(proto.STRING, number=9, optional=True) - asset = proto.Field(proto.STRING, number=10, optional=True) - field_type = proto.Field( - proto.ENUM, - number=2, - enum=asset_field_type.AssetFieldTypeEnum.AssetFieldType, - ) - enabled = proto.Field(proto.BOOL, number=8, optional=True) - policy_summary = proto.Field( - proto.MESSAGE, number=3, message="AdGroupAdAssetPolicySummary", - ) - performance_label = proto.Field( - proto.ENUM, - number=4, - enum=asset_performance_label.AssetPerformanceLabelEnum.AssetPerformanceLabel, - ) - - -class AdGroupAdAssetPolicySummary(proto.Message): - r"""Contains policy information for an ad group ad asset. - - Attributes: - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - Output only. The list of policy findings for - the ad group ad asset. - review_status (google.ads.googleads.v6.enums.types.PolicyReviewStatusEnum.PolicyReviewStatus): - Output only. Where in the review process this - ad group ad asset is. - approval_status (google.ads.googleads.v6.enums.types.PolicyApprovalStatusEnum.PolicyApprovalStatus): - Output only. The overall approval status of - this ad group ad asset, calculated based on the - status of its individual policy topic entries. - """ - - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=1, message=policy.PolicyTopicEntry, - ) - review_status = proto.Field( - proto.ENUM, - number=2, - enum=policy_review_status.PolicyReviewStatusEnum.PolicyReviewStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=3, - enum=policy_approval_status.PolicyApprovalStatusEnum.PolicyApprovalStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_ad_label.py b/google/ads/googleads/v6/resources/types/ad_group_ad_label.py deleted file mode 100644 index 6cde0c2df..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_ad_label.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAdLabel",}, -) - - -class AdGroupAdLabel(proto.Message): - r"""A relationship between an ad group ad and a label. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group ad label. Ad - group ad label resource names have the form: - ``customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}`` - ad_group_ad (str): - Immutable. The ad group ad to which the label - is attached. - label (str): - Immutable. The label assigned to the ad group - ad. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_ad = proto.Field(proto.STRING, number=4, optional=True) - label = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_audience_view.py b/google/ads/googleads/v6/resources/types/ad_group_audience_view.py deleted file mode 100644 index 8a7766023..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_audience_view.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAudienceView",}, -) - - -class AdGroupAudienceView(proto.Message): - r"""An ad group audience view. - Includes performance data from interests and remarketing lists - for Display Network and YouTube Network ads, and remarketing - lists for search ads (RLSA), aggregated at the audience level. - - Attributes: - resource_name (str): - Output only. The resource name of the ad group audience - view. Ad group audience view resource names have the form: - - ``customers/{customer_id}/adGroupAudienceViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_bid_modifier.py b/google/ads/googleads/v6/resources/types/ad_group_bid_modifier.py deleted file mode 100644 index 722b06bc3..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_bid_modifier.py +++ /dev/null @@ -1,131 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import ( - bid_modifier_source as gage_bid_modifier_source, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupBidModifier",}, -) - - -class AdGroupBidModifier(proto.Message): - r"""Represents an ad group bid modifier. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group bid modifier. - Ad group bid modifier resource names have the form: - - ``customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}`` - ad_group (str): - Immutable. The ad group to which this - criterion belongs. - criterion_id (int): - Output only. The ID of the criterion to bid - modify. - This field is ignored for mutates. - bid_modifier (float): - The modifier for the bid when the criterion - matches. The modifier must be in the range: 0.1 - - 10.0. The range is 1.0 - 6.0 for - PreferredContent. Use 0 to opt out of a Device - type. - base_ad_group (str): - Output only. The base ad group from which this draft/trial - adgroup bid modifier was created. If ad_group is a base ad - group then this field will be equal to ad_group. If the ad - group was created in the draft or trial and has no - corresponding base ad group, then this field will be null. - This field is readonly. - bid_modifier_source (google.ads.googleads.v6.enums.types.BidModifierSourceEnum.BidModifierSource): - Output only. Bid modifier source. - hotel_date_selection_type (google.ads.googleads.v6.common.types.HotelDateSelectionTypeInfo): - Immutable. Criterion for hotel date selection - (default dates vs. user selected). - hotel_advance_booking_window (google.ads.googleads.v6.common.types.HotelAdvanceBookingWindowInfo): - Immutable. Criterion for number of days prior - to the stay the booking is being made. - hotel_length_of_stay (google.ads.googleads.v6.common.types.HotelLengthOfStayInfo): - Immutable. Criterion for length of hotel stay - in nights. - hotel_check_in_day (google.ads.googleads.v6.common.types.HotelCheckInDayInfo): - Immutable. Criterion for day of the week the - booking is for. - device (google.ads.googleads.v6.common.types.DeviceInfo): - Immutable. A device criterion. - preferred_content (google.ads.googleads.v6.common.types.PreferredContentInfo): - Immutable. A preferred content criterion. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group = proto.Field(proto.STRING, number=13, optional=True) - criterion_id = proto.Field(proto.INT64, number=14, optional=True) - bid_modifier = proto.Field(proto.DOUBLE, number=15, optional=True) - base_ad_group = proto.Field(proto.STRING, number=16, optional=True) - bid_modifier_source = proto.Field( - proto.ENUM, - number=10, - enum=gage_bid_modifier_source.BidModifierSourceEnum.BidModifierSource, - ) - hotel_date_selection_type = proto.Field( - proto.MESSAGE, - number=5, - oneof="criterion", - message=criteria.HotelDateSelectionTypeInfo, - ) - hotel_advance_booking_window = proto.Field( - proto.MESSAGE, - number=6, - oneof="criterion", - message=criteria.HotelAdvanceBookingWindowInfo, - ) - hotel_length_of_stay = proto.Field( - proto.MESSAGE, - number=7, - oneof="criterion", - message=criteria.HotelLengthOfStayInfo, - ) - hotel_check_in_day = proto.Field( - proto.MESSAGE, - number=8, - oneof="criterion", - message=criteria.HotelCheckInDayInfo, - ) - device = proto.Field( - proto.MESSAGE, - number=11, - oneof="criterion", - message=criteria.DeviceInfo, - ) - preferred_content = proto.Field( - proto.MESSAGE, - number=12, - oneof="criterion", - message=criteria.PreferredContentInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_criterion.py b/google/ads/googleads/v6/resources/types/ad_group_criterion.py deleted file mode 100644 index 191df3916..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_criterion.py +++ /dev/null @@ -1,463 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.enums.types import ( - ad_group_criterion_approval_status, -) -from google.ads.googleads.v6.enums.types import ad_group_criterion_status -from google.ads.googleads.v6.enums.types import bidding_source -from google.ads.googleads.v6.enums.types import criterion_system_serving_status -from google.ads.googleads.v6.enums.types import criterion_type -from google.ads.googleads.v6.enums.types import quality_score_bucket - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterion",}, -) - - -class AdGroupCriterion(proto.Message): - r"""An ad group criterion. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group criterion. Ad - group criterion resource names have the form: - - ``customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}`` - criterion_id (int): - Output only. The ID of the criterion. - This field is ignored for mutates. - status (google.ads.googleads.v6.enums.types.AdGroupCriterionStatusEnum.AdGroupCriterionStatus): - The status of the criterion. - This is the status of the ad group criterion - entity, set by the client. Note: UI reports may - incorporate additional information that affects - whether a criterion is eligible to run. In some - cases a criterion that's REMOVED in the API can - still show as enabled in the UI. For example, - campaigns by default show to users of all age - ranges unless excluded. The UI will show each - age range as "enabled", since they're eligible - to see the ads; but AdGroupCriterion.status will - show "removed", since no positive criterion was - added. - quality_info (google.ads.googleads.v6.resources.types.AdGroupCriterion.QualityInfo): - Output only. Information regarding the - quality of the criterion. - ad_group (str): - Immutable. The ad group to which the - criterion belongs. - type_ (google.ads.googleads.v6.enums.types.CriterionTypeEnum.CriterionType): - Output only. The type of the criterion. - negative (bool): - Immutable. Whether to target (``false``) or exclude - (``true``) the criterion. - - This field is immutable. To switch a criterion from positive - to negative, remove then re-add it. - system_serving_status (google.ads.googleads.v6.enums.types.CriterionSystemServingStatusEnum.CriterionSystemServingStatus): - Output only. Serving status of the criterion. - approval_status (google.ads.googleads.v6.enums.types.AdGroupCriterionApprovalStatusEnum.AdGroupCriterionApprovalStatus): - Output only. Approval status of the - criterion. - disapproval_reasons (Sequence[str]): - Output only. List of disapproval reasons of - the criterion. - The different reasons for disapproving a - criterion can be found here: - https://support.google.com/adspolicy/answer/6008942 - This field is read-only. - bid_modifier (float): - The modifier for the bid when the criterion - matches. The modifier must be in the range: 0.1 - - 10.0. Most targetable criteria types support - modifiers. - cpc_bid_micros (int): - The CPC (cost-per-click) bid. - cpm_bid_micros (int): - The CPM (cost-per-thousand viewable - impressions) bid. - cpv_bid_micros (int): - The CPV (cost-per-view) bid. - percent_cpc_bid_micros (int): - The CPC bid amount, expressed as a fraction of the - advertised price for some good or service. The valid range - for the fraction is [0,1) and the value stored here is - 1,000,000 \* [fraction]. - effective_cpc_bid_micros (int): - Output only. The effective CPC (cost-per- - lick) bid. - effective_cpm_bid_micros (int): - Output only. The effective CPM (cost-per- - housand viewable impressions) bid. - effective_cpv_bid_micros (int): - Output only. The effective CPV (cost-per- - iew) bid. - effective_percent_cpc_bid_micros (int): - Output only. The effective Percent CPC bid - amount. - effective_cpc_bid_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective CPC bid. - effective_cpm_bid_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective CPM bid. - effective_cpv_bid_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective CPV bid. - effective_percent_cpc_bid_source (google.ads.googleads.v6.enums.types.BiddingSourceEnum.BiddingSource): - Output only. Source of the effective Percent - CPC bid. - position_estimates (google.ads.googleads.v6.resources.types.AdGroupCriterion.PositionEstimates): - Output only. Estimates for criterion bids at - various positions. - final_urls (Sequence[str]): - The list of possible final URLs after all - cross-domain redirects for the ad. - final_mobile_urls (Sequence[str]): - The list of possible final mobile URLs after - all cross-domain redirects. - final_url_suffix (str): - URL template for appending params to final - URL. - tracking_url_template (str): - The URL template for constructing a tracking - URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - The list of mappings used to substitute custom parameter - tags in a ``tracking_url_template``, ``final_urls``, or - ``mobile_final_urls``. - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Immutable. Keyword. - placement (google.ads.googleads.v6.common.types.PlacementInfo): - Immutable. Placement. - mobile_app_category (google.ads.googleads.v6.common.types.MobileAppCategoryInfo): - Immutable. Mobile app category. - mobile_application (google.ads.googleads.v6.common.types.MobileApplicationInfo): - Immutable. Mobile application. - listing_group (google.ads.googleads.v6.common.types.ListingGroupInfo): - Immutable. Listing group. - age_range (google.ads.googleads.v6.common.types.AgeRangeInfo): - Immutable. Age range. - gender (google.ads.googleads.v6.common.types.GenderInfo): - Immutable. Gender. - income_range (google.ads.googleads.v6.common.types.IncomeRangeInfo): - Immutable. Income range. - parental_status (google.ads.googleads.v6.common.types.ParentalStatusInfo): - Immutable. Parental status. - user_list (google.ads.googleads.v6.common.types.UserListInfo): - Immutable. User List. - youtube_video (google.ads.googleads.v6.common.types.YouTubeVideoInfo): - Immutable. YouTube Video. - youtube_channel (google.ads.googleads.v6.common.types.YouTubeChannelInfo): - Immutable. YouTube Channel. - topic (google.ads.googleads.v6.common.types.TopicInfo): - Immutable. Topic. - user_interest (google.ads.googleads.v6.common.types.UserInterestInfo): - Immutable. User Interest. - webpage (google.ads.googleads.v6.common.types.WebpageInfo): - Immutable. Webpage - app_payment_model (google.ads.googleads.v6.common.types.AppPaymentModelInfo): - Immutable. App Payment Model. - custom_affinity (google.ads.googleads.v6.common.types.CustomAffinityInfo): - Immutable. Custom Affinity. - custom_intent (google.ads.googleads.v6.common.types.CustomIntentInfo): - Immutable. Custom Intent. - custom_audience (google.ads.googleads.v6.common.types.CustomAudienceInfo): - Immutable. Custom Audience. - combined_audience (google.ads.googleads.v6.common.types.CombinedAudienceInfo): - Immutable. Combined Audience. - """ - - class QualityInfo(proto.Message): - r"""A container for ad group criterion quality information. - - Attributes: - quality_score (int): - Output only. The quality score. - This field may not be populated if Google does - not have enough information to determine a - value. - creative_quality_score (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - Output only. The performance of the ad - compared to other advertisers. - post_click_quality_score (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - Output only. The quality score of the landing - page. - search_predicted_ctr (google.ads.googleads.v6.enums.types.QualityScoreBucketEnum.QualityScoreBucket): - Output only. The click-through rate compared - to that of other advertisers. - """ - - quality_score = proto.Field(proto.INT32, number=5, optional=True) - creative_quality_score = proto.Field( - proto.ENUM, - number=2, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - post_click_quality_score = proto.Field( - proto.ENUM, - number=3, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - search_predicted_ctr = proto.Field( - proto.ENUM, - number=4, - enum=quality_score_bucket.QualityScoreBucketEnum.QualityScoreBucket, - ) - - class PositionEstimates(proto.Message): - r"""Estimates for criterion bids at various positions. - - Attributes: - first_page_cpc_micros (int): - Output only. The estimate of the CPC bid - required for ad to be shown on first page of - search results. - first_position_cpc_micros (int): - Output only. The estimate of the CPC bid - required for ad to be displayed in first - position, at the top of the first page of search - results. - top_of_page_cpc_micros (int): - Output only. The estimate of the CPC bid - required for ad to be displayed at the top of - the first page of search results. - estimated_add_clicks_at_first_position_cpc (int): - Output only. Estimate of how many clicks per week you might - get by changing your keyword bid to the value in - first_position_cpc_micros. - estimated_add_cost_at_first_position_cpc (int): - Output only. Estimate of how your cost per week might change - when changing your keyword bid to the value in - first_position_cpc_micros. - """ - - first_page_cpc_micros = proto.Field( - proto.INT64, number=6, optional=True - ) - first_position_cpc_micros = proto.Field( - proto.INT64, number=7, optional=True - ) - top_of_page_cpc_micros = proto.Field( - proto.INT64, number=8, optional=True - ) - estimated_add_clicks_at_first_position_cpc = proto.Field( - proto.INT64, number=9, optional=True - ) - estimated_add_cost_at_first_position_cpc = proto.Field( - proto.INT64, number=10, optional=True - ) - - resource_name = proto.Field(proto.STRING, number=1) - criterion_id = proto.Field(proto.INT64, number=56, optional=True) - status = proto.Field( - proto.ENUM, - number=3, - enum=ad_group_criterion_status.AdGroupCriterionStatusEnum.AdGroupCriterionStatus, - ) - quality_info = proto.Field(proto.MESSAGE, number=4, message=QualityInfo,) - ad_group = proto.Field(proto.STRING, number=57, optional=True) - type_ = proto.Field( - proto.ENUM, - number=25, - enum=criterion_type.CriterionTypeEnum.CriterionType, - ) - negative = proto.Field(proto.BOOL, number=58, optional=True) - system_serving_status = proto.Field( - proto.ENUM, - number=52, - enum=criterion_system_serving_status.CriterionSystemServingStatusEnum.CriterionSystemServingStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=53, - enum=ad_group_criterion_approval_status.AdGroupCriterionApprovalStatusEnum.AdGroupCriterionApprovalStatus, - ) - disapproval_reasons = proto.RepeatedField(proto.STRING, number=59) - bid_modifier = proto.Field(proto.DOUBLE, number=61, optional=True) - cpc_bid_micros = proto.Field(proto.INT64, number=62, optional=True) - cpm_bid_micros = proto.Field(proto.INT64, number=63, optional=True) - cpv_bid_micros = proto.Field(proto.INT64, number=64, optional=True) - percent_cpc_bid_micros = proto.Field(proto.INT64, number=65, optional=True) - effective_cpc_bid_micros = proto.Field( - proto.INT64, number=66, optional=True - ) - effective_cpm_bid_micros = proto.Field( - proto.INT64, number=67, optional=True - ) - effective_cpv_bid_micros = proto.Field( - proto.INT64, number=68, optional=True - ) - effective_percent_cpc_bid_micros = proto.Field( - proto.INT64, number=69, optional=True - ) - effective_cpc_bid_source = proto.Field( - proto.ENUM, - number=21, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - effective_cpm_bid_source = proto.Field( - proto.ENUM, - number=22, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - effective_cpv_bid_source = proto.Field( - proto.ENUM, - number=23, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - effective_percent_cpc_bid_source = proto.Field( - proto.ENUM, - number=35, - enum=bidding_source.BiddingSourceEnum.BiddingSource, - ) - position_estimates = proto.Field( - proto.MESSAGE, number=10, message=PositionEstimates, - ) - final_urls = proto.RepeatedField(proto.STRING, number=70) - final_mobile_urls = proto.RepeatedField(proto.STRING, number=71) - final_url_suffix = proto.Field(proto.STRING, number=72, optional=True) - tracking_url_template = proto.Field(proto.STRING, number=73, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=14, message=custom_parameter.CustomParameter, - ) - keyword = proto.Field( - proto.MESSAGE, - number=27, - oneof="criterion", - message=criteria.KeywordInfo, - ) - placement = proto.Field( - proto.MESSAGE, - number=28, - oneof="criterion", - message=criteria.PlacementInfo, - ) - mobile_app_category = proto.Field( - proto.MESSAGE, - number=29, - oneof="criterion", - message=criteria.MobileAppCategoryInfo, - ) - mobile_application = proto.Field( - proto.MESSAGE, - number=30, - oneof="criterion", - message=criteria.MobileApplicationInfo, - ) - listing_group = proto.Field( - proto.MESSAGE, - number=32, - oneof="criterion", - message=criteria.ListingGroupInfo, - ) - age_range = proto.Field( - proto.MESSAGE, - number=36, - oneof="criterion", - message=criteria.AgeRangeInfo, - ) - gender = proto.Field( - proto.MESSAGE, - number=37, - oneof="criterion", - message=criteria.GenderInfo, - ) - income_range = proto.Field( - proto.MESSAGE, - number=38, - oneof="criterion", - message=criteria.IncomeRangeInfo, - ) - parental_status = proto.Field( - proto.MESSAGE, - number=39, - oneof="criterion", - message=criteria.ParentalStatusInfo, - ) - user_list = proto.Field( - proto.MESSAGE, - number=42, - oneof="criterion", - message=criteria.UserListInfo, - ) - youtube_video = proto.Field( - proto.MESSAGE, - number=40, - oneof="criterion", - message=criteria.YouTubeVideoInfo, - ) - youtube_channel = proto.Field( - proto.MESSAGE, - number=41, - oneof="criterion", - message=criteria.YouTubeChannelInfo, - ) - topic = proto.Field( - proto.MESSAGE, number=43, oneof="criterion", message=criteria.TopicInfo, - ) - user_interest = proto.Field( - proto.MESSAGE, - number=45, - oneof="criterion", - message=criteria.UserInterestInfo, - ) - webpage = proto.Field( - proto.MESSAGE, - number=46, - oneof="criterion", - message=criteria.WebpageInfo, - ) - app_payment_model = proto.Field( - proto.MESSAGE, - number=47, - oneof="criterion", - message=criteria.AppPaymentModelInfo, - ) - custom_affinity = proto.Field( - proto.MESSAGE, - number=48, - oneof="criterion", - message=criteria.CustomAffinityInfo, - ) - custom_intent = proto.Field( - proto.MESSAGE, - number=49, - oneof="criterion", - message=criteria.CustomIntentInfo, - ) - custom_audience = proto.Field( - proto.MESSAGE, - number=74, - oneof="criterion", - message=criteria.CustomAudienceInfo, - ) - combined_audience = proto.Field( - proto.MESSAGE, - number=75, - oneof="criterion", - message=criteria.CombinedAudienceInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_criterion_label.py b/google/ads/googleads/v6/resources/types/ad_group_criterion_label.py deleted file mode 100644 index 8f784aece..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_criterion_label.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterionLabel",}, -) - - -class AdGroupCriterionLabel(proto.Message): - r"""A relationship between an ad group criterion and a label. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group criterion - label. Ad group criterion label resource names have the - form: - ``customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}`` - ad_group_criterion (str): - Immutable. The ad group criterion to which - the label is attached. - label (str): - Immutable. The label assigned to the ad group - criterion. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_criterion = proto.Field(proto.STRING, number=4, optional=True) - label = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_criterion_simulation.py b/google/ads/googleads/v6/resources/types/ad_group_criterion_simulation.py deleted file mode 100644 index 0967d5b26..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_criterion_simulation.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import simulation -from google.ads.googleads.v6.enums.types import simulation_modification_method -from google.ads.googleads.v6.enums.types import simulation_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupCriterionSimulation",}, -) - - -class AdGroupCriterionSimulation(proto.Message): - r"""An ad group criterion simulation. Supported combinations of - advertising channel type, criterion type, simulation type, and - simulation modification method are detailed below respectively. - Hotel AdGroupCriterion simulation operations starting in V5. - - 1. DISPLAY - KEYWORD - CPC_BID - UNIFORM - 2. SEARCH - KEYWORD - CPC_BID - UNIFORM - 3. SHOPPING - LISTING_GROUP - CPC_BID - UNIFORM - 4. HOTEL - LISTING_GROUP - CPC_BID - UNIFORM - 5. HOTEL - LISTING_GROUP - PERCENT_CPC_BID - UNIFORM - - Attributes: - resource_name (str): - Output only. The resource name of the ad group criterion - simulation. Ad group criterion simulation resource names - have the form: - - ``customers/{customer_id}/adGroupCriterionSimulations/{ad_group_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}`` - ad_group_id (int): - Output only. AdGroup ID of the simulation. - criterion_id (int): - Output only. Criterion ID of the simulation. - type_ (google.ads.googleads.v6.enums.types.SimulationTypeEnum.SimulationType): - Output only. The field that the simulation - modifies. - modification_method (google.ads.googleads.v6.enums.types.SimulationModificationMethodEnum.SimulationModificationMethod): - Output only. How the simulation modifies the - field. - start_date (str): - Output only. First day on which the - simulation is based, in YYYY-MM-DD format. - end_date (str): - Output only. Last day on which the simulation - is based, in YYYY-MM-DD format. - cpc_bid_point_list (google.ads.googleads.v6.common.types.CpcBidSimulationPointList): - Output only. Simulation points if the simulation type is - CPC_BID. - percent_cpc_bid_point_list (google.ads.googleads.v6.common.types.PercentCpcBidSimulationPointList): - Output only. Simulation points if the simulation type is - PERCENT_CPC_BID. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_id = proto.Field(proto.INT64, number=9, optional=True) - criterion_id = proto.Field(proto.INT64, number=10, optional=True) - type_ = proto.Field( - proto.ENUM, - number=4, - enum=simulation_type.SimulationTypeEnum.SimulationType, - ) - modification_method = proto.Field( - proto.ENUM, - number=5, - enum=simulation_modification_method.SimulationModificationMethodEnum.SimulationModificationMethod, - ) - start_date = proto.Field(proto.STRING, number=11, optional=True) - end_date = proto.Field(proto.STRING, number=12, optional=True) - cpc_bid_point_list = proto.Field( - proto.MESSAGE, - number=8, - oneof="point_list", - message=simulation.CpcBidSimulationPointList, - ) - percent_cpc_bid_point_list = proto.Field( - proto.MESSAGE, - number=13, - oneof="point_list", - message=simulation.PercentCpcBidSimulationPointList, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_extension_setting.py b/google/ads/googleads/v6/resources/types/ad_group_extension_setting.py deleted file mode 100644 index c8abd9ebe..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_extension_setting.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import extension_setting_device -from google.ads.googleads.v6.enums.types import ( - extension_type as gage_extension_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupExtensionSetting",}, -) - - -class AdGroupExtensionSetting(proto.Message): - r"""An ad group extension setting. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group extension - setting. AdGroupExtensionSetting resource names have the - form: - - ``customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}`` - extension_type (google.ads.googleads.v6.enums.types.ExtensionTypeEnum.ExtensionType): - Immutable. The extension type of the ad group - extension setting. - ad_group (str): - Immutable. The resource name of the ad group. The linked - extension feed items will serve under this ad group. AdGroup - resource names have the form: - - ``customers/{customer_id}/adGroups/{ad_group_id}`` - extension_feed_items (Sequence[str]): - The resource names of the extension feed items to serve - under the ad group. ExtensionFeedItem resource names have - the form: - - ``customers/{customer_id}/extensionFeedItems/{feed_item_id}`` - device (google.ads.googleads.v6.enums.types.ExtensionSettingDeviceEnum.ExtensionSettingDevice): - The device for which the extensions will - serve. Optional. - """ - - resource_name = proto.Field(proto.STRING, number=1) - extension_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_extension_type.ExtensionTypeEnum.ExtensionType, - ) - ad_group = proto.Field(proto.STRING, number=6, optional=True) - extension_feed_items = proto.RepeatedField(proto.STRING, number=7) - device = proto.Field( - proto.ENUM, - number=5, - enum=extension_setting_device.ExtensionSettingDeviceEnum.ExtensionSettingDevice, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_feed.py b/google/ads/googleads/v6/resources/types/ad_group_feed.py deleted file mode 100644 index 9949679d7..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_feed.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import ( - matching_function as gagc_matching_function, -) -from google.ads.googleads.v6.enums.types import feed_link_status -from google.ads.googleads.v6.enums.types import placeholder_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupFeed",}, -) - - -class AdGroupFeed(proto.Message): - r"""An ad group feed. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group feed. Ad group - feed resource names have the form: - - \`customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id} - feed (str): - Immutable. The feed being linked to the ad - group. - ad_group (str): - Immutable. The ad group being linked to the - feed. - placeholder_types (Sequence[google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType]): - Indicates which placeholder types the feed - may populate under the connected ad group. - Required. - matching_function (google.ads.googleads.v6.common.types.MatchingFunction): - Matching function associated with the - AdGroupFeed. The matching function is used to - filter the set of feed items selected. Required. - status (google.ads.googleads.v6.enums.types.FeedLinkStatusEnum.FeedLinkStatus): - Output only. Status of the ad group feed. - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=7, optional=True) - ad_group = proto.Field(proto.STRING, number=8, optional=True) - placeholder_types = proto.RepeatedField( - proto.ENUM, - number=4, - enum=placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - matching_function = proto.Field( - proto.MESSAGE, - number=5, - message=gagc_matching_function.MatchingFunction, - ) - status = proto.Field( - proto.ENUM, - number=6, - enum=feed_link_status.FeedLinkStatusEnum.FeedLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_label.py b/google/ads/googleads/v6/resources/types/ad_group_label.py deleted file mode 100644 index 1cb9e818f..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_label.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupLabel",}, -) - - -class AdGroupLabel(proto.Message): - r"""A relationship between an ad group and a label. - - Attributes: - resource_name (str): - Immutable. The resource name of the ad group label. Ad group - label resource names have the form: - ``customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}`` - ad_group (str): - Immutable. The ad group to which the label is - attached. - label (str): - Immutable. The label assigned to the ad - group. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group = proto.Field(proto.STRING, number=4, optional=True) - label = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_group_simulation.py b/google/ads/googleads/v6/resources/types/ad_group_simulation.py deleted file mode 100644 index aecbcee85..000000000 --- a/google/ads/googleads/v6/resources/types/ad_group_simulation.py +++ /dev/null @@ -1,122 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import simulation -from google.ads.googleads.v6.enums.types import simulation_modification_method -from google.ads.googleads.v6.enums.types import simulation_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdGroupSimulation",}, -) - - -class AdGroupSimulation(proto.Message): - r"""An ad group simulation. Supported combinations of advertising - channel type, simulation type and simulation modification method is - detailed below respectively. - - 1. SEARCH - CPC_BID - DEFAULT - 2. SEARCH - CPC_BID - UNIFORM - 3. SEARCH - TARGET_CPA - UNIFORM - 4. SEARCH - TARGET_ROAS - UNIFORM - 5. DISPLAY - CPC_BID - DEFAULT - 6. DISPLAY - CPC_BID - UNIFORM - 7. DISPLAY - TARGET_CPA - UNIFORM - 8. VIDEO - CPV_BID - DEFAULT - 9. VIDEO - CPV_BID - UNIFORM - - Attributes: - resource_name (str): - Output only. The resource name of the ad group simulation. - Ad group simulation resource names have the form: - - ``customers/{customer_id}/adGroupSimulations/{ad_group_id}~{type}~{modification_method}~{start_date}~{end_date}`` - ad_group_id (int): - Output only. Ad group id of the simulation. - type_ (google.ads.googleads.v6.enums.types.SimulationTypeEnum.SimulationType): - Output only. The field that the simulation - modifies. - modification_method (google.ads.googleads.v6.enums.types.SimulationModificationMethodEnum.SimulationModificationMethod): - Output only. How the simulation modifies the - field. - start_date (str): - Output only. First day on which the - simulation is based, in YYYY-MM-DD format. - end_date (str): - Output only. Last day on which the simulation - is based, in YYYY-MM-DD format - cpc_bid_point_list (google.ads.googleads.v6.common.types.CpcBidSimulationPointList): - Output only. Simulation points if the simulation type is - CPC_BID. - cpv_bid_point_list (google.ads.googleads.v6.common.types.CpvBidSimulationPointList): - Output only. Simulation points if the simulation type is - CPV_BID. - target_cpa_point_list (google.ads.googleads.v6.common.types.TargetCpaSimulationPointList): - Output only. Simulation points if the simulation type is - TARGET_CPA. - target_roas_point_list (google.ads.googleads.v6.common.types.TargetRoasSimulationPointList): - Output only. Simulation points if the simulation type is - TARGET_ROAS. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_id = proto.Field(proto.INT64, number=12, optional=True) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=simulation_type.SimulationTypeEnum.SimulationType, - ) - modification_method = proto.Field( - proto.ENUM, - number=4, - enum=simulation_modification_method.SimulationModificationMethodEnum.SimulationModificationMethod, - ) - start_date = proto.Field(proto.STRING, number=13, optional=True) - end_date = proto.Field(proto.STRING, number=14, optional=True) - cpc_bid_point_list = proto.Field( - proto.MESSAGE, - number=8, - oneof="point_list", - message=simulation.CpcBidSimulationPointList, - ) - cpv_bid_point_list = proto.Field( - proto.MESSAGE, - number=10, - oneof="point_list", - message=simulation.CpvBidSimulationPointList, - ) - target_cpa_point_list = proto.Field( - proto.MESSAGE, - number=9, - oneof="point_list", - message=simulation.TargetCpaSimulationPointList, - ) - target_roas_point_list = proto.Field( - proto.MESSAGE, - number=11, - oneof="point_list", - message=simulation.TargetRoasSimulationPointList, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_parameter.py b/google/ads/googleads/v6/resources/types/ad_parameter.py deleted file mode 100644 index a519c061e..000000000 --- a/google/ads/googleads/v6/resources/types/ad_parameter.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdParameter",}, -) - - -class AdParameter(proto.Message): - r"""An ad parameter that is used to update numeric values (such as - prices or inventory levels) in any text line of an ad (including - URLs). There can be a maximum of two AdParameters per ad group - criterion. (One with parameter_index = 1 and one with - parameter_index = 2.) In the ad the parameters are referenced by a - placeholder of the form "{param#:value}". E.g. "{param1:$17}" - - Attributes: - resource_name (str): - Immutable. The resource name of the ad parameter. Ad - parameter resource names have the form: - - ``customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}`` - ad_group_criterion (str): - Immutable. The ad group criterion that this - ad parameter belongs to. - parameter_index (int): - Immutable. The unique index of this ad - parameter. Must be either 1 or 2. - insertion_text (str): - Numeric value to insert into the ad text. The - following restrictions apply: - - Can use comma or period as a separator, with - an optional period or comma (respectively) - for fractional values. For example, 1,000,000.00 - and 2.000.000,10 are valid. - - Can be prepended or appended with a currency - symbol. For example, $99.99 is valid. - - Can be prepended or appended with a currency - code. For example, 99.99USD and EUR200 are - valid. - - Can use '%'. For example, 1.0% and 1,0% are - valid. - Can use plus or minus. For example, - -10.99 and 25+ are valid. - Can use '/' between - two numbers. For example 4/1 and 0.95/0.45 are - valid. - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_criterion = proto.Field(proto.STRING, number=5, optional=True) - parameter_index = proto.Field(proto.INT64, number=6, optional=True) - insertion_text = proto.Field(proto.STRING, number=7, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/ad_schedule_view.py b/google/ads/googleads/v6/resources/types/ad_schedule_view.py deleted file mode 100644 index b10f2bd25..000000000 --- a/google/ads/googleads/v6/resources/types/ad_schedule_view.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AdScheduleView",}, -) - - -class AdScheduleView(proto.Message): - r"""An ad schedule view summarizes the performance of campaigns - by AdSchedule criteria. - - Attributes: - resource_name (str): - Output only. The resource name of the ad schedule view. - AdSchedule view resource names have the form: - - ``customers/{customer_id}/adScheduleViews/{campaign_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/age_range_view.py b/google/ads/googleads/v6/resources/types/age_range_view.py deleted file mode 100644 index 98cd62302..000000000 --- a/google/ads/googleads/v6/resources/types/age_range_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"AgeRangeView",}, -) - - -class AgeRangeView(proto.Message): - r"""An age range view. - - Attributes: - resource_name (str): - Output only. The resource name of the age range view. Age - range view resource names have the form: - - ``customers/{customer_id}/ageRangeViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/asset.py b/google/ads/googleads/v6/resources/types/asset.py deleted file mode 100644 index e2aedb160..000000000 --- a/google/ads/googleads/v6/resources/types/asset.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import asset_types -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import asset_type -from google.ads.googleads.v6.enums.types import policy_approval_status -from google.ads.googleads.v6.enums.types import policy_review_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Asset", "AssetPolicySummary",}, -) - - -class Asset(proto.Message): - r"""Asset is a part of an ad which can be shared across multiple - ads. It can be an image (ImageAsset), a video - (YoutubeVideoAsset), etc. Assets are immutable and cannot be - removed. To stop an asset from serving, remove the asset from - the entity that is using it. - - Attributes: - resource_name (str): - Immutable. The resource name of the asset. Asset resource - names have the form: - - ``customers/{customer_id}/assets/{asset_id}`` - id (int): - Output only. The ID of the asset. - name (str): - Optional name of the asset. - type_ (google.ads.googleads.v6.enums.types.AssetTypeEnum.AssetType): - Output only. Type of the asset. - final_urls (Sequence[str]): - A list of possible final URLs after all cross - domain redirects. - policy_summary (google.ads.googleads.v6.resources.types.AssetPolicySummary): - Output only. Policy information for the - asset. - youtube_video_asset (google.ads.googleads.v6.common.types.YoutubeVideoAsset): - Immutable. A YouTube video asset. - media_bundle_asset (google.ads.googleads.v6.common.types.MediaBundleAsset): - Immutable. A media bundle asset. - image_asset (google.ads.googleads.v6.common.types.ImageAsset): - Output only. An image asset. - text_asset (google.ads.googleads.v6.common.types.TextAsset): - Output only. A text asset. - lead_form_asset (google.ads.googleads.v6.common.types.LeadFormAsset): - A lead form asset. - book_on_google_asset (google.ads.googleads.v6.common.types.BookOnGoogleAsset): - A book on google asset. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=11, optional=True) - name = proto.Field(proto.STRING, number=12, optional=True) - type_ = proto.Field( - proto.ENUM, number=4, enum=asset_type.AssetTypeEnum.AssetType, - ) - final_urls = proto.RepeatedField(proto.STRING, number=14) - policy_summary = proto.Field( - proto.MESSAGE, number=13, message="AssetPolicySummary", - ) - youtube_video_asset = proto.Field( - proto.MESSAGE, - number=5, - oneof="asset_data", - message=asset_types.YoutubeVideoAsset, - ) - media_bundle_asset = proto.Field( - proto.MESSAGE, - number=6, - oneof="asset_data", - message=asset_types.MediaBundleAsset, - ) - image_asset = proto.Field( - proto.MESSAGE, - number=7, - oneof="asset_data", - message=asset_types.ImageAsset, - ) - text_asset = proto.Field( - proto.MESSAGE, - number=8, - oneof="asset_data", - message=asset_types.TextAsset, - ) - lead_form_asset = proto.Field( - proto.MESSAGE, - number=9, - oneof="asset_data", - message=asset_types.LeadFormAsset, - ) - book_on_google_asset = proto.Field( - proto.MESSAGE, - number=10, - oneof="asset_data", - message=asset_types.BookOnGoogleAsset, - ) - - -class AssetPolicySummary(proto.Message): - r"""Contains policy information for an asset. - - Attributes: - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - Output only. The list of policy findings for - this asset. - review_status (google.ads.googleads.v6.enums.types.PolicyReviewStatusEnum.PolicyReviewStatus): - Output only. Where in the review process this - asset is. - approval_status (google.ads.googleads.v6.enums.types.PolicyApprovalStatusEnum.PolicyApprovalStatus): - Output only. The overall approval status of - this asset, calculated based on the status of - its individual policy topic entries. - """ - - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=1, message=policy.PolicyTopicEntry, - ) - review_status = proto.Field( - proto.ENUM, - number=2, - enum=policy_review_status.PolicyReviewStatusEnum.PolicyReviewStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=3, - enum=policy_approval_status.PolicyApprovalStatusEnum.PolicyApprovalStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/batch_job.py b/google/ads/googleads/v6/resources/types/batch_job.py deleted file mode 100644 index 90a81a907..000000000 --- a/google/ads/googleads/v6/resources/types/batch_job.py +++ /dev/null @@ -1,117 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import batch_job_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"BatchJob",}, -) - - -class BatchJob(proto.Message): - r"""A list of mutates being processed asynchronously. The mutates - are uploaded by the user. The mutates themselves aren't readable - and the results of the job can only be read using - BatchJobService.ListBatchJobResults. - - Attributes: - resource_name (str): - Immutable. The resource name of the batch job. Batch job - resource names have the form: - - ``customers/{customer_id}/batchJobs/{batch_job_id}`` - id (int): - Output only. ID of this batch job. - next_add_sequence_token (str): - Output only. The next sequence token to use - when adding operations. Only set when the batch - job status is PENDING. - metadata (google.ads.googleads.v6.resources.types.BatchJob.BatchJobMetadata): - Output only. Contains additional information - about this batch job. - status (google.ads.googleads.v6.enums.types.BatchJobStatusEnum.BatchJobStatus): - Output only. Status of this batch job. - long_running_operation (str): - Output only. The resource name of the long- - unning operation that can be used to poll for - completion. Only set when the batch job status - is RUNNING or DONE. - """ - - class BatchJobMetadata(proto.Message): - r"""Additional information about the batch job. This message is - also used as metadata returned in batch job Long Running - Operations. - - Attributes: - creation_date_time (str): - Output only. The time when this batch job was - created. Formatted as yyyy-mm-dd hh:mm:ss. - Example: "2018-03-05 09:15:00". - start_date_time (str): - Output only. The time when this batch job - started running. Formatted as yyyy-mm-dd - hh:mm:ss. Example: "2018-03-05 09:15:30". - completion_date_time (str): - Output only. The time when this batch job was - completed. Formatted as yyyy-MM-dd HH:mm:ss. - Example: "2018-03-05 09:16:00". - estimated_completion_ratio (float): - Output only. The fraction (between 0.0 and - 1.0) of mutates that have been processed. This - is empty if the job hasn't started running yet. - operation_count (int): - Output only. The number of mutate operations - in the batch job. - executed_operation_count (int): - Output only. The number of mutate operations - executed by the batch job. Present only if the - job has started running. - """ - - creation_date_time = proto.Field(proto.STRING, number=8, optional=True) - start_date_time = proto.Field(proto.STRING, number=7, optional=True) - completion_date_time = proto.Field( - proto.STRING, number=9, optional=True - ) - estimated_completion_ratio = proto.Field( - proto.DOUBLE, number=10, optional=True - ) - operation_count = proto.Field(proto.INT64, number=11, optional=True) - executed_operation_count = proto.Field( - proto.INT64, number=12, optional=True - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=7, optional=True) - next_add_sequence_token = proto.Field(proto.STRING, number=8, optional=True) - metadata = proto.Field(proto.MESSAGE, number=4, message=BatchJobMetadata,) - status = proto.Field( - proto.ENUM, - number=5, - enum=batch_job_status.BatchJobStatusEnum.BatchJobStatus, - ) - long_running_operation = proto.Field(proto.STRING, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/bidding_strategy.py b/google/ads/googleads/v6/resources/types/bidding_strategy.py deleted file mode 100644 index 001f88fad..000000000 --- a/google/ads/googleads/v6/resources/types/bidding_strategy.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import bidding -from google.ads.googleads.v6.enums.types import bidding_strategy_status -from google.ads.googleads.v6.enums.types import bidding_strategy_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"BiddingStrategy",}, -) - - -class BiddingStrategy(proto.Message): - r"""A bidding strategy. - - Attributes: - resource_name (str): - Immutable. The resource name of the bidding strategy. - Bidding strategy resource names have the form: - - ``customers/{customer_id}/biddingStrategies/{bidding_strategy_id}`` - id (int): - Output only. The ID of the bidding strategy. - name (str): - The name of the bidding strategy. - All bidding strategies within an account must be - named distinctly. - The length of this string should be between 1 - and 255, inclusive, in UTF-8 bytes, (trimmed). - status (google.ads.googleads.v6.enums.types.BiddingStrategyStatusEnum.BiddingStrategyStatus): - Output only. The status of the bidding - strategy. - This field is read-only. - type_ (google.ads.googleads.v6.enums.types.BiddingStrategyTypeEnum.BiddingStrategyType): - Output only. The type of the bidding - strategy. Create a bidding strategy by setting - the bidding scheme. - This field is read-only. - effective_currency_code (str): - Output only. The currency used by the bidding strategy (ISO - 4217 three-letter code). - - For bidding strategies in manager customers, this is the - currency set by the advertiser when creating the strategy. - For serving customers, this is the customer's currency_code. - - Bidding strategy metrics are reported in this currency. - - This field is read-only. - campaign_count (int): - Output only. The number of campaigns attached - to this bidding strategy. - This field is read-only. - non_removed_campaign_count (int): - Output only. The number of non-removed - campaigns attached to this bidding strategy. - This field is read-only. - enhanced_cpc (google.ads.googleads.v6.common.types.EnhancedCpc): - A bidding strategy that raises bids for - clicks that seem more likely to lead to a - conversion and lowers them for clicks where they - seem less likely. - maximize_conversion_value (google.ads.googleads.v6.common.types.MaximizeConversionValue): - An automated bidding strategy to help get the - most conversion value for your campaigns while - spending your budget. - maximize_conversions (google.ads.googleads.v6.common.types.MaximizeConversions): - An automated bidding strategy to help get the - most conversions for your campaigns while - spending your budget. - target_cpa (google.ads.googleads.v6.common.types.TargetCpa): - A bidding strategy that sets bids to help get - as many conversions as possible at the target - cost-per-acquisition (CPA) you set. - target_impression_share (google.ads.googleads.v6.common.types.TargetImpressionShare): - A bidding strategy that automatically - optimizes towards a desired percentage of - impressions. - target_roas (google.ads.googleads.v6.common.types.TargetRoas): - A bidding strategy that helps you maximize - revenue while averaging a specific target Return - On Ad Spend (ROAS). - target_spend (google.ads.googleads.v6.common.types.TargetSpend): - A bid strategy that sets your bids to help - get as many clicks as possible within your - budget. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=16, optional=True) - name = proto.Field(proto.STRING, number=17, optional=True) - status = proto.Field( - proto.ENUM, - number=15, - enum=bidding_strategy_status.BiddingStrategyStatusEnum.BiddingStrategyStatus, - ) - type_ = proto.Field( - proto.ENUM, - number=5, - enum=bidding_strategy_type.BiddingStrategyTypeEnum.BiddingStrategyType, - ) - effective_currency_code = proto.Field( - proto.STRING, number=20, optional=True - ) - campaign_count = proto.Field(proto.INT64, number=18, optional=True) - non_removed_campaign_count = proto.Field( - proto.INT64, number=19, optional=True - ) - enhanced_cpc = proto.Field( - proto.MESSAGE, number=7, oneof="scheme", message=bidding.EnhancedCpc, - ) - maximize_conversion_value = proto.Field( - proto.MESSAGE, - number=21, - oneof="scheme", - message=bidding.MaximizeConversionValue, - ) - maximize_conversions = proto.Field( - proto.MESSAGE, - number=22, - oneof="scheme", - message=bidding.MaximizeConversions, - ) - target_cpa = proto.Field( - proto.MESSAGE, number=9, oneof="scheme", message=bidding.TargetCpa, - ) - target_impression_share = proto.Field( - proto.MESSAGE, - number=48, - oneof="scheme", - message=bidding.TargetImpressionShare, - ) - target_roas = proto.Field( - proto.MESSAGE, number=11, oneof="scheme", message=bidding.TargetRoas, - ) - target_spend = proto.Field( - proto.MESSAGE, number=12, oneof="scheme", message=bidding.TargetSpend, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/billing_setup.py b/google/ads/googleads/v6/resources/types/billing_setup.py deleted file mode 100644 index 05f81a408..000000000 --- a/google/ads/googleads/v6/resources/types/billing_setup.py +++ /dev/null @@ -1,151 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import billing_setup_status -from google.ads.googleads.v6.enums.types import time_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"BillingSetup",}, -) - - -class BillingSetup(proto.Message): - r"""A billing setup, which associates a payments account and an - advertiser. A billing setup is specific to one advertiser. - - Attributes: - resource_name (str): - Immutable. The resource name of the billing setup. - BillingSetup resource names have the form: - - ``customers/{customer_id}/billingSetups/{billing_setup_id}`` - id (int): - Output only. The ID of the billing setup. - status (google.ads.googleads.v6.enums.types.BillingSetupStatusEnum.BillingSetupStatus): - Output only. The status of the billing setup. - payments_account (str): - Immutable. The resource name of the payments account - associated with this billing setup. Payments resource names - have the form: - - ``customers/{customer_id}/paymentsAccounts/{payments_account_id}`` - When setting up billing, this is used to signup with an - existing payments account (and then payments_account_info - should not be set). When getting a billing setup, this and - payments_account_info will be populated. - payments_account_info (google.ads.googleads.v6.resources.types.BillingSetup.PaymentsAccountInfo): - Immutable. The payments account information associated with - this billing setup. When setting up billing, this is used to - signup with a new payments account (and then - payments_account should not be set). When getting a billing - setup, this and payments_account will be populated. - start_date_time (str): - Immutable. The start date time in yyyy-MM-dd - or yyyy-MM-dd HH:mm:ss format. Only a future - time is allowed. - start_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Immutable. The start time as a type. Only NOW - is allowed. - end_date_time (str): - Output only. The end date time in yyyy-MM-dd - or yyyy-MM-dd HH:mm:ss format. - end_time_type (google.ads.googleads.v6.enums.types.TimeTypeEnum.TimeType): - Output only. The end time as a type. The - only possible value is FOREVER. - """ - - class PaymentsAccountInfo(proto.Message): - r"""Container of payments account information for this billing. - - Attributes: - payments_account_id (str): - Output only. A 16 digit id used to identify - the payments account associated with the billing - setup. - This must be passed as a string with dashes, - e.g. "1234-5678-9012-3456". - payments_account_name (str): - Immutable. The name of the payments account - associated with the billing setup. - This enables the user to specify a meaningful - name for a payments account to aid in - reconciling monthly invoices. - - This name will be printed in the monthly - invoices. - payments_profile_id (str): - Immutable. A 12 digit id used to identify the - payments profile associated with the billing - setup. - This must be passed in as a string with dashes, - e.g. "1234-5678-9012". - payments_profile_name (str): - Output only. The name of the payments profile - associated with the billing setup. - secondary_payments_profile_id (str): - Output only. A secondary payments profile id - present in uncommon situations, e.g. when a - sequential liability agreement has been - arranged. - """ - - payments_account_id = proto.Field(proto.STRING, number=6, optional=True) - payments_account_name = proto.Field( - proto.STRING, number=7, optional=True - ) - payments_profile_id = proto.Field(proto.STRING, number=8, optional=True) - payments_profile_name = proto.Field( - proto.STRING, number=9, optional=True - ) - secondary_payments_profile_id = proto.Field( - proto.STRING, number=10, optional=True - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=15, optional=True) - status = proto.Field( - proto.ENUM, - number=3, - enum=billing_setup_status.BillingSetupStatusEnum.BillingSetupStatus, - ) - payments_account = proto.Field(proto.STRING, number=18, optional=True) - payments_account_info = proto.Field( - proto.MESSAGE, number=12, message=PaymentsAccountInfo, - ) - start_date_time = proto.Field(proto.STRING, number=16, oneof="start_time") - start_time_type = proto.Field( - proto.ENUM, - number=10, - oneof="start_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - end_date_time = proto.Field(proto.STRING, number=17, oneof="end_time") - end_time_type = proto.Field( - proto.ENUM, - number=14, - oneof="end_time", - enum=time_type.TimeTypeEnum.TimeType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/call_view.py b/google/ads/googleads/v6/resources/types/call_view.py deleted file mode 100644 index f8b031809..000000000 --- a/google/ads/googleads/v6/resources/types/call_view.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - call_tracking_display_location as gage_call_tracking_display_location, -) -from google.ads.googleads.v6.enums.types import call_type -from google.ads.googleads.v6.enums.types import google_voice_call_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CallView",}, -) - - -class CallView(proto.Message): - r"""A call view that includes data for call tracking of call-only - ads or call extensions. - - Attributes: - resource_name (str): - Output only. The resource name of the call view. Call view - resource names have the form: - - ``customers/{customer_id}/callViews/{call_detail_id}`` - caller_region_code (str): - Output only. Region code of the caller. - caller_area_code (str): - Output only. Area code of the caller. Null if - the call duration is shorter than 15 seconds. - call_duration_seconds (int): - Output only. The advertiser-provided call - duration in seconds. - start_call_date_time (str): - Output only. The advertiser-provided call - start date time. - end_call_date_time (str): - Output only. The advertiser-provided call end - date time. - call_tracking_display_location (google.ads.googleads.v6.enums.types.CallTrackingDisplayLocationEnum.CallTrackingDisplayLocation): - Output only. The call tracking display - location. - type_ (google.ads.googleads.v6.enums.types.CallTypeEnum.CallType): - Output only. The type of the call. - call_status (google.ads.googleads.v6.enums.types.GoogleVoiceCallStatusEnum.GoogleVoiceCallStatus): - Output only. The status of the call. - """ - - resource_name = proto.Field(proto.STRING, number=1) - caller_region_code = proto.Field(proto.STRING, number=2) - caller_area_code = proto.Field(proto.STRING, number=3) - call_duration_seconds = proto.Field(proto.INT64, number=4) - start_call_date_time = proto.Field(proto.STRING, number=5) - end_call_date_time = proto.Field(proto.STRING, number=6) - call_tracking_display_location = proto.Field( - proto.ENUM, - number=7, - enum=gage_call_tracking_display_location.CallTrackingDisplayLocationEnum.CallTrackingDisplayLocation, - ) - type_ = proto.Field( - proto.ENUM, number=8, enum=call_type.CallTypeEnum.CallType, - ) - call_status = proto.Field( - proto.ENUM, - number=9, - enum=google_voice_call_status.GoogleVoiceCallStatusEnum.GoogleVoiceCallStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign.py b/google/ads/googleads/v6/resources/types/campaign.py deleted file mode 100644 index 7c29438a9..000000000 --- a/google/ads/googleads/v6/resources/types/campaign.py +++ /dev/null @@ -1,680 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import bidding -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.common.types import frequency_cap -from google.ads.googleads.v6.common.types import ( - real_time_bidding_setting as gagc_real_time_bidding_setting, -) -from google.ads.googleads.v6.common.types import ( - targeting_setting as gagc_targeting_setting, -) -from google.ads.googleads.v6.enums.types import ( - ad_serving_optimization_status as gage_ad_serving_optimization_status, -) -from google.ads.googleads.v6.enums.types import ( - advertising_channel_sub_type as gage_advertising_channel_sub_type, -) -from google.ads.googleads.v6.enums.types import ( - advertising_channel_type as gage_advertising_channel_type, -) -from google.ads.googleads.v6.enums.types import app_campaign_app_store -from google.ads.googleads.v6.enums.types import ( - app_campaign_bidding_strategy_goal_type, -) -from google.ads.googleads.v6.enums.types import ( - bidding_strategy_type as gage_bidding_strategy_type, -) -from google.ads.googleads.v6.enums.types import brand_safety_suitability -from google.ads.googleads.v6.enums.types import campaign_experiment_type -from google.ads.googleads.v6.enums.types import campaign_serving_status -from google.ads.googleads.v6.enums.types import campaign_status -from google.ads.googleads.v6.enums.types import ( - location_source_type as gage_location_source_type, -) -from google.ads.googleads.v6.enums.types import ( - negative_geo_target_type as gage_negative_geo_target_type, -) -from google.ads.googleads.v6.enums.types import optimization_goal_type -from google.ads.googleads.v6.enums.types import ( - payment_mode as gage_payment_mode, -) -from google.ads.googleads.v6.enums.types import ( - positive_geo_target_type as gage_positive_geo_target_type, -) -from google.ads.googleads.v6.enums.types import ( - vanity_pharma_display_url_mode as gage_vanity_pharma_display_url_mode, -) -from google.ads.googleads.v6.enums.types import ( - vanity_pharma_text as gage_vanity_pharma_text, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Campaign",}, -) - - -class Campaign(proto.Message): - r"""A campaign. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign. Campaign - resource names have the form: - - ``customers/{customer_id}/campaigns/{campaign_id}`` - id (int): - Output only. The ID of the campaign. - name (str): - The name of the campaign. - This field is required and should not be empty - when creating new campaigns. - - It must not contain any null (code point 0x0), - NL line feed (code point 0xA) or carriage return - (code point 0xD) characters. - status (google.ads.googleads.v6.enums.types.CampaignStatusEnum.CampaignStatus): - The status of the campaign. - When a new campaign is added, the status - defaults to ENABLED. - serving_status (google.ads.googleads.v6.enums.types.CampaignServingStatusEnum.CampaignServingStatus): - Output only. The ad serving status of the - campaign. - ad_serving_optimization_status (google.ads.googleads.v6.enums.types.AdServingOptimizationStatusEnum.AdServingOptimizationStatus): - The ad serving optimization status of the - campaign. - advertising_channel_type (google.ads.googleads.v6.enums.types.AdvertisingChannelTypeEnum.AdvertisingChannelType): - Immutable. The primary serving target for ads within the - campaign. The targeting options can be refined in - ``network_settings``. - - This field is required and should not be empty when creating - new campaigns. - - Can be set only when creating campaigns. After the campaign - is created, the field can not be changed. - advertising_channel_sub_type (google.ads.googleads.v6.enums.types.AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType): - Immutable. Optional refinement to - ``advertising_channel_type``. Must be a valid sub-type of - the parent channel type. - - Can be set only when creating campaigns. After campaign is - created, the field can not be changed. - tracking_url_template (str): - The URL template for constructing a tracking - URL. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - The list of mappings used to substitute custom parameter - tags in a ``tracking_url_template``, ``final_urls``, or - ``mobile_final_urls``. - real_time_bidding_setting (google.ads.googleads.v6.common.types.RealTimeBiddingSetting): - Settings for Real-Time Bidding, a feature - only available for campaigns targeting the Ad - Exchange network. - network_settings (google.ads.googleads.v6.resources.types.Campaign.NetworkSettings): - The network settings for the campaign. - hotel_setting (google.ads.googleads.v6.resources.types.Campaign.HotelSettingInfo): - Immutable. The hotel setting for the - campaign. - dynamic_search_ads_setting (google.ads.googleads.v6.resources.types.Campaign.DynamicSearchAdsSetting): - The setting for controlling Dynamic Search - Ads (DSA). - shopping_setting (google.ads.googleads.v6.resources.types.Campaign.ShoppingSetting): - The setting for controlling Shopping - campaigns. - targeting_setting (google.ads.googleads.v6.common.types.TargetingSetting): - Setting for targeting related features. - geo_target_type_setting (google.ads.googleads.v6.resources.types.Campaign.GeoTargetTypeSetting): - The setting for ads geotargeting. - local_campaign_setting (google.ads.googleads.v6.resources.types.Campaign.LocalCampaignSetting): - The setting for local campaign. - app_campaign_setting (google.ads.googleads.v6.resources.types.Campaign.AppCampaignSetting): - The setting related to App Campaign. - labels (Sequence[str]): - Output only. The resource names of labels - attached to this campaign. - experiment_type (google.ads.googleads.v6.enums.types.CampaignExperimentTypeEnum.CampaignExperimentType): - Output only. The type of campaign: normal, - draft, or experiment. - base_campaign (str): - Output only. The resource name of the base campaign of a - draft or experiment campaign. For base campaigns, this is - equal to ``resource_name``. - - This field is read-only. - campaign_budget (str): - The budget of the campaign. - bidding_strategy_type (google.ads.googleads.v6.enums.types.BiddingStrategyTypeEnum.BiddingStrategyType): - Output only. The type of bidding strategy. - - A bidding strategy can be created by setting either the - bidding scheme to create a standard bidding strategy or the - ``bidding_strategy`` field to create a portfolio bidding - strategy. - - This field is read-only. - start_date (str): - The date when campaign started. - end_date (str): - The last day of the campaign. - final_url_suffix (str): - Suffix used to append query parameters to - landing pages that are served with parallel - tracking. - frequency_caps (Sequence[google.ads.googleads.v6.common.types.FrequencyCapEntry]): - A list that limits how often each user will - see this campaign's ads. - video_brand_safety_suitability (google.ads.googleads.v6.enums.types.BrandSafetySuitabilityEnum.BrandSafetySuitability): - Output only. 3-Tier Brand Safety setting for - the campaign. - vanity_pharma (google.ads.googleads.v6.resources.types.Campaign.VanityPharma): - Describes how unbranded pharma ads will be - displayed. - selective_optimization (google.ads.googleads.v6.resources.types.Campaign.SelectiveOptimization): - Selective optimization setting for this - campaign, which includes a set of conversion - actions to optimize this campaign towards. - optimization_goal_setting (google.ads.googleads.v6.resources.types.Campaign.OptimizationGoalSetting): - Optimization goal setting for this campaign, - which includes a set of optimization goal types. - tracking_setting (google.ads.googleads.v6.resources.types.Campaign.TrackingSetting): - Output only. Campaign-level settings for - tracking information. - payment_mode (google.ads.googleads.v6.enums.types.PaymentModeEnum.PaymentMode): - Payment mode for the campaign. - optimization_score (float): - Output only. Optimization score of the - campaign. - Optimization score is an estimate of how well a - campaign is set to perform. It ranges from 0% - (0.0) to 100% (1.0), with 100% indicating that - the campaign is performing at full potential. - This field is null for unscored campaigns. - - See "About optimization score" at - https://support.google.com/google- - ads/answer/9061546. - This field is read-only. - bidding_strategy (str): - Portfolio bidding strategy used by campaign. - commission (google.ads.googleads.v6.common.types.Commission): - Commission is an automatic bidding strategy - in which the advertiser pays a certain portion - of the conversion value. - manual_cpc (google.ads.googleads.v6.common.types.ManualCpc): - Standard Manual CPC bidding strategy. - Manual click-based bidding where user pays per - click. - manual_cpm (google.ads.googleads.v6.common.types.ManualCpm): - Standard Manual CPM bidding strategy. - Manual impression-based bidding where user pays - per thousand impressions. - manual_cpv (google.ads.googleads.v6.common.types.ManualCpv): - Output only. A bidding strategy that pays a - configurable amount per video view. - maximize_conversions (google.ads.googleads.v6.common.types.MaximizeConversions): - Standard Maximize Conversions bidding - strategy that automatically maximizes number of - conversions while spending your budget. - maximize_conversion_value (google.ads.googleads.v6.common.types.MaximizeConversionValue): - Standard Maximize Conversion Value bidding - strategy that automatically sets bids to - maximize revenue while spending your budget. - target_cpa (google.ads.googleads.v6.common.types.TargetCpa): - Standard Target CPA bidding strategy that - automatically sets bids to help get as many - conversions as possible at the target cost-per- - acquisition (CPA) you set. - target_impression_share (google.ads.googleads.v6.common.types.TargetImpressionShare): - Target Impression Share bidding strategy. An - automated bidding strategy that sets bids to - achieve a desired percentage of impressions. - target_roas (google.ads.googleads.v6.common.types.TargetRoas): - Standard Target ROAS bidding strategy that - automatically maximizes revenue while averaging - a specific target return on ad spend (ROAS). - target_spend (google.ads.googleads.v6.common.types.TargetSpend): - Standard Target Spend bidding strategy that - automatically sets your bids to help get as many - clicks as possible within your budget. - percent_cpc (google.ads.googleads.v6.common.types.PercentCpc): - Standard Percent Cpc bidding strategy where - bids are a fraction of the advertised price for - some good or service. - target_cpm (google.ads.googleads.v6.common.types.TargetCpm): - A bidding strategy that automatically - optimizes cost per thousand impressions. - """ - - class NetworkSettings(proto.Message): - r"""The network settings for the campaign. - - Attributes: - target_google_search (bool): - Whether ads will be served with google.com - search results. - target_search_network (bool): - Whether ads will be served on partner sites in the Google - Search Network (requires ``target_google_search`` to also be - ``true``). - target_content_network (bool): - Whether ads will be served on specified - placements in the Google Display Network. - Placements are specified using the Placement - criterion. - target_partner_search_network (bool): - Whether ads will be served on the Google - Partner Network. This is available only to some - select Google partner accounts. - """ - - target_google_search = proto.Field(proto.BOOL, number=5, optional=True) - target_search_network = proto.Field(proto.BOOL, number=6, optional=True) - target_content_network = proto.Field( - proto.BOOL, number=7, optional=True - ) - target_partner_search_network = proto.Field( - proto.BOOL, number=8, optional=True - ) - - class HotelSettingInfo(proto.Message): - r"""Campaign-level settings for hotel ads. - - Attributes: - hotel_center_id (int): - Immutable. The linked Hotel Center account. - """ - - hotel_center_id = proto.Field(proto.INT64, number=2, optional=True) - - class VanityPharma(proto.Message): - r"""Describes how unbranded pharma ads will be displayed. - - Attributes: - vanity_pharma_display_url_mode (google.ads.googleads.v6.enums.types.VanityPharmaDisplayUrlModeEnum.VanityPharmaDisplayUrlMode): - The display mode for vanity pharma URLs. - vanity_pharma_text (google.ads.googleads.v6.enums.types.VanityPharmaTextEnum.VanityPharmaText): - The text that will be displayed in display - URL of the text ad when website description is - the selected display mode for vanity pharma - URLs. - """ - - vanity_pharma_display_url_mode = proto.Field( - proto.ENUM, - number=1, - enum=gage_vanity_pharma_display_url_mode.VanityPharmaDisplayUrlModeEnum.VanityPharmaDisplayUrlMode, - ) - vanity_pharma_text = proto.Field( - proto.ENUM, - number=2, - enum=gage_vanity_pharma_text.VanityPharmaTextEnum.VanityPharmaText, - ) - - class DynamicSearchAdsSetting(proto.Message): - r"""The setting for controlling Dynamic Search Ads (DSA). - - Attributes: - domain_name (str): - Required. The Internet domain name that this - setting represents, e.g., "google.com" or - "www.google.com". - language_code (str): - Required. The language code specifying the - language of the domain, e.g., "en". - use_supplied_urls_only (bool): - Whether the campaign uses advertiser supplied - URLs exclusively. - feeds (Sequence[str]): - The list of page feeds associated with the - campaign. - """ - - domain_name = proto.Field(proto.STRING, number=6) - language_code = proto.Field(proto.STRING, number=7) - use_supplied_urls_only = proto.Field( - proto.BOOL, number=8, optional=True - ) - feeds = proto.RepeatedField(proto.STRING, number=9) - - class SelectiveOptimization(proto.Message): - r"""Selective optimization setting for this campaign, which - includes a set of conversion actions to optimize this campaign - towards. - - Attributes: - conversion_actions (Sequence[str]): - The selected set of conversion actions for - optimizing this campaign. - """ - - conversion_actions = proto.RepeatedField(proto.STRING, number=2) - - class AppCampaignSetting(proto.Message): - r"""Campaign-level settings for App Campaigns. - - Attributes: - bidding_strategy_goal_type (google.ads.googleads.v6.enums.types.AppCampaignBiddingStrategyGoalTypeEnum.AppCampaignBiddingStrategyGoalType): - Represents the goal which the bidding - strategy of this app campaign should optimize - towards. - app_id (str): - Immutable. A string that uniquely identifies - a mobile application. - app_store (google.ads.googleads.v6.enums.types.AppCampaignAppStoreEnum.AppCampaignAppStore): - Immutable. The application store that - distributes this specific app. - """ - - bidding_strategy_goal_type = proto.Field( - proto.ENUM, - number=1, - enum=app_campaign_bidding_strategy_goal_type.AppCampaignBiddingStrategyGoalTypeEnum.AppCampaignBiddingStrategyGoalType, - ) - app_id = proto.Field(proto.STRING, number=4, optional=True) - app_store = proto.Field( - proto.ENUM, - number=3, - enum=app_campaign_app_store.AppCampaignAppStoreEnum.AppCampaignAppStore, - ) - - class ShoppingSetting(proto.Message): - r"""The setting for Shopping campaigns. Defines the universe of - products that can be advertised by the campaign, and how this - campaign interacts with other Shopping campaigns. - - Attributes: - merchant_id (int): - Immutable. ID of the Merchant Center account. - This field is required for create operations. - This field is immutable for Shopping campaigns. - sales_country (str): - Immutable. Sales country of products to - include in the campaign. This field is required - for Shopping campaigns. This field is immutable. - This field is optional for non-Shopping - campaigns, but it must be equal to 'ZZ' if set. - campaign_priority (int): - Priority of the campaign. Campaigns with - numerically higher priorities take precedence - over those with lower priorities. This field is - required for Shopping campaigns, with values - between 0 and 2, inclusive. - This field is optional for Smart Shopping - campaigns, but must be equal to 3 if set. - enable_local (bool): - Whether to include local products. - """ - - merchant_id = proto.Field(proto.INT64, number=5, optional=True) - sales_country = proto.Field(proto.STRING, number=6, optional=True) - campaign_priority = proto.Field(proto.INT32, number=7, optional=True) - enable_local = proto.Field(proto.BOOL, number=8, optional=True) - - class TrackingSetting(proto.Message): - r"""Campaign-level settings for tracking information. - - Attributes: - tracking_url (str): - Output only. The url used for dynamic - tracking. - """ - - tracking_url = proto.Field(proto.STRING, number=2, optional=True) - - class GeoTargetTypeSetting(proto.Message): - r"""Represents a collection of settings related to ads - geotargeting. - - Attributes: - positive_geo_target_type (google.ads.googleads.v6.enums.types.PositiveGeoTargetTypeEnum.PositiveGeoTargetType): - The setting used for positive geotargeting in - this particular campaign. - negative_geo_target_type (google.ads.googleads.v6.enums.types.NegativeGeoTargetTypeEnum.NegativeGeoTargetType): - The setting used for negative geotargeting in - this particular campaign. - """ - - positive_geo_target_type = proto.Field( - proto.ENUM, - number=1, - enum=gage_positive_geo_target_type.PositiveGeoTargetTypeEnum.PositiveGeoTargetType, - ) - negative_geo_target_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_negative_geo_target_type.NegativeGeoTargetTypeEnum.NegativeGeoTargetType, - ) - - class LocalCampaignSetting(proto.Message): - r"""Campaign setting for local campaigns. - - Attributes: - location_source_type (google.ads.googleads.v6.enums.types.LocationSourceTypeEnum.LocationSourceType): - The location source type for this local - campaign. - """ - - location_source_type = proto.Field( - proto.ENUM, - number=1, - enum=gage_location_source_type.LocationSourceTypeEnum.LocationSourceType, - ) - - class OptimizationGoalSetting(proto.Message): - r"""Optimization goal setting for this campaign, which includes a - set of optimization goal types. - - Attributes: - optimization_goal_types (Sequence[google.ads.googleads.v6.enums.types.OptimizationGoalTypeEnum.OptimizationGoalType]): - The list of optimization goal types. - """ - - optimization_goal_types = proto.RepeatedField( - proto.ENUM, - number=1, - enum=optimization_goal_type.OptimizationGoalTypeEnum.OptimizationGoalType, - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=59, optional=True) - name = proto.Field(proto.STRING, number=58, optional=True) - status = proto.Field( - proto.ENUM, - number=5, - enum=campaign_status.CampaignStatusEnum.CampaignStatus, - ) - serving_status = proto.Field( - proto.ENUM, - number=21, - enum=campaign_serving_status.CampaignServingStatusEnum.CampaignServingStatus, - ) - ad_serving_optimization_status = proto.Field( - proto.ENUM, - number=8, - enum=gage_ad_serving_optimization_status.AdServingOptimizationStatusEnum.AdServingOptimizationStatus, - ) - advertising_channel_type = proto.Field( - proto.ENUM, - number=9, - enum=gage_advertising_channel_type.AdvertisingChannelTypeEnum.AdvertisingChannelType, - ) - advertising_channel_sub_type = proto.Field( - proto.ENUM, - number=10, - enum=gage_advertising_channel_sub_type.AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType, - ) - tracking_url_template = proto.Field(proto.STRING, number=60, optional=True) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=12, message=custom_parameter.CustomParameter, - ) - real_time_bidding_setting = proto.Field( - proto.MESSAGE, - number=39, - message=gagc_real_time_bidding_setting.RealTimeBiddingSetting, - ) - network_settings = proto.Field( - proto.MESSAGE, number=14, message=NetworkSettings, - ) - hotel_setting = proto.Field( - proto.MESSAGE, number=32, message=HotelSettingInfo, - ) - dynamic_search_ads_setting = proto.Field( - proto.MESSAGE, number=33, message=DynamicSearchAdsSetting, - ) - shopping_setting = proto.Field( - proto.MESSAGE, number=36, message=ShoppingSetting, - ) - targeting_setting = proto.Field( - proto.MESSAGE, - number=43, - message=gagc_targeting_setting.TargetingSetting, - ) - geo_target_type_setting = proto.Field( - proto.MESSAGE, number=47, message=GeoTargetTypeSetting, - ) - local_campaign_setting = proto.Field( - proto.MESSAGE, number=50, message=LocalCampaignSetting, - ) - app_campaign_setting = proto.Field( - proto.MESSAGE, number=51, message=AppCampaignSetting, - ) - labels = proto.RepeatedField(proto.STRING, number=61) - experiment_type = proto.Field( - proto.ENUM, - number=17, - enum=campaign_experiment_type.CampaignExperimentTypeEnum.CampaignExperimentType, - ) - base_campaign = proto.Field(proto.STRING, number=56, optional=True) - campaign_budget = proto.Field(proto.STRING, number=62, optional=True) - bidding_strategy_type = proto.Field( - proto.ENUM, - number=22, - enum=gage_bidding_strategy_type.BiddingStrategyTypeEnum.BiddingStrategyType, - ) - start_date = proto.Field(proto.STRING, number=63, optional=True) - end_date = proto.Field(proto.STRING, number=64, optional=True) - final_url_suffix = proto.Field(proto.STRING, number=65, optional=True) - frequency_caps = proto.RepeatedField( - proto.MESSAGE, number=40, message=frequency_cap.FrequencyCapEntry, - ) - video_brand_safety_suitability = proto.Field( - proto.ENUM, - number=42, - enum=brand_safety_suitability.BrandSafetySuitabilityEnum.BrandSafetySuitability, - ) - vanity_pharma = proto.Field(proto.MESSAGE, number=44, message=VanityPharma,) - selective_optimization = proto.Field( - proto.MESSAGE, number=45, message=SelectiveOptimization, - ) - optimization_goal_setting = proto.Field( - proto.MESSAGE, number=54, message=OptimizationGoalSetting, - ) - tracking_setting = proto.Field( - proto.MESSAGE, number=46, message=TrackingSetting, - ) - payment_mode = proto.Field( - proto.ENUM, - number=52, - enum=gage_payment_mode.PaymentModeEnum.PaymentMode, - ) - optimization_score = proto.Field(proto.DOUBLE, number=66, optional=True) - bidding_strategy = proto.Field( - proto.STRING, number=67, oneof="campaign_bidding_strategy" - ) - commission = proto.Field( - proto.MESSAGE, - number=49, - oneof="campaign_bidding_strategy", - message=bidding.Commission, - ) - manual_cpc = proto.Field( - proto.MESSAGE, - number=24, - oneof="campaign_bidding_strategy", - message=bidding.ManualCpc, - ) - manual_cpm = proto.Field( - proto.MESSAGE, - number=25, - oneof="campaign_bidding_strategy", - message=bidding.ManualCpm, - ) - manual_cpv = proto.Field( - proto.MESSAGE, - number=37, - oneof="campaign_bidding_strategy", - message=bidding.ManualCpv, - ) - maximize_conversions = proto.Field( - proto.MESSAGE, - number=30, - oneof="campaign_bidding_strategy", - message=bidding.MaximizeConversions, - ) - maximize_conversion_value = proto.Field( - proto.MESSAGE, - number=31, - oneof="campaign_bidding_strategy", - message=bidding.MaximizeConversionValue, - ) - target_cpa = proto.Field( - proto.MESSAGE, - number=26, - oneof="campaign_bidding_strategy", - message=bidding.TargetCpa, - ) - target_impression_share = proto.Field( - proto.MESSAGE, - number=48, - oneof="campaign_bidding_strategy", - message=bidding.TargetImpressionShare, - ) - target_roas = proto.Field( - proto.MESSAGE, - number=29, - oneof="campaign_bidding_strategy", - message=bidding.TargetRoas, - ) - target_spend = proto.Field( - proto.MESSAGE, - number=27, - oneof="campaign_bidding_strategy", - message=bidding.TargetSpend, - ) - percent_cpc = proto.Field( - proto.MESSAGE, - number=34, - oneof="campaign_bidding_strategy", - message=bidding.PercentCpc, - ) - target_cpm = proto.Field( - proto.MESSAGE, - number=41, - oneof="campaign_bidding_strategy", - message=bidding.TargetCpm, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_asset.py b/google/ads/googleads/v6/resources/types/campaign_asset.py deleted file mode 100644 index 9da8e80e4..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_asset.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import asset_field_type -from google.ads.googleads.v6.enums.types import asset_link_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignAsset",}, -) - - -class CampaignAsset(proto.Message): - r"""A link between a Campaign and an Asset. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign asset. - CampaignAsset resource names have the form: - - ``customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}`` - campaign (str): - Immutable. The campaign to which the asset is - linked. - asset (str): - Immutable. The asset which is linked to the - campaign. - field_type (google.ads.googleads.v6.enums.types.AssetFieldTypeEnum.AssetFieldType): - Immutable. Role that the asset takes under - the linked campaign. Required. - status (google.ads.googleads.v6.enums.types.AssetLinkStatusEnum.AssetLinkStatus): - Output only. Status of the campaign asset. - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=6, optional=True) - asset = proto.Field(proto.STRING, number=7, optional=True) - field_type = proto.Field( - proto.ENUM, - number=4, - enum=asset_field_type.AssetFieldTypeEnum.AssetFieldType, - ) - status = proto.Field( - proto.ENUM, - number=5, - enum=asset_link_status.AssetLinkStatusEnum.AssetLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_audience_view.py b/google/ads/googleads/v6/resources/types/campaign_audience_view.py deleted file mode 100644 index a04414943..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_audience_view.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignAudienceView",}, -) - - -class CampaignAudienceView(proto.Message): - r"""A campaign audience view. - Includes performance data from interests and remarketing lists - for Display Network and YouTube Network ads, and remarketing - lists for search ads (RLSA), aggregated by campaign and audience - criterion. This view only includes audiences attached at the - campaign level. - - Attributes: - resource_name (str): - Output only. The resource name of the campaign audience - view. Campaign audience view resource names have the form: - - ``customers/{customer_id}/campaignAudienceViews/{campaign_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_bid_modifier.py b/google/ads/googleads/v6/resources/types/campaign_bid_modifier.py deleted file mode 100644 index fc46e3f87..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_bid_modifier.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignBidModifier",}, -) - - -class CampaignBidModifier(proto.Message): - r"""Represents a bid-modifiable only criterion at the campaign - level. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign bid modifier. - Campaign bid modifier resource names have the form: - - ``customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}`` - campaign (str): - Output only. The campaign to which this - criterion belongs. - criterion_id (int): - Output only. The ID of the criterion to bid - modify. - This field is ignored for mutates. - bid_modifier (float): - The modifier for the bid when the criterion - matches. - interaction_type (google.ads.googleads.v6.common.types.InteractionTypeInfo): - Immutable. Criterion for interaction type. - Only supported for search campaigns. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=6, optional=True) - criterion_id = proto.Field(proto.INT64, number=7, optional=True) - bid_modifier = proto.Field(proto.DOUBLE, number=8, optional=True) - interaction_type = proto.Field( - proto.MESSAGE, - number=5, - oneof="criterion", - message=criteria.InteractionTypeInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_budget.py b/google/ads/googleads/v6/resources/types/campaign_budget.py deleted file mode 100644 index 97b82b212..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_budget.py +++ /dev/null @@ -1,183 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import budget_delivery_method -from google.ads.googleads.v6.enums.types import budget_period -from google.ads.googleads.v6.enums.types import budget_status -from google.ads.googleads.v6.enums.types import budget_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignBudget",}, -) - - -class CampaignBudget(proto.Message): - r"""A campaign budget. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign budget. - Campaign budget resource names have the form: - - ``customers/{customer_id}/campaignBudgets/{campaign_budget_id}`` - id (int): - Output only. The ID of the campaign budget. - A campaign budget is created using the - CampaignBudgetService create operation and is - assigned a budget ID. A budget ID can be shared - across different campaigns; the system will then - allocate the campaign budget among different - campaigns to get optimum results. - name (str): - The name of the campaign budget. - When creating a campaign budget through - CampaignBudgetService, every explicitly shared - campaign budget must have a non-null, non-empty - name. Campaign budgets that are not explicitly - shared derive their name from the attached - campaign's name. - - The length of this string must be between 1 and - 255, inclusive, in UTF-8 bytes, (trimmed). - amount_micros (int): - The amount of the budget, in the local - currency for the account. Amount is specified in - micros, where one million is equivalent to one - currency unit. Monthly spend is capped at 30.4 - times this amount. - total_amount_micros (int): - The lifetime amount of the budget, in the - local currency for the account. Amount is - specified in micros, where one million is - equivalent to one currency unit. - status (google.ads.googleads.v6.enums.types.BudgetStatusEnum.BudgetStatus): - Output only. The status of this campaign - budget. This field is read-only. - delivery_method (google.ads.googleads.v6.enums.types.BudgetDeliveryMethodEnum.BudgetDeliveryMethod): - The delivery method that determines the rate - at which the campaign budget is spent. - - Defaults to STANDARD if unspecified in a create - operation. - explicitly_shared (bool): - Specifies whether the budget is explicitly - shared. Defaults to true if unspecified in a - create operation. - If true, the budget was created with the purpose - of sharing across one or more campaigns. - - If false, the budget was created with the - intention of only being used with a single - campaign. The budget's name and status will stay - in sync with the campaign's name and status. - Attempting to share the budget with a second - campaign will result in an error. - - A non-shared budget can become an explicitly - shared. The same operation must also assign the - budget a name. - - A shared campaign budget can never become non- - shared. - reference_count (int): - Output only. The number of campaigns actively - using the budget. - This field is read-only. - has_recommended_budget (bool): - Output only. Indicates whether there is a - recommended budget for this campaign budget. - This field is read-only. - recommended_budget_amount_micros (int): - Output only. The recommended budget amount. - If no recommendation is available, this will be - set to the budget amount. Amount is specified in - micros, where one million is equivalent to one - currency unit. - - This field is read-only. - period (google.ads.googleads.v6.enums.types.BudgetPeriodEnum.BudgetPeriod): - Immutable. Period over which to spend the - budget. Defaults to DAILY if not specified. - recommended_budget_estimated_change_weekly_clicks (int): - Output only. The estimated change in weekly - clicks if the recommended budget is applied. - This field is read-only. - recommended_budget_estimated_change_weekly_cost_micros (int): - Output only. The estimated change in weekly - cost in micros if the recommended budget is - applied. One million is equivalent to one - currency unit. - This field is read-only. - recommended_budget_estimated_change_weekly_interactions (int): - Output only. The estimated change in weekly - interactions if the recommended budget is - applied. - This field is read-only. - recommended_budget_estimated_change_weekly_views (int): - Output only. The estimated change in weekly - views if the recommended budget is applied. - This field is read-only. - type_ (google.ads.googleads.v6.enums.types.BudgetTypeEnum.BudgetType): - Immutable. The type of the campaign budget. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=19, optional=True) - name = proto.Field(proto.STRING, number=20, optional=True) - amount_micros = proto.Field(proto.INT64, number=21, optional=True) - total_amount_micros = proto.Field(proto.INT64, number=22, optional=True) - status = proto.Field( - proto.ENUM, number=6, enum=budget_status.BudgetStatusEnum.BudgetStatus, - ) - delivery_method = proto.Field( - proto.ENUM, - number=7, - enum=budget_delivery_method.BudgetDeliveryMethodEnum.BudgetDeliveryMethod, - ) - explicitly_shared = proto.Field(proto.BOOL, number=23, optional=True) - reference_count = proto.Field(proto.INT64, number=24, optional=True) - has_recommended_budget = proto.Field(proto.BOOL, number=25, optional=True) - recommended_budget_amount_micros = proto.Field( - proto.INT64, number=26, optional=True - ) - period = proto.Field( - proto.ENUM, number=13, enum=budget_period.BudgetPeriodEnum.BudgetPeriod, - ) - recommended_budget_estimated_change_weekly_clicks = proto.Field( - proto.INT64, number=27, optional=True - ) - recommended_budget_estimated_change_weekly_cost_micros = proto.Field( - proto.INT64, number=28, optional=True - ) - recommended_budget_estimated_change_weekly_interactions = proto.Field( - proto.INT64, number=29, optional=True - ) - recommended_budget_estimated_change_weekly_views = proto.Field( - proto.INT64, number=30, optional=True - ) - type_ = proto.Field( - proto.ENUM, number=18, enum=budget_type.BudgetTypeEnum.BudgetType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_criterion.py b/google/ads/googleads/v6/resources/types/campaign_criterion.py deleted file mode 100644 index 11b9c4963..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_criterion.py +++ /dev/null @@ -1,308 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import campaign_criterion_status -from google.ads.googleads.v6.enums.types import criterion_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignCriterion",}, -) - - -class CampaignCriterion(proto.Message): - r"""A campaign criterion. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign criterion. - Campaign criterion resource names have the form: - - ``customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}`` - campaign (str): - Immutable. The campaign to which the - criterion belongs. - criterion_id (int): - Output only. The ID of the criterion. - This field is ignored during mutate. - bid_modifier (float): - The modifier for the bids when the criterion - matches. The modifier must be in the range: 0.1 - - 10.0. Most targetable criteria types support - modifiers. Use 0 to opt out of a Device type. - negative (bool): - Immutable. Whether to target (``false``) or exclude - (``true``) the criterion. - type_ (google.ads.googleads.v6.enums.types.CriterionTypeEnum.CriterionType): - Output only. The type of the criterion. - status (google.ads.googleads.v6.enums.types.CampaignCriterionStatusEnum.CampaignCriterionStatus): - The status of the criterion. - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Immutable. Keyword. - placement (google.ads.googleads.v6.common.types.PlacementInfo): - Immutable. Placement. - mobile_app_category (google.ads.googleads.v6.common.types.MobileAppCategoryInfo): - Immutable. Mobile app category. - mobile_application (google.ads.googleads.v6.common.types.MobileApplicationInfo): - Immutable. Mobile application. - location (google.ads.googleads.v6.common.types.LocationInfo): - Immutable. Location. - device (google.ads.googleads.v6.common.types.DeviceInfo): - Immutable. Device. - ad_schedule (google.ads.googleads.v6.common.types.AdScheduleInfo): - Immutable. Ad Schedule. - age_range (google.ads.googleads.v6.common.types.AgeRangeInfo): - Immutable. Age range. - gender (google.ads.googleads.v6.common.types.GenderInfo): - Immutable. Gender. - income_range (google.ads.googleads.v6.common.types.IncomeRangeInfo): - Immutable. Income range. - parental_status (google.ads.googleads.v6.common.types.ParentalStatusInfo): - Immutable. Parental status. - user_list (google.ads.googleads.v6.common.types.UserListInfo): - Immutable. User List. - youtube_video (google.ads.googleads.v6.common.types.YouTubeVideoInfo): - Immutable. YouTube Video. - youtube_channel (google.ads.googleads.v6.common.types.YouTubeChannelInfo): - Immutable. YouTube Channel. - proximity (google.ads.googleads.v6.common.types.ProximityInfo): - Immutable. Proximity. - topic (google.ads.googleads.v6.common.types.TopicInfo): - Immutable. Topic. - listing_scope (google.ads.googleads.v6.common.types.ListingScopeInfo): - Immutable. Listing scope. - language (google.ads.googleads.v6.common.types.LanguageInfo): - Immutable. Language. - ip_block (google.ads.googleads.v6.common.types.IpBlockInfo): - Immutable. IpBlock. - content_label (google.ads.googleads.v6.common.types.ContentLabelInfo): - Immutable. ContentLabel. - carrier (google.ads.googleads.v6.common.types.CarrierInfo): - Immutable. Carrier. - user_interest (google.ads.googleads.v6.common.types.UserInterestInfo): - Immutable. User Interest. - webpage (google.ads.googleads.v6.common.types.WebpageInfo): - Immutable. Webpage. - operating_system_version (google.ads.googleads.v6.common.types.OperatingSystemVersionInfo): - Immutable. Operating system version. - mobile_device (google.ads.googleads.v6.common.types.MobileDeviceInfo): - Immutable. Mobile Device. - location_group (google.ads.googleads.v6.common.types.LocationGroupInfo): - Immutable. Location Group - custom_affinity (google.ads.googleads.v6.common.types.CustomAffinityInfo): - Immutable. Custom Affinity. - custom_audience (google.ads.googleads.v6.common.types.CustomAudienceInfo): - Immutable. Custom Audience - combined_audience (google.ads.googleads.v6.common.types.CombinedAudienceInfo): - Immutable. Combined Audience. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=37, optional=True) - criterion_id = proto.Field(proto.INT64, number=38, optional=True) - bid_modifier = proto.Field(proto.FLOAT, number=39, optional=True) - negative = proto.Field(proto.BOOL, number=40, optional=True) - type_ = proto.Field( - proto.ENUM, - number=6, - enum=criterion_type.CriterionTypeEnum.CriterionType, - ) - status = proto.Field( - proto.ENUM, - number=35, - enum=campaign_criterion_status.CampaignCriterionStatusEnum.CampaignCriterionStatus, - ) - keyword = proto.Field( - proto.MESSAGE, - number=8, - oneof="criterion", - message=criteria.KeywordInfo, - ) - placement = proto.Field( - proto.MESSAGE, - number=9, - oneof="criterion", - message=criteria.PlacementInfo, - ) - mobile_app_category = proto.Field( - proto.MESSAGE, - number=10, - oneof="criterion", - message=criteria.MobileAppCategoryInfo, - ) - mobile_application = proto.Field( - proto.MESSAGE, - number=11, - oneof="criterion", - message=criteria.MobileApplicationInfo, - ) - location = proto.Field( - proto.MESSAGE, - number=12, - oneof="criterion", - message=criteria.LocationInfo, - ) - device = proto.Field( - proto.MESSAGE, - number=13, - oneof="criterion", - message=criteria.DeviceInfo, - ) - ad_schedule = proto.Field( - proto.MESSAGE, - number=15, - oneof="criterion", - message=criteria.AdScheduleInfo, - ) - age_range = proto.Field( - proto.MESSAGE, - number=16, - oneof="criterion", - message=criteria.AgeRangeInfo, - ) - gender = proto.Field( - proto.MESSAGE, - number=17, - oneof="criterion", - message=criteria.GenderInfo, - ) - income_range = proto.Field( - proto.MESSAGE, - number=18, - oneof="criterion", - message=criteria.IncomeRangeInfo, - ) - parental_status = proto.Field( - proto.MESSAGE, - number=19, - oneof="criterion", - message=criteria.ParentalStatusInfo, - ) - user_list = proto.Field( - proto.MESSAGE, - number=22, - oneof="criterion", - message=criteria.UserListInfo, - ) - youtube_video = proto.Field( - proto.MESSAGE, - number=20, - oneof="criterion", - message=criteria.YouTubeVideoInfo, - ) - youtube_channel = proto.Field( - proto.MESSAGE, - number=21, - oneof="criterion", - message=criteria.YouTubeChannelInfo, - ) - proximity = proto.Field( - proto.MESSAGE, - number=23, - oneof="criterion", - message=criteria.ProximityInfo, - ) - topic = proto.Field( - proto.MESSAGE, number=24, oneof="criterion", message=criteria.TopicInfo, - ) - listing_scope = proto.Field( - proto.MESSAGE, - number=25, - oneof="criterion", - message=criteria.ListingScopeInfo, - ) - language = proto.Field( - proto.MESSAGE, - number=26, - oneof="criterion", - message=criteria.LanguageInfo, - ) - ip_block = proto.Field( - proto.MESSAGE, - number=27, - oneof="criterion", - message=criteria.IpBlockInfo, - ) - content_label = proto.Field( - proto.MESSAGE, - number=28, - oneof="criterion", - message=criteria.ContentLabelInfo, - ) - carrier = proto.Field( - proto.MESSAGE, - number=29, - oneof="criterion", - message=criteria.CarrierInfo, - ) - user_interest = proto.Field( - proto.MESSAGE, - number=30, - oneof="criterion", - message=criteria.UserInterestInfo, - ) - webpage = proto.Field( - proto.MESSAGE, - number=31, - oneof="criterion", - message=criteria.WebpageInfo, - ) - operating_system_version = proto.Field( - proto.MESSAGE, - number=32, - oneof="criterion", - message=criteria.OperatingSystemVersionInfo, - ) - mobile_device = proto.Field( - proto.MESSAGE, - number=33, - oneof="criterion", - message=criteria.MobileDeviceInfo, - ) - location_group = proto.Field( - proto.MESSAGE, - number=34, - oneof="criterion", - message=criteria.LocationGroupInfo, - ) - custom_affinity = proto.Field( - proto.MESSAGE, - number=36, - oneof="criterion", - message=criteria.CustomAffinityInfo, - ) - custom_audience = proto.Field( - proto.MESSAGE, - number=41, - oneof="criterion", - message=criteria.CustomAudienceInfo, - ) - combined_audience = proto.Field( - proto.MESSAGE, - number=42, - oneof="criterion", - message=criteria.CombinedAudienceInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_criterion_simulation.py b/google/ads/googleads/v6/resources/types/campaign_criterion_simulation.py deleted file mode 100644 index f08de0e29..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_criterion_simulation.py +++ /dev/null @@ -1,93 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import simulation -from google.ads.googleads.v6.enums.types import simulation_modification_method -from google.ads.googleads.v6.enums.types import simulation_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignCriterionSimulation",}, -) - - -class CampaignCriterionSimulation(proto.Message): - r"""A campaign criterion simulation. Supported combinations of - advertising channel type, criterion ids, simulation type and - simulation modification method is detailed below respectively. - - 1. SEARCH - 30000,30001,30002 - BID_MODIFIER - UNIFORM - 2. SHOPPING - 30000,30001,30002 - BID_MODIFIER - UNIFORM - 3. DISPLAY - 30001 - BID_MODIFIER - UNIFORM - - Attributes: - resource_name (str): - Output only. The resource name of the campaign criterion - simulation. Campaign criterion simulation resource names - have the form: - - ``customers/{customer_id}/campaignCriterionSimulations/{campaign_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}`` - campaign_id (int): - Output only. Campaign ID of the simulation. - criterion_id (int): - Output only. Criterion ID of the simulation. - type_ (google.ads.googleads.v6.enums.types.SimulationTypeEnum.SimulationType): - Output only. The field that the simulation - modifies. - modification_method (google.ads.googleads.v6.enums.types.SimulationModificationMethodEnum.SimulationModificationMethod): - Output only. How the simulation modifies the - field. - start_date (str): - Output only. First day on which the - simulation is based, in YYYY-MM-DD format. - end_date (str): - Output only. Last day on which the simulation - is based, in YYYY-MM-DD format. - bid_modifier_point_list (google.ads.googleads.v6.common.types.BidModifierSimulationPointList): - Output only. Simulation points if the simulation type is - BID_MODIFIER. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_id = proto.Field(proto.INT64, number=9, optional=True) - criterion_id = proto.Field(proto.INT64, number=10, optional=True) - type_ = proto.Field( - proto.ENUM, - number=4, - enum=simulation_type.SimulationTypeEnum.SimulationType, - ) - modification_method = proto.Field( - proto.ENUM, - number=5, - enum=simulation_modification_method.SimulationModificationMethodEnum.SimulationModificationMethod, - ) - start_date = proto.Field(proto.STRING, number=11, optional=True) - end_date = proto.Field(proto.STRING, number=12, optional=True) - bid_modifier_point_list = proto.Field( - proto.MESSAGE, - number=8, - oneof="point_list", - message=simulation.BidModifierSimulationPointList, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_draft.py b/google/ads/googleads/v6/resources/types/campaign_draft.py deleted file mode 100644 index 832c33fbd..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_draft.py +++ /dev/null @@ -1,89 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import campaign_draft_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignDraft",}, -) - - -class CampaignDraft(proto.Message): - r"""A campaign draft. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign draft. Campaign - draft resource names have the form: - - ``customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}`` - draft_id (int): - Output only. The ID of the draft. - This field is read-only. - base_campaign (str): - Immutable. The base campaign to which the - draft belongs. - name (str): - The name of the campaign draft. - This field is required and should not be empty - when creating new campaign drafts. - - It must not contain any null (code point 0x0), - NL line feed (code point 0xA) or carriage return - (code point 0xD) characters. - draft_campaign (str): - Output only. Resource name of the Campaign - that results from overlaying the draft changes - onto the base campaign. - This field is read-only. - status (google.ads.googleads.v6.enums.types.CampaignDraftStatusEnum.CampaignDraftStatus): - Output only. The status of the campaign - draft. This field is read-only. - When a new campaign draft is added, the status - defaults to PROPOSED. - has_experiment_running (bool): - Output only. Whether there is an experiment - based on this draft currently serving. - long_running_operation (str): - Output only. The resource name of the long- - unning operation that can be used to poll for - completion of draft promotion. This is only set - if the draft promotion is in progress or - finished. - """ - - resource_name = proto.Field(proto.STRING, number=1) - draft_id = proto.Field(proto.INT64, number=9, optional=True) - base_campaign = proto.Field(proto.STRING, number=10, optional=True) - name = proto.Field(proto.STRING, number=11, optional=True) - draft_campaign = proto.Field(proto.STRING, number=12, optional=True) - status = proto.Field( - proto.ENUM, - number=6, - enum=campaign_draft_status.CampaignDraftStatusEnum.CampaignDraftStatus, - ) - has_experiment_running = proto.Field(proto.BOOL, number=13, optional=True) - long_running_operation = proto.Field(proto.STRING, number=14, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_experiment.py b/google/ads/googleads/v6/resources/types/campaign_experiment.py deleted file mode 100644 index f76edf446..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_experiment.py +++ /dev/null @@ -1,125 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import campaign_experiment_status -from google.ads.googleads.v6.enums.types import ( - campaign_experiment_traffic_split_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignExperiment",}, -) - - -class CampaignExperiment(proto.Message): - r"""An A/B experiment that compares the performance of the base - campaign (the control) and a variation of that campaign (the - experiment). - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign experiment. - Campaign experiment resource names have the form: - - ``customers/{customer_id}/campaignExperiments/{campaign_experiment_id}`` - id (int): - Output only. The ID of the campaign - experiment. - This field is read-only. - campaign_draft (str): - Immutable. The campaign draft with staged - changes to the base campaign. - name (str): - The name of the campaign experiment. - This field is required when creating new - campaign experiments and must not conflict with - the name of another non-removed campaign - experiment or campaign. - - It must not contain any null (code point 0x0), - NL line feed (code point 0xA) or carriage return - (code point 0xD) characters. - description (str): - The description of the experiment. - traffic_split_percent (int): - Immutable. Share of traffic directed to experiment as a - percent (must be between 1 and 99 inclusive. Base campaign - receives the remainder of the traffic (100 - - traffic_split_percent). Required for create. - traffic_split_type (google.ads.googleads.v6.enums.types.CampaignExperimentTrafficSplitTypeEnum.CampaignExperimentTrafficSplitType): - Immutable. Determines the behavior of the - traffic split. - experiment_campaign (str): - Output only. The experiment campaign, as - opposed to the base campaign. - status (google.ads.googleads.v6.enums.types.CampaignExperimentStatusEnum.CampaignExperimentStatus): - Output only. The status of the campaign - experiment. This field is read-only. - long_running_operation (str): - Output only. The resource name of the long- - unning operation that can be used to poll for - completion of experiment create or promote. The - most recent long running operation is returned. - start_date (str): - Date when the campaign experiment starts. By - default, the experiment starts now or on the - campaign's start date, whichever is later. If - this field is set, then the experiment starts at - the beginning of the specified date in the - customer's time zone. Cannot be changed once the - experiment starts. - Format: YYYY-MM-DD - Example: 2019-03-14 - end_date (str): - The last day of the campaign experiment. By - default, the experiment ends on the campaign's - end date. If this field is set, then the - experiment ends at the end of the specified date - in the customer's time zone. - Format: YYYY-MM-DD - Example: 2019-04-18 - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=13, optional=True) - campaign_draft = proto.Field(proto.STRING, number=14, optional=True) - name = proto.Field(proto.STRING, number=15, optional=True) - description = proto.Field(proto.STRING, number=16, optional=True) - traffic_split_percent = proto.Field(proto.INT64, number=17, optional=True) - traffic_split_type = proto.Field( - proto.ENUM, - number=7, - enum=campaign_experiment_traffic_split_type.CampaignExperimentTrafficSplitTypeEnum.CampaignExperimentTrafficSplitType, - ) - experiment_campaign = proto.Field(proto.STRING, number=18, optional=True) - status = proto.Field( - proto.ENUM, - number=9, - enum=campaign_experiment_status.CampaignExperimentStatusEnum.CampaignExperimentStatus, - ) - long_running_operation = proto.Field(proto.STRING, number=19, optional=True) - start_date = proto.Field(proto.STRING, number=20, optional=True) - end_date = proto.Field(proto.STRING, number=21, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_extension_setting.py b/google/ads/googleads/v6/resources/types/campaign_extension_setting.py deleted file mode 100644 index fbeefad06..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_extension_setting.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import extension_setting_device -from google.ads.googleads.v6.enums.types import ( - extension_type as gage_extension_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignExtensionSetting",}, -) - - -class CampaignExtensionSetting(proto.Message): - r"""A campaign extension setting. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign extension - setting. CampaignExtensionSetting resource names have the - form: - - ``customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}`` - extension_type (google.ads.googleads.v6.enums.types.ExtensionTypeEnum.ExtensionType): - Immutable. The extension type of the customer - extension setting. - campaign (str): - Immutable. The resource name of the campaign. The linked - extension feed items will serve under this campaign. - Campaign resource names have the form: - - ``customers/{customer_id}/campaigns/{campaign_id}`` - extension_feed_items (Sequence[str]): - The resource names of the extension feed items to serve - under the campaign. ExtensionFeedItem resource names have - the form: - - ``customers/{customer_id}/extensionFeedItems/{feed_item_id}`` - device (google.ads.googleads.v6.enums.types.ExtensionSettingDeviceEnum.ExtensionSettingDevice): - The device for which the extensions will - serve. Optional. - """ - - resource_name = proto.Field(proto.STRING, number=1) - extension_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_extension_type.ExtensionTypeEnum.ExtensionType, - ) - campaign = proto.Field(proto.STRING, number=6, optional=True) - extension_feed_items = proto.RepeatedField(proto.STRING, number=7) - device = proto.Field( - proto.ENUM, - number=5, - enum=extension_setting_device.ExtensionSettingDeviceEnum.ExtensionSettingDevice, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_feed.py b/google/ads/googleads/v6/resources/types/campaign_feed.py deleted file mode 100644 index 92da3ee98..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_feed.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import ( - matching_function as gagc_matching_function, -) -from google.ads.googleads.v6.enums.types import feed_link_status -from google.ads.googleads.v6.enums.types import placeholder_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignFeed",}, -) - - -class CampaignFeed(proto.Message): - r"""A campaign feed. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign feed. Campaign - feed resource names have the form: - - \`customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id} - feed (str): - Immutable. The feed to which the CampaignFeed - belongs. - campaign (str): - Immutable. The campaign to which the - CampaignFeed belongs. - placeholder_types (Sequence[google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType]): - Indicates which placeholder types the feed - may populate under the connected campaign. - Required. - matching_function (google.ads.googleads.v6.common.types.MatchingFunction): - Matching function associated with the - CampaignFeed. The matching function is used to - filter the set of feed items selected. Required. - status (google.ads.googleads.v6.enums.types.FeedLinkStatusEnum.FeedLinkStatus): - Output only. Status of the campaign feed. - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=7, optional=True) - campaign = proto.Field(proto.STRING, number=8, optional=True) - placeholder_types = proto.RepeatedField( - proto.ENUM, - number=4, - enum=placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - matching_function = proto.Field( - proto.MESSAGE, - number=5, - message=gagc_matching_function.MatchingFunction, - ) - status = proto.Field( - proto.ENUM, - number=6, - enum=feed_link_status.FeedLinkStatusEnum.FeedLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_label.py b/google/ads/googleads/v6/resources/types/campaign_label.py deleted file mode 100644 index e1bf3e3dc..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_label.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignLabel",}, -) - - -class CampaignLabel(proto.Message): - r"""Represents a relationship between a campaign and a label. - - Attributes: - resource_name (str): - Immutable. Name of the resource. Campaign label resource - names have the form: - ``customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}`` - campaign (str): - Immutable. The campaign to which the label is - attached. - label (str): - Immutable. The label assigned to the - campaign. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=4, optional=True) - label = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/campaign_shared_set.py b/google/ads/googleads/v6/resources/types/campaign_shared_set.py deleted file mode 100644 index 488c83d1f..000000000 --- a/google/ads/googleads/v6/resources/types/campaign_shared_set.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import campaign_shared_set_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CampaignSharedSet",}, -) - - -class CampaignSharedSet(proto.Message): - r"""CampaignSharedSets are used for managing the shared sets - associated with a campaign. - - Attributes: - resource_name (str): - Immutable. The resource name of the campaign shared set. - Campaign shared set resource names have the form: - - ``customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}`` - campaign (str): - Immutable. The campaign to which the campaign - shared set belongs. - shared_set (str): - Immutable. The shared set associated with the - campaign. This may be a negative keyword shared - set of another customer. This customer should be - a manager of the other customer, otherwise the - campaign shared set will exist but have no - serving effect. Only negative keyword shared - sets can be associated with Shopping campaigns. - Only negative placement shared sets can be - associated with Display mobile app campaigns. - status (google.ads.googleads.v6.enums.types.CampaignSharedSetStatusEnum.CampaignSharedSetStatus): - Output only. The status of this campaign - shared set. Read only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=5, optional=True) - shared_set = proto.Field(proto.STRING, number=6, optional=True) - status = proto.Field( - proto.ENUM, - number=2, - enum=campaign_shared_set_status.CampaignSharedSetStatusEnum.CampaignSharedSetStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/carrier_constant.py b/google/ads/googleads/v6/resources/types/carrier_constant.py deleted file mode 100644 index 54235fdb1..000000000 --- a/google/ads/googleads/v6/resources/types/carrier_constant.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CarrierConstant",}, -) - - -class CarrierConstant(proto.Message): - r"""A carrier criterion that can be used in campaign targeting. - - Attributes: - resource_name (str): - Output only. The resource name of the carrier criterion. - Carrier criterion resource names have the form: - - ``carrierConstants/{criterion_id}`` - id (int): - Output only. The ID of the carrier criterion. - name (str): - Output only. The full name of the carrier in - English. - country_code (str): - Output only. The country code of the country - where the carrier is located, e.g., "AR", "FR", - etc. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=5, optional=True) - name = proto.Field(proto.STRING, number=6, optional=True) - country_code = proto.Field(proto.STRING, number=7, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/change_event.py b/google/ads/googleads/v6/resources/types/change_event.py deleted file mode 100644 index 6380d021a..000000000 --- a/google/ads/googleads/v6/resources/types/change_event.py +++ /dev/null @@ -1,228 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import change_client_type -from google.ads.googleads.v6.enums.types import change_event_resource_type -from google.ads.googleads.v6.enums.types import ( - resource_change_operation as gage_resource_change_operation, -) -from google.ads.googleads.v6.resources.types import ad as gagr_ad -from google.ads.googleads.v6.resources.types import ad_group as gagr_ad_group -from google.ads.googleads.v6.resources.types import ( - ad_group_ad as gagr_ad_group_ad, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_bid_modifier as gagr_ad_group_bid_modifier, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion as gagr_ad_group_criterion, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_feed as gagr_ad_group_feed, -) -from google.ads.googleads.v6.resources.types import campaign as gagr_campaign -from google.ads.googleads.v6.resources.types import ( - campaign_budget as gagr_campaign_budget, -) -from google.ads.googleads.v6.resources.types import ( - campaign_criterion as gagr_campaign_criterion, -) -from google.ads.googleads.v6.resources.types import ( - campaign_feed as gagr_campaign_feed, -) -from google.ads.googleads.v6.resources.types import feed as gagr_feed -from google.ads.googleads.v6.resources.types import feed_item as gagr_feed_item -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ChangeEvent",}, -) - - -class ChangeEvent(proto.Message): - r"""Describes the granular change of returned resource of certain - resource types. Changes made through UI, API and new versions of - Editor by external users (including external users, and internal - users that can be shown externally) in the past 30 days will be - shown. The change shows the old values of the changed fields - before the change and the new values right after the change. - ChangeEvent could have up to 3 minutes delay to reflect a new - change. - - Attributes: - resource_name (str): - Output only. The resource name of the change event. Change - event resource names have the form: - - ``customers/{customer_id}/changeEvent/{timestamp_micros}~{command_index}~{mutate_index}`` - change_date_time (str): - Output only. Time at which the change was - committed on this resource. - change_resource_type (google.ads.googleads.v6.enums.types.ChangeEventResourceTypeEnum.ChangeEventResourceType): - Output only. The type of the changed resource. This dictates - what resource will be set in old_resource and new_resource. - change_resource_name (str): - Output only. The Simply resource this change - occurred on. - client_type (google.ads.googleads.v6.enums.types.ChangeClientTypeEnum.ChangeClientType): - Output only. Where the change was made - through. - user_email (str): - Output only. The email of the user who made - this change. - old_resource (google.ads.googleads.v6.resources.types.ChangeEvent.ChangedResource): - Output only. The old resource before the - change. Only changed fields will be populated. - new_resource (google.ads.googleads.v6.resources.types.ChangeEvent.ChangedResource): - Output only. The new resource after the - change. Only changed fields will be populated. - resource_change_operation (google.ads.googleads.v6.enums.types.ResourceChangeOperationEnum.ResourceChangeOperation): - Output only. The operation on the changed - resource. - changed_fields (google.protobuf.field_mask_pb2.FieldMask): - Output only. A list of fields that are - changed in the returned resource. - campaign (str): - Output only. The Campaign affected by this - change. - ad_group (str): - Output only. The AdGroup affected by this - change. - feed (str): - Output only. The Feed affected by this - change. - feed_item (str): - Output only. The FeedItem affected by this - change. - """ - - class ChangedResource(proto.Message): - r"""A wrapper proto presenting all supported resources. Only the - resource of the change_resource_type will be set. - - Attributes: - ad (google.ads.googleads.v6.resources.types.Ad): - Output only. Set if change_resource_type == AD. - ad_group (google.ads.googleads.v6.resources.types.AdGroup): - Output only. Set if change_resource_type == AD_GROUP. - ad_group_criterion (google.ads.googleads.v6.resources.types.AdGroupCriterion): - Output only. Set if change_resource_type == - AD_GROUP_CRITERION. - campaign (google.ads.googleads.v6.resources.types.Campaign): - Output only. Set if change_resource_type == CAMPAIGN. - campaign_budget (google.ads.googleads.v6.resources.types.CampaignBudget): - Output only. Set if change_resource_type == CAMPAIGN_BUDGET. - ad_group_bid_modifier (google.ads.googleads.v6.resources.types.AdGroupBidModifier): - Output only. Set if change_resource_type == - AD_GROUP_BID_MODIFIER. - campaign_criterion (google.ads.googleads.v6.resources.types.CampaignCriterion): - Output only. Set if change_resource_type == - CAMPAIGN_CRITERION. - feed (google.ads.googleads.v6.resources.types.Feed): - Output only. Set if change_resource_type == FEED. - feed_item (google.ads.googleads.v6.resources.types.FeedItem): - Output only. Set if change_resource_type == FEED_ITEM. - campaign_feed (google.ads.googleads.v6.resources.types.CampaignFeed): - Output only. Set if change_resource_type == CAMPAIGN_FEED. - ad_group_feed (google.ads.googleads.v6.resources.types.AdGroupFeed): - Output only. Set if change_resource_type == AD_GROUP_FEED. - ad_group_ad (google.ads.googleads.v6.resources.types.AdGroupAd): - Output only. Set if change_resource_type == AD_GROUP_AD. - """ - - ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) - ad_group = proto.Field( - proto.MESSAGE, number=2, message=gagr_ad_group.AdGroup, - ) - ad_group_criterion = proto.Field( - proto.MESSAGE, - number=3, - message=gagr_ad_group_criterion.AdGroupCriterion, - ) - campaign = proto.Field( - proto.MESSAGE, number=4, message=gagr_campaign.Campaign, - ) - campaign_budget = proto.Field( - proto.MESSAGE, - number=5, - message=gagr_campaign_budget.CampaignBudget, - ) - ad_group_bid_modifier = proto.Field( - proto.MESSAGE, - number=6, - message=gagr_ad_group_bid_modifier.AdGroupBidModifier, - ) - campaign_criterion = proto.Field( - proto.MESSAGE, - number=7, - message=gagr_campaign_criterion.CampaignCriterion, - ) - feed = proto.Field(proto.MESSAGE, number=8, message=gagr_feed.Feed,) - feed_item = proto.Field( - proto.MESSAGE, number=9, message=gagr_feed_item.FeedItem, - ) - campaign_feed = proto.Field( - proto.MESSAGE, number=10, message=gagr_campaign_feed.CampaignFeed, - ) - ad_group_feed = proto.Field( - proto.MESSAGE, number=11, message=gagr_ad_group_feed.AdGroupFeed, - ) - ad_group_ad = proto.Field( - proto.MESSAGE, number=12, message=gagr_ad_group_ad.AdGroupAd, - ) - - resource_name = proto.Field(proto.STRING, number=1) - change_date_time = proto.Field(proto.STRING, number=2) - change_resource_type = proto.Field( - proto.ENUM, - number=3, - enum=change_event_resource_type.ChangeEventResourceTypeEnum.ChangeEventResourceType, - ) - change_resource_name = proto.Field(proto.STRING, number=4) - client_type = proto.Field( - proto.ENUM, - number=5, - enum=change_client_type.ChangeClientTypeEnum.ChangeClientType, - ) - user_email = proto.Field(proto.STRING, number=6) - old_resource = proto.Field( - proto.MESSAGE, number=7, message=ChangedResource, - ) - new_resource = proto.Field( - proto.MESSAGE, number=8, message=ChangedResource, - ) - resource_change_operation = proto.Field( - proto.ENUM, - number=9, - enum=gage_resource_change_operation.ResourceChangeOperationEnum.ResourceChangeOperation, - ) - changed_fields = proto.Field( - proto.MESSAGE, number=10, message=field_mask.FieldMask, - ) - campaign = proto.Field(proto.STRING, number=11) - ad_group = proto.Field(proto.STRING, number=12) - feed = proto.Field(proto.STRING, number=13) - feed_item = proto.Field(proto.STRING, number=14) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/change_status.py b/google/ads/googleads/v6/resources/types/change_status.py deleted file mode 100644 index 93f90cf5e..000000000 --- a/google/ads/googleads/v6/resources/types/change_status.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import change_status_operation -from google.ads.googleads.v6.enums.types import change_status_resource_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ChangeStatus",}, -) - - -class ChangeStatus(proto.Message): - r"""Describes the status of returned resource. ChangeStatus could - have up to 3 minutes delay to reflect a new change. - - Attributes: - resource_name (str): - Output only. The resource name of the change status. Change - status resource names have the form: - - ``customers/{customer_id}/changeStatus/{change_status_id}`` - last_change_date_time (str): - Output only. Time at which the most recent - change has occurred on this resource. - resource_type (google.ads.googleads.v6.enums.types.ChangeStatusResourceTypeEnum.ChangeStatusResourceType): - Output only. Represents the type of the changed resource. - This dictates what fields will be set. For example, for - AD_GROUP, campaign and ad_group fields will be set. - campaign (str): - Output only. The Campaign affected by this - change. - ad_group (str): - Output only. The AdGroup affected by this - change. - resource_status (google.ads.googleads.v6.enums.types.ChangeStatusOperationEnum.ChangeStatusOperation): - Output only. Represents the status of the - changed resource. - ad_group_ad (str): - Output only. The AdGroupAd affected by this - change. - ad_group_criterion (str): - Output only. The AdGroupCriterion affected by - this change. - campaign_criterion (str): - Output only. The CampaignCriterion affected - by this change. - feed (str): - Output only. The Feed affected by this - change. - feed_item (str): - Output only. The FeedItem affected by this - change. - ad_group_feed (str): - Output only. The AdGroupFeed affected by this - change. - campaign_feed (str): - Output only. The CampaignFeed affected by - this change. - ad_group_bid_modifier (str): - Output only. The AdGroupBidModifier affected - by this change. - """ - - resource_name = proto.Field(proto.STRING, number=1) - last_change_date_time = proto.Field(proto.STRING, number=24, optional=True) - resource_type = proto.Field( - proto.ENUM, - number=4, - enum=change_status_resource_type.ChangeStatusResourceTypeEnum.ChangeStatusResourceType, - ) - campaign = proto.Field(proto.STRING, number=17, optional=True) - ad_group = proto.Field(proto.STRING, number=18, optional=True) - resource_status = proto.Field( - proto.ENUM, - number=8, - enum=change_status_operation.ChangeStatusOperationEnum.ChangeStatusOperation, - ) - ad_group_ad = proto.Field(proto.STRING, number=25, optional=True) - ad_group_criterion = proto.Field(proto.STRING, number=26, optional=True) - campaign_criterion = proto.Field(proto.STRING, number=27, optional=True) - feed = proto.Field(proto.STRING, number=28, optional=True) - feed_item = proto.Field(proto.STRING, number=29, optional=True) - ad_group_feed = proto.Field(proto.STRING, number=30, optional=True) - campaign_feed = proto.Field(proto.STRING, number=31, optional=True) - ad_group_bid_modifier = proto.Field(proto.STRING, number=32, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/click_view.py b/google/ads/googleads/v6/resources/types/click_view.py deleted file mode 100644 index 8477eff79..000000000 --- a/google/ads/googleads/v6/resources/types/click_view.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import click_location - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ClickView",}, -) - - -class ClickView(proto.Message): - r"""A click view with metrics aggregated at each click level, - including both valid and invalid clicks. For non-Search - campaigns, metrics.clicks represents the number of valid and - invalid interactions. Queries including ClickView must have a - filter limiting the results to one day and can be requested for - dates back to 90 days before the time of the request. - - Attributes: - resource_name (str): - Output only. The resource name of the click view. Click view - resource names have the form: - - ``customers/{customer_id}/clickViews/{date (yyyy-MM-dd)}~{gclid}`` - gclid (str): - Output only. The Google Click ID. - area_of_interest (google.ads.googleads.v6.common.types.ClickLocation): - Output only. The location criteria matching - the area of interest associated with the - impression. - location_of_presence (google.ads.googleads.v6.common.types.ClickLocation): - Output only. The location criteria matching - the location of presence associated with the - impression. - page_number (int): - Output only. Page number in search results - where the ad was shown. - ad_group_ad (str): - Output only. The associated ad. - campaign_location_target (str): - Output only. The associated campaign location - target, if one exists. - user_list (str): - Output only. The associated user list, if one - exists. - """ - - resource_name = proto.Field(proto.STRING, number=1) - gclid = proto.Field(proto.STRING, number=8, optional=True) - area_of_interest = proto.Field( - proto.MESSAGE, number=3, message=click_location.ClickLocation, - ) - location_of_presence = proto.Field( - proto.MESSAGE, number=4, message=click_location.ClickLocation, - ) - page_number = proto.Field(proto.INT64, number=9, optional=True) - ad_group_ad = proto.Field(proto.STRING, number=10, optional=True) - campaign_location_target = proto.Field( - proto.STRING, number=11, optional=True - ) - user_list = proto.Field(proto.STRING, number=12, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/combined_audience.py b/google/ads/googleads/v6/resources/types/combined_audience.py deleted file mode 100644 index 423bf7b88..000000000 --- a/google/ads/googleads/v6/resources/types/combined_audience.py +++ /dev/null @@ -1,67 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import combined_audience_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CombinedAudience",}, -) - - -class CombinedAudience(proto.Message): - r"""Describe a resource for combined audiences which includes - different audiences. - - Attributes: - resource_name (str): - Immutable. The resource name of the combined audience. - Combined audience names have the form: - - ``customers/{customer_id}/combinedAudience/{combined_audience_id}`` - id (int): - Output only. ID of the combined audience. - status (google.ads.googleads.v6.enums.types.CombinedAudienceStatusEnum.CombinedAudienceStatus): - Output only. Status of this combined - audience. Indicates whether the combined - audience is enabled or removed. - name (str): - Output only. Name of the combined audience. - It should be unique across all combined - audiences. - description (str): - Output only. Description of this combined - audience. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=2) - status = proto.Field( - proto.ENUM, - number=3, - enum=combined_audience_status.CombinedAudienceStatusEnum.CombinedAudienceStatus, - ) - name = proto.Field(proto.STRING, number=4) - description = proto.Field(proto.STRING, number=5) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/conversion_action.py b/google/ads/googleads/v6/resources/types/conversion_action.py deleted file mode 100644 index 3e2dbca0d..000000000 --- a/google/ads/googleads/v6/resources/types/conversion_action.py +++ /dev/null @@ -1,260 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import tag_snippet -from google.ads.googleads.v6.enums.types import ( - attribution_model as gage_attribution_model, -) -from google.ads.googleads.v6.enums.types import conversion_action_category -from google.ads.googleads.v6.enums.types import conversion_action_counting_type -from google.ads.googleads.v6.enums.types import conversion_action_status -from google.ads.googleads.v6.enums.types import conversion_action_type -from google.ads.googleads.v6.enums.types import ( - data_driven_model_status as gage_data_driven_model_status, -) -from google.ads.googleads.v6.enums.types import ( - mobile_app_vendor as gage_mobile_app_vendor, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ConversionAction",}, -) - - -class ConversionAction(proto.Message): - r"""A conversion action. - - Attributes: - resource_name (str): - Immutable. The resource name of the conversion action. - Conversion action resource names have the form: - - ``customers/{customer_id}/conversionActions/{conversion_action_id}`` - id (int): - Output only. The ID of the conversion action. - name (str): - The name of the conversion action. - This field is required and should not be empty - when creating new conversion actions. - status (google.ads.googleads.v6.enums.types.ConversionActionStatusEnum.ConversionActionStatus): - The status of this conversion action for - conversion event accrual. - type_ (google.ads.googleads.v6.enums.types.ConversionActionTypeEnum.ConversionActionType): - Immutable. The type of this conversion - action. - category (google.ads.googleads.v6.enums.types.ConversionActionCategoryEnum.ConversionActionCategory): - The category of conversions reported for this - conversion action. - owner_customer (str): - Output only. The resource name of the - conversion action owner customer, or null if - this is a system-defined conversion action. - include_in_conversions_metric (bool): - Whether this conversion action should be - included in the "conversions" metric. - click_through_lookback_window_days (int): - The maximum number of days that may elapse - between an interaction (e.g., a click) and a - conversion event. - view_through_lookback_window_days (int): - The maximum number of days which may elapse - between an impression and a conversion without - an interaction. - value_settings (google.ads.googleads.v6.resources.types.ConversionAction.ValueSettings): - Settings related to the value for conversion - events associated with this conversion action. - counting_type (google.ads.googleads.v6.enums.types.ConversionActionCountingTypeEnum.ConversionActionCountingType): - How to count conversion events for the - conversion action. - attribution_model_settings (google.ads.googleads.v6.resources.types.ConversionAction.AttributionModelSettings): - Settings related to this conversion action's - attribution model. - tag_snippets (Sequence[google.ads.googleads.v6.common.types.TagSnippet]): - Output only. The snippets used for tracking - conversions. - phone_call_duration_seconds (int): - The phone call duration in seconds after - which a conversion should be reported for this - conversion action. - The value must be between 0 and 10000, - inclusive. - app_id (str): - App ID for an app conversion action. - mobile_app_vendor (google.ads.googleads.v6.enums.types.MobileAppVendorEnum.MobileAppVendor): - Output only. Mobile app vendor for an app - conversion action. - firebase_settings (google.ads.googleads.v6.resources.types.ConversionAction.FirebaseSettings): - Output only. Firebase settings for Firebase - conversion types. - third_party_app_analytics_settings (google.ads.googleads.v6.resources.types.ConversionAction.ThirdPartyAppAnalyticsSettings): - Output only. Third Party App Analytics - settings for third party conversion types. - """ - - class AttributionModelSettings(proto.Message): - r"""Settings related to this conversion action's attribution - model. - - Attributes: - attribution_model (google.ads.googleads.v6.enums.types.AttributionModelEnum.AttributionModel): - The attribution model type of this conversion - action. - data_driven_model_status (google.ads.googleads.v6.enums.types.DataDrivenModelStatusEnum.DataDrivenModelStatus): - Output only. The status of the data-driven - attribution model for the conversion action. - """ - - attribution_model = proto.Field( - proto.ENUM, - number=1, - enum=gage_attribution_model.AttributionModelEnum.AttributionModel, - ) - data_driven_model_status = proto.Field( - proto.ENUM, - number=2, - enum=gage_data_driven_model_status.DataDrivenModelStatusEnum.DataDrivenModelStatus, - ) - - class ValueSettings(proto.Message): - r"""Settings related to the value for conversion events - associated with this conversion action. - - Attributes: - default_value (float): - The value to use when conversion events for - this conversion action are sent with an invalid, - disallowed or missing value, or when this - conversion action is configured to always use - the default value. - default_currency_code (str): - The currency code to use when conversion - events for this conversion action are sent with - an invalid or missing currency code, or when - this conversion action is configured to always - use the default value. - always_use_default_value (bool): - Controls whether the default value and - default currency code are used in place of the - value and currency code specified in conversion - events for this conversion action. - """ - - default_value = proto.Field(proto.DOUBLE, number=4, optional=True) - default_currency_code = proto.Field( - proto.STRING, number=5, optional=True - ) - always_use_default_value = proto.Field( - proto.BOOL, number=6, optional=True - ) - - class FirebaseSettings(proto.Message): - r"""Settings related to a Firebase conversion action. - - Attributes: - event_name (str): - Output only. The event name of a Firebase - conversion. - project_id (str): - Output only. The Firebase project ID of the - conversion. - """ - - event_name = proto.Field(proto.STRING, number=3, optional=True) - project_id = proto.Field(proto.STRING, number=4, optional=True) - - class ThirdPartyAppAnalyticsSettings(proto.Message): - r"""Settings related to a third party app analytics conversion - action. - - Attributes: - event_name (str): - Output only. The event name of a third-party - app analytics conversion. - provider_name (str): - Output only. Name of the third-party app - analytics provider. - """ - - event_name = proto.Field(proto.STRING, number=2, optional=True) - provider_name = proto.Field(proto.STRING, number=3) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=21, optional=True) - name = proto.Field(proto.STRING, number=22, optional=True) - status = proto.Field( - proto.ENUM, - number=4, - enum=conversion_action_status.ConversionActionStatusEnum.ConversionActionStatus, - ) - type_ = proto.Field( - proto.ENUM, - number=5, - enum=conversion_action_type.ConversionActionTypeEnum.ConversionActionType, - ) - category = proto.Field( - proto.ENUM, - number=6, - enum=conversion_action_category.ConversionActionCategoryEnum.ConversionActionCategory, - ) - owner_customer = proto.Field(proto.STRING, number=23, optional=True) - include_in_conversions_metric = proto.Field( - proto.BOOL, number=24, optional=True - ) - click_through_lookback_window_days = proto.Field( - proto.INT64, number=25, optional=True - ) - view_through_lookback_window_days = proto.Field( - proto.INT64, number=26, optional=True - ) - value_settings = proto.Field( - proto.MESSAGE, number=11, message=ValueSettings, - ) - counting_type = proto.Field( - proto.ENUM, - number=12, - enum=conversion_action_counting_type.ConversionActionCountingTypeEnum.ConversionActionCountingType, - ) - attribution_model_settings = proto.Field( - proto.MESSAGE, number=13, message=AttributionModelSettings, - ) - tag_snippets = proto.RepeatedField( - proto.MESSAGE, number=14, message=tag_snippet.TagSnippet, - ) - phone_call_duration_seconds = proto.Field( - proto.INT64, number=27, optional=True - ) - app_id = proto.Field(proto.STRING, number=28, optional=True) - mobile_app_vendor = proto.Field( - proto.ENUM, - number=17, - enum=gage_mobile_app_vendor.MobileAppVendorEnum.MobileAppVendor, - ) - firebase_settings = proto.Field( - proto.MESSAGE, number=18, message=FirebaseSettings, - ) - third_party_app_analytics_settings = proto.Field( - proto.MESSAGE, number=19, message=ThirdPartyAppAnalyticsSettings, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/currency_constant.py b/google/ads/googleads/v6/resources/types/currency_constant.py deleted file mode 100644 index e2a8dda01..000000000 --- a/google/ads/googleads/v6/resources/types/currency_constant.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CurrencyConstant",}, -) - - -class CurrencyConstant(proto.Message): - r"""A currency constant. - - Attributes: - resource_name (str): - Output only. The resource name of the currency constant. - Currency constant resource names have the form: - - ``currencyConstants/{code}`` - code (str): - Output only. ISO 4217 three-letter currency - code, e.g. "USD". - name (str): - Output only. Full English name of the - currency. - symbol (str): - Output only. Standard symbol for describing - this currency, e.g. '$' for US Dollars. - billable_unit_micros (int): - Output only. The billable unit for this - currency. Billed amounts should be multiples of - this value. - """ - - resource_name = proto.Field(proto.STRING, number=1) - code = proto.Field(proto.STRING, number=6, optional=True) - name = proto.Field(proto.STRING, number=7, optional=True) - symbol = proto.Field(proto.STRING, number=8, optional=True) - billable_unit_micros = proto.Field(proto.INT64, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/custom_audience.py b/google/ads/googleads/v6/resources/types/custom_audience.py deleted file mode 100644 index 4dd8a16ee..000000000 --- a/google/ads/googleads/v6/resources/types/custom_audience.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import custom_audience_member_type -from google.ads.googleads.v6.enums.types import custom_audience_status -from google.ads.googleads.v6.enums.types import custom_audience_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomAudience", "CustomAudienceMember",}, -) - - -class CustomAudience(proto.Message): - r"""A custom audience. This is a list of users by interest. - - Attributes: - resource_name (str): - Immutable. The resource name of the custom audience. Custom - audience resource names have the form: - - ``customers/{customer_id}/customAudiences/{custom_audience_id}`` - id (int): - Output only. ID of the custom audience. - status (google.ads.googleads.v6.enums.types.CustomAudienceStatusEnum.CustomAudienceStatus): - Output only. Status of this custom audience. - Indicates whether the custom audience is enabled - or removed. - name (str): - Name of the custom audience. It should be - unique for all custom audiences created by a - customer. This field is required for creating - operations. - type_ (google.ads.googleads.v6.enums.types.CustomAudienceTypeEnum.CustomAudienceType): - Type of the custom audience. ("INTEREST" OR - "PURCHASE_INTENT" is not allowed for newly created custom - audience but kept for existing audiences) - description (str): - Description of this custom audience. - members (Sequence[google.ads.googleads.v6.resources.types.CustomAudienceMember]): - List of custom audience members that this - custom audience is composed of. Members can be - added during CustomAudience creation. If members - are presented in UPDATE operation, existing - members will be overridden. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=2) - status = proto.Field( - proto.ENUM, - number=3, - enum=custom_audience_status.CustomAudienceStatusEnum.CustomAudienceStatus, - ) - name = proto.Field(proto.STRING, number=4) - type_ = proto.Field( - proto.ENUM, - number=5, - enum=custom_audience_type.CustomAudienceTypeEnum.CustomAudienceType, - ) - description = proto.Field(proto.STRING, number=6) - members = proto.RepeatedField( - proto.MESSAGE, number=7, message="CustomAudienceMember", - ) - - -class CustomAudienceMember(proto.Message): - r"""A member of custom audience. A member can be a KEYWORD, URL, - PLACE_CATEGORY or APP. It can only be created or removed but not - changed. - - Attributes: - member_type (google.ads.googleads.v6.enums.types.CustomAudienceMemberTypeEnum.CustomAudienceMemberType): - The type of custom audience member, KEYWORD, URL, - PLACE_CATEGORY or APP. - keyword (str): - A keyword or keyword phrase — at most 10 - words and 80 characters. Languages with double- - width characters such as Chinese, Japanese, or - Korean, are allowed 40 characters, which - describes the user's interests or actions. - url (str): - An HTTP URL, protocol-included — at most 2048 - characters, which includes contents users have - interests in. - place_category (int): - A place type described by a place category - users visit. - app (str): - A package name of Android apps which users - installed such as com.google.example. - """ - - member_type = proto.Field( - proto.ENUM, - number=1, - enum=custom_audience_member_type.CustomAudienceMemberTypeEnum.CustomAudienceMemberType, - ) - keyword = proto.Field(proto.STRING, number=2, oneof="value") - url = proto.Field(proto.STRING, number=3, oneof="value") - place_category = proto.Field(proto.INT64, number=4, oneof="value") - app = proto.Field(proto.STRING, number=5, oneof="value") - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/custom_interest.py b/google/ads/googleads/v6/resources/types/custom_interest.py deleted file mode 100644 index 8c08dc850..000000000 --- a/google/ads/googleads/v6/resources/types/custom_interest.py +++ /dev/null @@ -1,107 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import custom_interest_member_type -from google.ads.googleads.v6.enums.types import custom_interest_status -from google.ads.googleads.v6.enums.types import custom_interest_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomInterest", "CustomInterestMember",}, -) - - -class CustomInterest(proto.Message): - r"""A custom interest. This is a list of users by interest. - - Attributes: - resource_name (str): - Immutable. The resource name of the custom interest. Custom - interest resource names have the form: - - ``customers/{customer_id}/customInterests/{custom_interest_id}`` - id (int): - Output only. Id of the custom interest. - status (google.ads.googleads.v6.enums.types.CustomInterestStatusEnum.CustomInterestStatus): - Status of this custom interest. Indicates - whether the custom interest is enabled or - removed. - name (str): - Name of the custom interest. It should be - unique across the same custom affinity audience. - This field is required for create operations. - type_ (google.ads.googleads.v6.enums.types.CustomInterestTypeEnum.CustomInterestType): - Type of the custom interest, CUSTOM_AFFINITY or - CUSTOM_INTENT. By default the type is set to - CUSTOM_AFFINITY. - description (str): - Description of this custom interest audience. - members (Sequence[google.ads.googleads.v6.resources.types.CustomInterestMember]): - List of custom interest members that this - custom interest is composed of. Members can be - added during CustomInterest creation. If members - are presented in UPDATE operation, existing - members will be overridden. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=8, optional=True) - status = proto.Field( - proto.ENUM, - number=3, - enum=custom_interest_status.CustomInterestStatusEnum.CustomInterestStatus, - ) - name = proto.Field(proto.STRING, number=9, optional=True) - type_ = proto.Field( - proto.ENUM, - number=5, - enum=custom_interest_type.CustomInterestTypeEnum.CustomInterestType, - ) - description = proto.Field(proto.STRING, number=10, optional=True) - members = proto.RepeatedField( - proto.MESSAGE, number=7, message="CustomInterestMember", - ) - - -class CustomInterestMember(proto.Message): - r"""A member of custom interest audience. A member can be a - keyword or url. It is immutable, that is, it can only be created - or removed but not changed. - - Attributes: - member_type (google.ads.googleads.v6.enums.types.CustomInterestMemberTypeEnum.CustomInterestMemberType): - The type of custom interest member, KEYWORD - or URL. - parameter (str): - Keyword text when member_type is KEYWORD or URL string when - member_type is URL. - """ - - member_type = proto.Field( - proto.ENUM, - number=1, - enum=custom_interest_member_type.CustomInterestMemberTypeEnum.CustomInterestMemberType, - ) - parameter = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer.py b/google/ads/googleads/v6/resources/types/customer.py deleted file mode 100644 index b5e3bd632..000000000 --- a/google/ads/googleads/v6/resources/types/customer.py +++ /dev/null @@ -1,207 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - customer_pay_per_conversion_eligibility_failure_reason, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={ - "Customer", - "CallReportingSetting", - "ConversionTrackingSetting", - "RemarketingSetting", - }, -) - - -class Customer(proto.Message): - r"""A customer. - - Attributes: - resource_name (str): - Immutable. The resource name of the customer. Customer - resource names have the form: - - ``customers/{customer_id}`` - id (int): - Output only. The ID of the customer. - descriptive_name (str): - Optional, non-unique descriptive name of the - customer. - currency_code (str): - Immutable. The currency in which the account - operates. A subset of the currency codes from - the ISO 4217 standard is supported. - time_zone (str): - Immutable. The local timezone ID of the - customer. - tracking_url_template (str): - The URL template for constructing a tracking - URL out of parameters. - final_url_suffix (str): - The URL template for appending params to the - final URL - auto_tagging_enabled (bool): - Whether auto-tagging is enabled for the - customer. - has_partners_badge (bool): - Output only. Whether the Customer has a - Partners program badge. If the Customer is not - associated with the Partners program, this will - be false. For more information, see - https://support.google.com/partners/answer/3125774. - manager (bool): - Output only. Whether the customer is a - manager. - test_account (bool): - Output only. Whether the customer is a test - account. - call_reporting_setting (google.ads.googleads.v6.resources.types.CallReportingSetting): - Call reporting setting for a customer. - conversion_tracking_setting (google.ads.googleads.v6.resources.types.ConversionTrackingSetting): - Output only. Conversion tracking setting for - a customer. - remarketing_setting (google.ads.googleads.v6.resources.types.RemarketingSetting): - Output only. Remarketing setting for a - customer. - pay_per_conversion_eligibility_failure_reasons (Sequence[google.ads.googleads.v6.enums.types.CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason]): - Output only. Reasons why the customer is not - eligible to use PaymentMode.CONVERSIONS. If the - list is empty, the customer is eligible. This - field is read-only. - optimization_score (float): - Output only. Optimization score of the - customer. - Optimization score is an estimate of how well a - customer's campaigns are set to perform. It - ranges from 0% (0.0) to 100% (1.0). This field - is null for all manager customers, and for - unscored non-manager customers. - See "About optimization score" at - https://support.google.com/google- - ads/answer/9061546. - This field is read-only. - optimization_score_weight (float): - Output only. Optimization score weight of the customer. - - Optimization score weight can be used to compare/aggregate - optimization scores across multiple non-manager customers. - The aggregate optimization score of a manager is computed as - the sum over all of their customers of - ``Customer.optimization_score * Customer.optimization_score_weight``. - This field is 0 for all manager customers, and for unscored - non-manager customers. - - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=19, optional=True) - descriptive_name = proto.Field(proto.STRING, number=20, optional=True) - currency_code = proto.Field(proto.STRING, number=21, optional=True) - time_zone = proto.Field(proto.STRING, number=22, optional=True) - tracking_url_template = proto.Field(proto.STRING, number=23, optional=True) - final_url_suffix = proto.Field(proto.STRING, number=24, optional=True) - auto_tagging_enabled = proto.Field(proto.BOOL, number=25, optional=True) - has_partners_badge = proto.Field(proto.BOOL, number=26, optional=True) - manager = proto.Field(proto.BOOL, number=27, optional=True) - test_account = proto.Field(proto.BOOL, number=28, optional=True) - call_reporting_setting = proto.Field( - proto.MESSAGE, number=10, message="CallReportingSetting", - ) - conversion_tracking_setting = proto.Field( - proto.MESSAGE, number=14, message="ConversionTrackingSetting", - ) - remarketing_setting = proto.Field( - proto.MESSAGE, number=15, message="RemarketingSetting", - ) - pay_per_conversion_eligibility_failure_reasons = proto.RepeatedField( - proto.ENUM, - number=16, - enum=customer_pay_per_conversion_eligibility_failure_reason.CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason, - ) - optimization_score = proto.Field(proto.DOUBLE, number=29, optional=True) - optimization_score_weight = proto.Field(proto.DOUBLE, number=30) - - -class CallReportingSetting(proto.Message): - r"""Call reporting setting for a customer. - - Attributes: - call_reporting_enabled (bool): - Enable reporting of phone call events by - redirecting them via Google System. - call_conversion_reporting_enabled (bool): - Whether to enable call conversion reporting. - call_conversion_action (str): - Customer-level call conversion action to attribute a call - conversion to. If not set a default conversion action is - used. Only in effect when call_conversion_reporting_enabled - is set to true. - """ - - call_reporting_enabled = proto.Field(proto.BOOL, number=10, optional=True) - call_conversion_reporting_enabled = proto.Field( - proto.BOOL, number=11, optional=True - ) - call_conversion_action = proto.Field(proto.STRING, number=12, optional=True) - - -class ConversionTrackingSetting(proto.Message): - r"""A collection of customer-wide settings related to Google Ads - Conversion Tracking. - - Attributes: - conversion_tracking_id (int): - Output only. The conversion tracking id used - for this account. This id is automatically - assigned after any conversion tracking feature - is used. If the customer doesn't use conversion - tracking, this is 0. This field is read-only. - cross_account_conversion_tracking_id (int): - Output only. The conversion tracking id of the customer's - manager. This is set when the customer is opted into cross - account conversion tracking, and it overrides - conversion_tracking_id. This field can only be managed - through the Google Ads UI. This field is read-only. - """ - - conversion_tracking_id = proto.Field(proto.INT64, number=3, optional=True) - cross_account_conversion_tracking_id = proto.Field( - proto.INT64, number=4, optional=True - ) - - -class RemarketingSetting(proto.Message): - r"""Remarketing setting for a customer. - - Attributes: - google_global_site_tag (str): - Output only. The Google global site tag. - """ - - google_global_site_tag = proto.Field(proto.STRING, number=2, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_client.py b/google/ads/googleads/v6/resources/types/customer_client.py deleted file mode 100644 index 8d4729eb6..000000000 --- a/google/ads/googleads/v6/resources/types/customer_client.py +++ /dev/null @@ -1,84 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerClient",}, -) - - -class CustomerClient(proto.Message): - r"""A link between the given customer and a client customer. - CustomerClients only exist for manager customers. All direct and - indirect client customers are included, as well as the manager - itself. - - Attributes: - resource_name (str): - Output only. The resource name of the customer client. - CustomerClient resource names have the form: - ``customers/{customer_id}/customerClients/{client_customer_id}`` - client_customer (str): - Output only. The resource name of the client- - ustomer which is linked to the given customer. - Read only. - hidden (bool): - Output only. Specifies whether this is a `hidden - account `__. - Read only. - level (int): - Output only. Distance between given customer - and client. For self link, the level value will - be 0. Read only. - time_zone (str): - Output only. Common Locale Data Repository (CLDR) string - representation of the time zone of the client, e.g. - America/Los_Angeles. Read only. - test_account (bool): - Output only. Identifies if the client is a - test account. Read only. - manager (bool): - Output only. Identifies if the client is a - manager. Read only. - descriptive_name (str): - Output only. Descriptive name for the client. - Read only. - currency_code (str): - Output only. Currency code (e.g. 'USD', - 'EUR') for the client. Read only. - id (int): - Output only. The ID of the client customer. - Read only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - client_customer = proto.Field(proto.STRING, number=12, optional=True) - hidden = proto.Field(proto.BOOL, number=13, optional=True) - level = proto.Field(proto.INT64, number=14, optional=True) - time_zone = proto.Field(proto.STRING, number=15, optional=True) - test_account = proto.Field(proto.BOOL, number=16, optional=True) - manager = proto.Field(proto.BOOL, number=17, optional=True) - descriptive_name = proto.Field(proto.STRING, number=18, optional=True) - currency_code = proto.Field(proto.STRING, number=19, optional=True) - id = proto.Field(proto.INT64, number=20, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_client_link.py b/google/ads/googleads/v6/resources/types/customer_client_link.py deleted file mode 100644 index 96887a081..000000000 --- a/google/ads/googleads/v6/resources/types/customer_client_link.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import manager_link_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerClientLink",}, -) - - -class CustomerClientLink(proto.Message): - r"""Represents customer client link relationship. - - Attributes: - resource_name (str): - Immutable. Name of the resource. CustomerClientLink resource - names have the form: - ``customers/{customer_id}/customerClientLinks/{client_customer_id}~{manager_link_id}`` - client_customer (str): - Immutable. The client customer linked to this - customer. - manager_link_id (int): - Output only. This is uniquely identifies a - customer client link. Read only. - status (google.ads.googleads.v6.enums.types.ManagerLinkStatusEnum.ManagerLinkStatus): - This is the status of the link between client - and manager. - hidden (bool): - The visibility of the link. Users can choose - whether or not to see hidden links in the Google - Ads UI. Default value is false - """ - - resource_name = proto.Field(proto.STRING, number=1) - client_customer = proto.Field(proto.STRING, number=7, optional=True) - manager_link_id = proto.Field(proto.INT64, number=8, optional=True) - status = proto.Field( - proto.ENUM, - number=5, - enum=manager_link_status.ManagerLinkStatusEnum.ManagerLinkStatus, - ) - hidden = proto.Field(proto.BOOL, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_extension_setting.py b/google/ads/googleads/v6/resources/types/customer_extension_setting.py deleted file mode 100644 index 8bd40919b..000000000 --- a/google/ads/googleads/v6/resources/types/customer_extension_setting.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import extension_setting_device -from google.ads.googleads.v6.enums.types import ( - extension_type as gage_extension_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerExtensionSetting",}, -) - - -class CustomerExtensionSetting(proto.Message): - r"""A customer extension setting. - - Attributes: - resource_name (str): - Immutable. The resource name of the customer extension - setting. CustomerExtensionSetting resource names have the - form: - - ``customers/{customer_id}/customerExtensionSettings/{extension_type}`` - extension_type (google.ads.googleads.v6.enums.types.ExtensionTypeEnum.ExtensionType): - Immutable. The extension type of the customer - extension setting. - extension_feed_items (Sequence[str]): - The resource names of the extension feed items to serve - under the customer. ExtensionFeedItem resource names have - the form: - - ``customers/{customer_id}/extensionFeedItems/{feed_item_id}`` - device (google.ads.googleads.v6.enums.types.ExtensionSettingDeviceEnum.ExtensionSettingDevice): - The device for which the extensions will - serve. Optional. - """ - - resource_name = proto.Field(proto.STRING, number=1) - extension_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_extension_type.ExtensionTypeEnum.ExtensionType, - ) - extension_feed_items = proto.RepeatedField(proto.STRING, number=5) - device = proto.Field( - proto.ENUM, - number=4, - enum=extension_setting_device.ExtensionSettingDeviceEnum.ExtensionSettingDevice, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_feed.py b/google/ads/googleads/v6/resources/types/customer_feed.py deleted file mode 100644 index 8c3bd793f..000000000 --- a/google/ads/googleads/v6/resources/types/customer_feed.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import ( - matching_function as gagc_matching_function, -) -from google.ads.googleads.v6.enums.types import feed_link_status -from google.ads.googleads.v6.enums.types import placeholder_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerFeed",}, -) - - -class CustomerFeed(proto.Message): - r"""A customer feed. - - Attributes: - resource_name (str): - Immutable. The resource name of the customer feed. Customer - feed resource names have the form: - - ``customers/{customer_id}/customerFeeds/{feed_id}`` - feed (str): - Immutable. The feed being linked to the - customer. - placeholder_types (Sequence[google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType]): - Indicates which placeholder types the feed - may populate under the connected customer. - Required. - matching_function (google.ads.googleads.v6.common.types.MatchingFunction): - Matching function associated with the - CustomerFeed. The matching function is used to - filter the set of feed items selected. Required. - status (google.ads.googleads.v6.enums.types.FeedLinkStatusEnum.FeedLinkStatus): - Output only. Status of the customer feed. - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=6, optional=True) - placeholder_types = proto.RepeatedField( - proto.ENUM, - number=3, - enum=placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - matching_function = proto.Field( - proto.MESSAGE, - number=4, - message=gagc_matching_function.MatchingFunction, - ) - status = proto.Field( - proto.ENUM, - number=5, - enum=feed_link_status.FeedLinkStatusEnum.FeedLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_label.py b/google/ads/googleads/v6/resources/types/customer_label.py deleted file mode 100644 index 417fd0fe0..000000000 --- a/google/ads/googleads/v6/resources/types/customer_label.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerLabel",}, -) - - -class CustomerLabel(proto.Message): - r"""Represents a relationship between a customer and a label. - This customer may not have access to all the labels attached to - it. Additional CustomerLabels may be returned by increasing - permissions with login-customer-id. - - Attributes: - resource_name (str): - Immutable. Name of the resource. Customer label resource - names have the form: - ``customers/{customer_id}/customerLabels/{label_id}`` - customer (str): - Output only. The resource name of the - customer to which the label is attached. Read - only. - label (str): - Output only. The resource name of the label - assigned to the customer. - Note: the Customer ID portion of the label - resource name is not validated when creating a - new CustomerLabel. - """ - - resource_name = proto.Field(proto.STRING, number=1) - customer = proto.Field(proto.STRING, number=4, optional=True) - label = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_manager_link.py b/google/ads/googleads/v6/resources/types/customer_manager_link.py deleted file mode 100644 index 63345d8d4..000000000 --- a/google/ads/googleads/v6/resources/types/customer_manager_link.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import manager_link_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerManagerLink",}, -) - - -class CustomerManagerLink(proto.Message): - r"""Represents customer-manager link relationship. - - Attributes: - resource_name (str): - Immutable. Name of the resource. CustomerManagerLink - resource names have the form: - ``customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}`` - manager_customer (str): - Output only. The manager customer linked to - the customer. - manager_link_id (int): - Output only. ID of the customer-manager link. - This field is read only. - status (google.ads.googleads.v6.enums.types.ManagerLinkStatusEnum.ManagerLinkStatus): - Status of the link between the customer and - the manager. - """ - - resource_name = proto.Field(proto.STRING, number=1) - manager_customer = proto.Field(proto.STRING, number=6, optional=True) - manager_link_id = proto.Field(proto.INT64, number=7, optional=True) - status = proto.Field( - proto.ENUM, - number=5, - enum=manager_link_status.ManagerLinkStatusEnum.ManagerLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_negative_criterion.py b/google/ads/googleads/v6/resources/types/customer_negative_criterion.py deleted file mode 100644 index f7ec079fc..000000000 --- a/google/ads/googleads/v6/resources/types/customer_negative_criterion.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import criterion_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerNegativeCriterion",}, -) - - -class CustomerNegativeCriterion(proto.Message): - r"""A negative criterion for exclusions at the customer level. - - Attributes: - resource_name (str): - Immutable. The resource name of the customer negative - criterion. Customer negative criterion resource names have - the form: - - ``customers/{customer_id}/customerNegativeCriteria/{criterion_id}`` - id (int): - Output only. The ID of the criterion. - type_ (google.ads.googleads.v6.enums.types.CriterionTypeEnum.CriterionType): - Output only. The type of the criterion. - content_label (google.ads.googleads.v6.common.types.ContentLabelInfo): - Immutable. ContentLabel. - mobile_application (google.ads.googleads.v6.common.types.MobileApplicationInfo): - Immutable. MobileApplication. - mobile_app_category (google.ads.googleads.v6.common.types.MobileAppCategoryInfo): - Immutable. MobileAppCategory. - placement (google.ads.googleads.v6.common.types.PlacementInfo): - Immutable. Placement. - youtube_video (google.ads.googleads.v6.common.types.YouTubeVideoInfo): - Immutable. YouTube Video. - youtube_channel (google.ads.googleads.v6.common.types.YouTubeChannelInfo): - Immutable. YouTube Channel. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=10, optional=True) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=criterion_type.CriterionTypeEnum.CriterionType, - ) - content_label = proto.Field( - proto.MESSAGE, - number=4, - oneof="criterion", - message=criteria.ContentLabelInfo, - ) - mobile_application = proto.Field( - proto.MESSAGE, - number=5, - oneof="criterion", - message=criteria.MobileApplicationInfo, - ) - mobile_app_category = proto.Field( - proto.MESSAGE, - number=6, - oneof="criterion", - message=criteria.MobileAppCategoryInfo, - ) - placement = proto.Field( - proto.MESSAGE, - number=7, - oneof="criterion", - message=criteria.PlacementInfo, - ) - youtube_video = proto.Field( - proto.MESSAGE, - number=8, - oneof="criterion", - message=criteria.YouTubeVideoInfo, - ) - youtube_channel = proto.Field( - proto.MESSAGE, - number=9, - oneof="criterion", - message=criteria.YouTubeChannelInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_user_access.py b/google/ads/googleads/v6/resources/types/customer_user_access.py deleted file mode 100644 index 176cc1846..000000000 --- a/google/ads/googleads/v6/resources/types/customer_user_access.py +++ /dev/null @@ -1,73 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import access_role as gage_access_role - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerUserAccess",}, -) - - -class CustomerUserAccess(proto.Message): - r"""Represents the permission of a single user onto a single - customer. - - Attributes: - resource_name (str): - Immutable. Name of the resource. Resource names have the - form: - ``customers/{customer_id}/customerUserAccesses/{user_id}`` - user_id (int): - Output only. User id of the user with the - customer access. Read only field - email_address (str): - Output only. Email address of the user. - Read only field - access_role (google.ads.googleads.v6.enums.types.AccessRoleEnum.AccessRole): - Access role of the user. - access_creation_date_time (str): - Output only. The customer user access - creation time. Read only field - The format is "YYYY-MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - inviter_user_email_address (str): - Output only. The email address of the inviter - user. Read only field - """ - - resource_name = proto.Field(proto.STRING, number=1) - user_id = proto.Field(proto.INT64, number=2) - email_address = proto.Field(proto.STRING, number=3, optional=True) - access_role = proto.Field( - proto.ENUM, number=4, enum=gage_access_role.AccessRoleEnum.AccessRole, - ) - access_creation_date_time = proto.Field( - proto.STRING, number=6, optional=True - ) - inviter_user_email_address = proto.Field( - proto.STRING, number=7, optional=True - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/customer_user_access_invitation.py b/google/ads/googleads/v6/resources/types/customer_user_access_invitation.py deleted file mode 100644 index 4fe499f97..000000000 --- a/google/ads/googleads/v6/resources/types/customer_user_access_invitation.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import access_invitation_status -from google.ads.googleads.v6.enums.types import access_role as gage_access_role - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"CustomerUserAccessInvitation",}, -) - - -class CustomerUserAccessInvitation(proto.Message): - r"""Represent an invitation to a new user on this customer - account. - - Attributes: - resource_name (str): - Immutable. Name of the resource. Resource names have the - form: - ``customers/{customer_id}/customerUserAccessInvitations/{invitation_id}`` - invitation_id (int): - Output only. The ID of the invitation. - This field is read-only. - access_role (google.ads.googleads.v6.enums.types.AccessRoleEnum.AccessRole): - Immutable. Access role of the user. - email_address (str): - Immutable. Email address the invitation was - sent to. This can differ from the email address - of the account that accepts the invite. - creation_date_time (str): - Output only. Time invitation was created. - This field is read-only. - The format is "YYYY-MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - invitation_status (google.ads.googleads.v6.enums.types.AccessInvitationStatusEnum.AccessInvitationStatus): - Output only. Invitation status of the user. - """ - - resource_name = proto.Field(proto.STRING, number=1) - invitation_id = proto.Field(proto.INT64, number=2) - access_role = proto.Field( - proto.ENUM, number=3, enum=gage_access_role.AccessRoleEnum.AccessRole, - ) - email_address = proto.Field(proto.STRING, number=4) - creation_date_time = proto.Field(proto.STRING, number=5) - invitation_status = proto.Field( - proto.ENUM, - number=6, - enum=access_invitation_status.AccessInvitationStatusEnum.AccessInvitationStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/detail_placement_view.py b/google/ads/googleads/v6/resources/types/detail_placement_view.py deleted file mode 100644 index 69ec54082..000000000 --- a/google/ads/googleads/v6/resources/types/detail_placement_view.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - placement_type as gage_placement_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"DetailPlacementView",}, -) - - -class DetailPlacementView(proto.Message): - r"""A view with metrics aggregated by ad group and URL or YouTube - video. - - Attributes: - resource_name (str): - Output only. The resource name of the detail placement view. - Detail placement view resource names have the form: - - ``customers/{customer_id}/detailPlacementViews/{ad_group_id}~{base64_placement}`` - placement (str): - Output only. The automatic placement string - at detail level, e. g. website URL, mobile - application ID, or a YouTube video ID. - display_name (str): - Output only. The display name is URL name for - websites, YouTube video name for YouTube videos, - and translated mobile app name for mobile apps. - group_placement_target_url (str): - Output only. URL of the group placement, e.g. - domain, link to the mobile application in app - store, or a YouTube channel URL. - target_url (str): - Output only. URL of the placement, e.g. - website, link to the mobile application in app - store, or a YouTube video URL. - placement_type (google.ads.googleads.v6.enums.types.PlacementTypeEnum.PlacementType): - Output only. Type of the placement, e.g. - Website, YouTube Video, and Mobile Application. - """ - - resource_name = proto.Field(proto.STRING, number=1) - placement = proto.Field(proto.STRING, number=7, optional=True) - display_name = proto.Field(proto.STRING, number=8, optional=True) - group_placement_target_url = proto.Field( - proto.STRING, number=9, optional=True - ) - target_url = proto.Field(proto.STRING, number=10, optional=True) - placement_type = proto.Field( - proto.ENUM, - number=6, - enum=gage_placement_type.PlacementTypeEnum.PlacementType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/display_keyword_view.py b/google/ads/googleads/v6/resources/types/display_keyword_view.py deleted file mode 100644 index 9a3d1d6d8..000000000 --- a/google/ads/googleads/v6/resources/types/display_keyword_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"DisplayKeywordView",}, -) - - -class DisplayKeywordView(proto.Message): - r"""A display keyword view. - - Attributes: - resource_name (str): - Output only. The resource name of the display keyword view. - Display Keyword view resource names have the form: - - ``customers/{customer_id}/displayKeywordViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/distance_view.py b/google/ads/googleads/v6/resources/types/distance_view.py deleted file mode 100644 index 0878e3fe3..000000000 --- a/google/ads/googleads/v6/resources/types/distance_view.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - distance_bucket as gage_distance_bucket, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"DistanceView",}, -) - - -class DistanceView(proto.Message): - r"""A distance view with metrics aggregated by the user's - distance from an advertiser's location extensions. Each - DistanceBucket includes all impressions that fall within its - distance and a single impression will contribute to the metrics - for all DistanceBuckets that include the user's distance. - - Attributes: - resource_name (str): - Output only. The resource name of the distance view. - Distance view resource names have the form: - - ``customers/{customer_id}/distanceViews/1~{distance_bucket}`` - distance_bucket (google.ads.googleads.v6.enums.types.DistanceBucketEnum.DistanceBucket): - Output only. Grouping of user distance from - location extensions. - metric_system (bool): - Output only. True if the DistanceBucket is - using the metric system, false otherwise. - """ - - resource_name = proto.Field(proto.STRING, number=1) - distance_bucket = proto.Field( - proto.ENUM, - number=2, - enum=gage_distance_bucket.DistanceBucketEnum.DistanceBucket, - ) - metric_system = proto.Field(proto.BOOL, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/domain_category.py b/google/ads/googleads/v6/resources/types/domain_category.py deleted file mode 100644 index da959135c..000000000 --- a/google/ads/googleads/v6/resources/types/domain_category.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"DomainCategory",}, -) - - -class DomainCategory(proto.Message): - r"""A category generated automatically by crawling a domain. If a - campaign uses the DynamicSearchAdsSetting, then domain - categories will be generated for the domain. The categories can - be targeted using WebpageConditionInfo. See: - https://support.google.com/google-ads/answer/2471185 - - Attributes: - resource_name (str): - Output only. The resource name of the domain category. - Domain category resource names have the form: - - ``customers/{customer_id}/domainCategories/{campaign_id}~{category_base64}~{language_code}`` - campaign (str): - Output only. The campaign this category is - recommended for. - category (str): - Output only. Recommended category for the - website domain. e.g. if you have a website about - electronics, the categories could be "cameras", - "televisions", etc. - language_code (str): - Output only. The language code specifying the - language of the website. e.g. "en" for English. - The language can be specified in the - DynamicSearchAdsSetting required for dynamic - search ads. This is the language of the pages - from your website that you want Google Ads to - find, create ads for, and match searches with. - domain (str): - Output only. The domain for the website. The - domain can be specified in the - DynamicSearchAdsSetting required for dynamic - search ads. - coverage_fraction (float): - Output only. Fraction of pages on your site - that this category matches. - category_rank (int): - Output only. The position of this category in - the set of categories. Lower numbers indicate a - better match for the domain. null indicates not - recommended. - has_children (bool): - Output only. Indicates whether this category - has sub-categories. - recommended_cpc_bid_micros (int): - Output only. The recommended cost per click - for the category. - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field(proto.STRING, number=10, optional=True) - category = proto.Field(proto.STRING, number=11, optional=True) - language_code = proto.Field(proto.STRING, number=12, optional=True) - domain = proto.Field(proto.STRING, number=13, optional=True) - coverage_fraction = proto.Field(proto.DOUBLE, number=14, optional=True) - category_rank = proto.Field(proto.INT64, number=15, optional=True) - has_children = proto.Field(proto.BOOL, number=16, optional=True) - recommended_cpc_bid_micros = proto.Field( - proto.INT64, number=17, optional=True - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/dynamic_search_ads_search_term_view.py b/google/ads/googleads/v6/resources/types/dynamic_search_ads_search_term_view.py deleted file mode 100644 index c38ac3456..000000000 --- a/google/ads/googleads/v6/resources/types/dynamic_search_ads_search_term_view.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"DynamicSearchAdsSearchTermView",}, -) - - -class DynamicSearchAdsSearchTermView(proto.Message): - r"""A dynamic search ads search term view. - - Attributes: - resource_name (str): - Output only. The resource name of the dynamic search ads - search term view. Dynamic search ads search term view - resource names have the form: - - ``customers/{customer_id}/dynamicSearchAdsSearchTermViews/{ad_group_id}~{search_term_fingerprint}~{headline_fingerprint}~{landing_page_fingerprint}~{page_url_fingerprint}`` - search_term (str): - Output only. Search term - This field is read-only. - headline (str): - Output only. The dynamically generated - headline of the Dynamic Search Ad. - This field is read-only. - landing_page (str): - Output only. The dynamically selected landing - page URL of the impression. - This field is read-only. - page_url (str): - Output only. The URL of page feed item served - for the impression. - This field is read-only. - has_negative_keyword (bool): - Output only. True if query matches a negative - keyword. - This field is read-only. - has_matching_keyword (bool): - Output only. True if query is added to - targeted keywords. - This field is read-only. - has_negative_url (bool): - Output only. True if query matches a negative - url. - This field is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - search_term = proto.Field(proto.STRING, number=9, optional=True) - headline = proto.Field(proto.STRING, number=10, optional=True) - landing_page = proto.Field(proto.STRING, number=11, optional=True) - page_url = proto.Field(proto.STRING, number=12, optional=True) - has_negative_keyword = proto.Field(proto.BOOL, number=13, optional=True) - has_matching_keyword = proto.Field(proto.BOOL, number=14, optional=True) - has_negative_url = proto.Field(proto.BOOL, number=15, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/expanded_landing_page_view.py b/google/ads/googleads/v6/resources/types/expanded_landing_page_view.py deleted file mode 100644 index d7ccdac40..000000000 --- a/google/ads/googleads/v6/resources/types/expanded_landing_page_view.py +++ /dev/null @@ -1,48 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ExpandedLandingPageView",}, -) - - -class ExpandedLandingPageView(proto.Message): - r"""A landing page view with metrics aggregated at the expanded - final URL level. - - Attributes: - resource_name (str): - Output only. The resource name of the expanded landing page - view. Expanded landing page view resource names have the - form: - - ``customers/{customer_id}/expandedLandingPageViews/{expanded_final_url_fingerprint}`` - expanded_final_url (str): - Output only. The final URL that clicks are - directed to. - """ - - resource_name = proto.Field(proto.STRING, number=1) - expanded_final_url = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/extension_feed_item.py b/google/ads/googleads/v6/resources/types/extension_feed_item.py deleted file mode 100644 index 60c7de59a..000000000 --- a/google/ads/googleads/v6/resources/types/extension_feed_item.py +++ /dev/null @@ -1,223 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.common.types import extensions -from google.ads.googleads.v6.enums.types import ( - extension_type as gage_extension_type, -) -from google.ads.googleads.v6.enums.types import feed_item_status -from google.ads.googleads.v6.enums.types import feed_item_target_device - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ExtensionFeedItem",}, -) - - -class ExtensionFeedItem(proto.Message): - r"""An extension feed item. - - Attributes: - resource_name (str): - Immutable. The resource name of the extension feed item. - Extension feed item resource names have the form: - - ``customers/{customer_id}/extensionFeedItems/{feed_item_id}`` - id (int): - Output only. The ID of this feed item. Read- - nly. - extension_type (google.ads.googleads.v6.enums.types.ExtensionTypeEnum.ExtensionType): - Output only. The extension type of the - extension feed item. This field is read-only. - start_date_time (str): - Start time in which this feed item is - effective and can begin serving. The time is in - the customer's time zone. The format is "YYYY- - MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - end_date_time (str): - End time in which this feed item is no longer - effective and will stop serving. The time is in - the customer's time zone. The format is "YYYY- - MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - ad_schedules (Sequence[google.ads.googleads.v6.common.types.AdScheduleInfo]): - List of non-overlapping schedules specifying - all time intervals for which the feed item may - serve. There can be a maximum of 6 schedules per - day. - device (google.ads.googleads.v6.enums.types.FeedItemTargetDeviceEnum.FeedItemTargetDevice): - The targeted device. - targeted_geo_target_constant (str): - The targeted geo target constant. - targeted_keyword (google.ads.googleads.v6.common.types.KeywordInfo): - The targeted keyword. - status (google.ads.googleads.v6.enums.types.FeedItemStatusEnum.FeedItemStatus): - Output only. Status of the feed item. - This field is read-only. - sitelink_feed_item (google.ads.googleads.v6.common.types.SitelinkFeedItem): - Sitelink extension. - structured_snippet_feed_item (google.ads.googleads.v6.common.types.StructuredSnippetFeedItem): - Structured snippet extension. - app_feed_item (google.ads.googleads.v6.common.types.AppFeedItem): - App extension. - call_feed_item (google.ads.googleads.v6.common.types.CallFeedItem): - Call extension. - callout_feed_item (google.ads.googleads.v6.common.types.CalloutFeedItem): - Callout extension. - text_message_feed_item (google.ads.googleads.v6.common.types.TextMessageFeedItem): - Text message extension. - price_feed_item (google.ads.googleads.v6.common.types.PriceFeedItem): - Price extension. - promotion_feed_item (google.ads.googleads.v6.common.types.PromotionFeedItem): - Promotion extension. - location_feed_item (google.ads.googleads.v6.common.types.LocationFeedItem): - Output only. Location extension. Locations - are synced from a GMB account into a feed. This - field is read-only. - affiliate_location_feed_item (google.ads.googleads.v6.common.types.AffiliateLocationFeedItem): - Output only. Affiliate location extension. - Feed locations are populated by Google Ads based - on a chain ID. This field is read-only. - hotel_callout_feed_item (google.ads.googleads.v6.common.types.HotelCalloutFeedItem): - Hotel Callout extension. - image_feed_item (google.ads.googleads.v6.common.types.ImageFeedItem): - Immutable. Advertiser provided image - extension. - targeted_campaign (str): - The targeted campaign. - targeted_ad_group (str): - The targeted ad group. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=25, optional=True) - extension_type = proto.Field( - proto.ENUM, - number=13, - enum=gage_extension_type.ExtensionTypeEnum.ExtensionType, - ) - start_date_time = proto.Field(proto.STRING, number=26, optional=True) - end_date_time = proto.Field(proto.STRING, number=27, optional=True) - ad_schedules = proto.RepeatedField( - proto.MESSAGE, number=16, message=criteria.AdScheduleInfo, - ) - device = proto.Field( - proto.ENUM, - number=17, - enum=feed_item_target_device.FeedItemTargetDeviceEnum.FeedItemTargetDevice, - ) - targeted_geo_target_constant = proto.Field( - proto.STRING, number=30, optional=True - ) - targeted_keyword = proto.Field( - proto.MESSAGE, number=22, message=criteria.KeywordInfo, - ) - status = proto.Field( - proto.ENUM, - number=4, - enum=feed_item_status.FeedItemStatusEnum.FeedItemStatus, - ) - sitelink_feed_item = proto.Field( - proto.MESSAGE, - number=2, - oneof="extension", - message=extensions.SitelinkFeedItem, - ) - structured_snippet_feed_item = proto.Field( - proto.MESSAGE, - number=3, - oneof="extension", - message=extensions.StructuredSnippetFeedItem, - ) - app_feed_item = proto.Field( - proto.MESSAGE, - number=7, - oneof="extension", - message=extensions.AppFeedItem, - ) - call_feed_item = proto.Field( - proto.MESSAGE, - number=8, - oneof="extension", - message=extensions.CallFeedItem, - ) - callout_feed_item = proto.Field( - proto.MESSAGE, - number=9, - oneof="extension", - message=extensions.CalloutFeedItem, - ) - text_message_feed_item = proto.Field( - proto.MESSAGE, - number=10, - oneof="extension", - message=extensions.TextMessageFeedItem, - ) - price_feed_item = proto.Field( - proto.MESSAGE, - number=11, - oneof="extension", - message=extensions.PriceFeedItem, - ) - promotion_feed_item = proto.Field( - proto.MESSAGE, - number=12, - oneof="extension", - message=extensions.PromotionFeedItem, - ) - location_feed_item = proto.Field( - proto.MESSAGE, - number=14, - oneof="extension", - message=extensions.LocationFeedItem, - ) - affiliate_location_feed_item = proto.Field( - proto.MESSAGE, - number=15, - oneof="extension", - message=extensions.AffiliateLocationFeedItem, - ) - hotel_callout_feed_item = proto.Field( - proto.MESSAGE, - number=23, - oneof="extension", - message=extensions.HotelCalloutFeedItem, - ) - image_feed_item = proto.Field( - proto.MESSAGE, - number=31, - oneof="extension", - message=extensions.ImageFeedItem, - ) - targeted_campaign = proto.Field( - proto.STRING, number=28, oneof="serving_resource_targeting" - ) - targeted_ad_group = proto.Field( - proto.STRING, number=29, oneof="serving_resource_targeting" - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed.py b/google/ads/googleads/v6/resources/types/feed.py deleted file mode 100644 index d607e1771..000000000 --- a/google/ads/googleads/v6/resources/types/feed.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - affiliate_location_feed_relationship_type, -) -from google.ads.googleads.v6.enums.types import feed_attribute_type -from google.ads.googleads.v6.enums.types import feed_origin -from google.ads.googleads.v6.enums.types import feed_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Feed", "FeedAttribute", "FeedAttributeOperation",}, -) - - -class Feed(proto.Message): - r"""A feed. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed. Feed resource - names have the form: - - ``customers/{customer_id}/feeds/{feed_id}`` - id (int): - Output only. The ID of the feed. - This field is read-only. - name (str): - Immutable. Name of the feed. Required. - attributes (Sequence[google.ads.googleads.v6.resources.types.FeedAttribute]): - The Feed's attributes. Required on CREATE, unless - system_feed_generation_data is provided, in which case - Google Ads will update the feed with the correct attributes. - Disallowed on UPDATE. Use attribute_operations to add new - attributes. - attribute_operations (Sequence[google.ads.googleads.v6.resources.types.FeedAttributeOperation]): - The list of operations changing the feed - attributes. Attributes can only be added, not - removed. - origin (google.ads.googleads.v6.enums.types.FeedOriginEnum.FeedOrigin): - Immutable. Specifies who manages the - FeedAttributes for the Feed. - status (google.ads.googleads.v6.enums.types.FeedStatusEnum.FeedStatus): - Output only. Status of the feed. - This field is read-only. - places_location_feed_data (google.ads.googleads.v6.resources.types.Feed.PlacesLocationFeedData): - Data used to configure a location feed - populated from Google My Business Locations. - affiliate_location_feed_data (google.ads.googleads.v6.resources.types.Feed.AffiliateLocationFeedData): - Data used to configure an affiliate location - feed populated with the specified chains. - """ - - class PlacesLocationFeedData(proto.Message): - r"""Data used to configure a location feed populated from Google - My Business Locations. - - Attributes: - oauth_info (google.ads.googleads.v6.resources.types.Feed.PlacesLocationFeedData.OAuthInfo): - Immutable. Required authentication token - (from OAuth API) for the email. This field can - only be specified in a create request. All its - subfields are not selectable. - email_address (str): - Email address of a Google My Business account - or email address of a manager of the Google My - Business account. Required. - business_account_id (str): - Plus page ID of the managed business whose locations should - be used. If this field is not set, then all businesses - accessible by the user (specified by email_address) are - used. This field is mutate-only and is not selectable. - business_name_filter (str): - Used to filter Google My Business listings by business name. - If business_name_filter is set, only listings with a - matching business name are candidates to be sync'd into - FeedItems. - category_filters (Sequence[str]): - Used to filter Google My Business listings by categories. If - entries exist in category_filters, only listings that belong - to any of the categories are candidates to be sync'd into - FeedItems. If no entries exist in category_filters, then all - listings are candidates for syncing. - label_filters (Sequence[str]): - Used to filter Google My Business listings by labels. If - entries exist in label_filters, only listings that has any - of the labels set are candidates to be synchronized into - FeedItems. If no entries exist in label_filters, then all - listings are candidates for syncing. - """ - - class OAuthInfo(proto.Message): - r"""Data used for authorization using OAuth. - - Attributes: - http_method (str): - The HTTP method used to obtain authorization. - http_request_url (str): - The HTTP request URL used to obtain - authorization. - http_authorization_header (str): - The HTTP authorization header used to obtain - authorization. - """ - - http_method = proto.Field(proto.STRING, number=4, optional=True) - http_request_url = proto.Field( - proto.STRING, number=5, optional=True - ) - http_authorization_header = proto.Field( - proto.STRING, number=6, optional=True - ) - - oauth_info = proto.Field( - proto.MESSAGE, - number=1, - message="Feed.PlacesLocationFeedData.OAuthInfo", - ) - email_address = proto.Field(proto.STRING, number=7, optional=True) - business_account_id = proto.Field(proto.STRING, number=8) - business_name_filter = proto.Field( - proto.STRING, number=9, optional=True - ) - category_filters = proto.RepeatedField(proto.STRING, number=11) - label_filters = proto.RepeatedField(proto.STRING, number=12) - - class AffiliateLocationFeedData(proto.Message): - r"""Data used to configure an affiliate location feed populated - with the specified chains. - - Attributes: - chain_ids (Sequence[int]): - The list of chains that the affiliate - location feed will sync the locations from. - relationship_type (google.ads.googleads.v6.enums.types.AffiliateLocationFeedRelationshipTypeEnum.AffiliateLocationFeedRelationshipType): - The relationship the chains have with the - advertiser. - """ - - chain_ids = proto.RepeatedField(proto.INT64, number=3) - relationship_type = proto.Field( - proto.ENUM, - number=2, - enum=affiliate_location_feed_relationship_type.AffiliateLocationFeedRelationshipTypeEnum.AffiliateLocationFeedRelationshipType, - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=11, optional=True) - name = proto.Field(proto.STRING, number=12, optional=True) - attributes = proto.RepeatedField( - proto.MESSAGE, number=4, message="FeedAttribute", - ) - attribute_operations = proto.RepeatedField( - proto.MESSAGE, number=9, message="FeedAttributeOperation", - ) - origin = proto.Field( - proto.ENUM, number=5, enum=feed_origin.FeedOriginEnum.FeedOrigin, - ) - status = proto.Field( - proto.ENUM, number=8, enum=feed_status.FeedStatusEnum.FeedStatus, - ) - places_location_feed_data = proto.Field( - proto.MESSAGE, - number=6, - oneof="system_feed_generation_data", - message=PlacesLocationFeedData, - ) - affiliate_location_feed_data = proto.Field( - proto.MESSAGE, - number=7, - oneof="system_feed_generation_data", - message=AffiliateLocationFeedData, - ) - - -class FeedAttribute(proto.Message): - r"""FeedAttributes define the types of data expected to be - present in a Feed. A single FeedAttribute specifies the expected - type of the FeedItemAttributes with the same FeedAttributeId. - Optionally, a FeedAttribute can be marked as being part of a - FeedItem's unique key. - - Attributes: - id (int): - ID of the attribute. - name (str): - The name of the attribute. Required. - type_ (google.ads.googleads.v6.enums.types.FeedAttributeTypeEnum.FeedAttributeType): - Data type for feed attribute. Required. - is_part_of_key (bool): - Indicates that data corresponding to this attribute is part - of a FeedItem's unique key. It defaults to false if it is - unspecified. Note that a unique key is not required in a - Feed's schema, in which case the FeedItems must be - referenced by their feed_item_id. - """ - - id = proto.Field(proto.INT64, number=5, optional=True) - name = proto.Field(proto.STRING, number=6, optional=True) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=feed_attribute_type.FeedAttributeTypeEnum.FeedAttributeType, - ) - is_part_of_key = proto.Field(proto.BOOL, number=7, optional=True) - - -class FeedAttributeOperation(proto.Message): - r"""Operation to be performed on a feed attribute list in a - mutate. - - Attributes: - operator (google.ads.googleads.v6.resources.types.FeedAttributeOperation.Operator): - Output only. Type of list operation to - perform. - value (google.ads.googleads.v6.resources.types.FeedAttribute): - Output only. The feed attribute being added - to the list. - """ - - class Operator(proto.Enum): - r"""The operator.""" - UNSPECIFIED = 0 - UNKNOWN = 1 - ADD = 2 - - operator = proto.Field(proto.ENUM, number=1, enum=Operator,) - value = proto.Field(proto.MESSAGE, number=2, message="FeedAttribute",) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_item.py b/google/ads/googleads/v6/resources/types/feed_item.py deleted file mode 100644 index 4886facdc..000000000 --- a/google/ads/googleads/v6/resources/types/feed_item.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import custom_parameter -from google.ads.googleads.v6.common.types import feed_common -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import ( - feed_item_quality_approval_status, -) -from google.ads.googleads.v6.enums.types import ( - feed_item_quality_disapproval_reason, -) -from google.ads.googleads.v6.enums.types import feed_item_status -from google.ads.googleads.v6.enums.types import feed_item_validation_status -from google.ads.googleads.v6.enums.types import ( - geo_targeting_restriction as gage_geo_targeting_restriction, -) -from google.ads.googleads.v6.enums.types import placeholder_type -from google.ads.googleads.v6.enums.types import policy_approval_status -from google.ads.googleads.v6.enums.types import policy_review_status -from google.ads.googleads.v6.errors.types import feed_item_validation_error - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={ - "FeedItem", - "FeedItemAttributeValue", - "FeedItemPlaceholderPolicyInfo", - "FeedItemValidationError", - }, -) - - -class FeedItem(proto.Message): - r"""A feed item. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed item. Feed item - resource names have the form: - - ``customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}`` - feed (str): - Immutable. The feed to which this feed item - belongs. - id (int): - Output only. The ID of this feed item. - start_date_time (str): - Start time in which this feed item is - effective and can begin serving. The time is in - the customer's time zone. The format is "YYYY- - MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - end_date_time (str): - End time in which this feed item is no longer - effective and will stop serving. The time is in - the customer's time zone. The format is "YYYY- - MM-DD HH:MM:SS". - Examples: "2018-03-05 09:15:00" or "2018-02-01 - 14:34:30". - attribute_values (Sequence[google.ads.googleads.v6.resources.types.FeedItemAttributeValue]): - The feed item's attribute values. - geo_targeting_restriction (google.ads.googleads.v6.enums.types.GeoTargetingRestrictionEnum.GeoTargetingRestriction): - Geo targeting restriction specifies the type - of location that can be used for targeting. - url_custom_parameters (Sequence[google.ads.googleads.v6.common.types.CustomParameter]): - The list of mappings used to substitute custom parameter - tags in a ``tracking_url_template``, ``final_urls``, or - ``mobile_final_urls``. - status (google.ads.googleads.v6.enums.types.FeedItemStatusEnum.FeedItemStatus): - Output only. Status of the feed item. - This field is read-only. - policy_infos (Sequence[google.ads.googleads.v6.resources.types.FeedItemPlaceholderPolicyInfo]): - Output only. List of info about a feed item's - validation and approval state for active feed - mappings. There will be an entry in the list for - each type of feed mapping associated with the - feed, e.g. a feed with a sitelink and a call - feed mapping would cause every feed item - associated with that feed to have an entry in - this list for both sitelink and call. This field - is read-only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=11, optional=True) - id = proto.Field(proto.INT64, number=12, optional=True) - start_date_time = proto.Field(proto.STRING, number=13, optional=True) - end_date_time = proto.Field(proto.STRING, number=14, optional=True) - attribute_values = proto.RepeatedField( - proto.MESSAGE, number=6, message="FeedItemAttributeValue", - ) - geo_targeting_restriction = proto.Field( - proto.ENUM, - number=7, - enum=gage_geo_targeting_restriction.GeoTargetingRestrictionEnum.GeoTargetingRestriction, - ) - url_custom_parameters = proto.RepeatedField( - proto.MESSAGE, number=8, message=custom_parameter.CustomParameter, - ) - status = proto.Field( - proto.ENUM, - number=9, - enum=feed_item_status.FeedItemStatusEnum.FeedItemStatus, - ) - policy_infos = proto.RepeatedField( - proto.MESSAGE, number=10, message="FeedItemPlaceholderPolicyInfo", - ) - - -class FeedItemAttributeValue(proto.Message): - r"""A feed item attribute value. - - Attributes: - feed_attribute_id (int): - Id of the feed attribute for which the value - is associated with. - integer_value (int): - Int64 value. Should be set if feed_attribute_id refers to a - feed attribute of type INT64. - boolean_value (bool): - Bool value. Should be set if feed_attribute_id refers to a - feed attribute of type BOOLEAN. - string_value (str): - String value. Should be set if feed_attribute_id refers to a - feed attribute of type STRING, URL or DATE_TIME. For STRING - the maximum length is 1500 characters. For URL the maximum - length is 2076 characters. For DATE_TIME the string must be - in the format "YYYYMMDD HHMMSS". - double_value (float): - Double value. Should be set if feed_attribute_id refers to a - feed attribute of type DOUBLE. - price_value (google.ads.googleads.v6.common.types.Money): - Price value. Should be set if feed_attribute_id refers to a - feed attribute of type PRICE. - integer_values (Sequence[int]): - Repeated int64 value. Should be set if feed_attribute_id - refers to a feed attribute of type INT64_LIST. - boolean_values (Sequence[bool]): - Repeated bool value. Should be set if feed_attribute_id - refers to a feed attribute of type BOOLEAN_LIST. - string_values (Sequence[str]): - Repeated string value. Should be set if feed_attribute_id - refers to a feed attribute of type STRING_LIST, URL_LIST or - DATE_TIME_LIST. For STRING_LIST and URL_LIST the total size - of the list in bytes may not exceed 3000. For DATE_TIME_LIST - the number of elements may not exceed 200. - - For STRING_LIST the maximum length of each string element is - 1500 characters. For URL_LIST the maximum length is 2076 - characters. For DATE_TIME the format of the string must be - the same as start and end time for the feed item. - double_values (Sequence[float]): - Repeated double value. Should be set if feed_attribute_id - refers to a feed attribute of type DOUBLE_LIST. - """ - - feed_attribute_id = proto.Field(proto.INT64, number=11, optional=True) - integer_value = proto.Field(proto.INT64, number=12, optional=True) - boolean_value = proto.Field(proto.BOOL, number=13, optional=True) - string_value = proto.Field(proto.STRING, number=14, optional=True) - double_value = proto.Field(proto.DOUBLE, number=15, optional=True) - price_value = proto.Field( - proto.MESSAGE, number=6, message=feed_common.Money, - ) - integer_values = proto.RepeatedField(proto.INT64, number=16) - boolean_values = proto.RepeatedField(proto.BOOL, number=17) - string_values = proto.RepeatedField(proto.STRING, number=18) - double_values = proto.RepeatedField(proto.DOUBLE, number=19) - - -class FeedItemPlaceholderPolicyInfo(proto.Message): - r"""Policy, validation, and quality approval info for a feed item - for the specified placeholder type. - - Attributes: - placeholder_type_enum (google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType): - Output only. The placeholder type. - feed_mapping_resource_name (str): - Output only. The FeedMapping that contains - the placeholder type. - review_status (google.ads.googleads.v6.enums.types.PolicyReviewStatusEnum.PolicyReviewStatus): - Output only. Where the placeholder type is in - the review process. - approval_status (google.ads.googleads.v6.enums.types.PolicyApprovalStatusEnum.PolicyApprovalStatus): - Output only. The overall approval status of - the placeholder type, calculated based on the - status of its individual policy topic entries. - policy_topic_entries (Sequence[google.ads.googleads.v6.common.types.PolicyTopicEntry]): - Output only. The list of policy findings for - the placeholder type. - validation_status (google.ads.googleads.v6.enums.types.FeedItemValidationStatusEnum.FeedItemValidationStatus): - Output only. The validation status of the - palceholder type. - validation_errors (Sequence[google.ads.googleads.v6.resources.types.FeedItemValidationError]): - Output only. List of placeholder type - validation errors. - quality_approval_status (google.ads.googleads.v6.enums.types.FeedItemQualityApprovalStatusEnum.FeedItemQualityApprovalStatus): - Output only. Placeholder type quality - evaluation approval status. - quality_disapproval_reasons (Sequence[google.ads.googleads.v6.enums.types.FeedItemQualityDisapprovalReasonEnum.FeedItemQualityDisapprovalReason]): - Output only. List of placeholder type quality - evaluation disapproval reasons. - """ - - placeholder_type_enum = proto.Field( - proto.ENUM, - number=10, - enum=placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - feed_mapping_resource_name = proto.Field( - proto.STRING, number=11, optional=True - ) - review_status = proto.Field( - proto.ENUM, - number=3, - enum=policy_review_status.PolicyReviewStatusEnum.PolicyReviewStatus, - ) - approval_status = proto.Field( - proto.ENUM, - number=4, - enum=policy_approval_status.PolicyApprovalStatusEnum.PolicyApprovalStatus, - ) - policy_topic_entries = proto.RepeatedField( - proto.MESSAGE, number=5, message=policy.PolicyTopicEntry, - ) - validation_status = proto.Field( - proto.ENUM, - number=6, - enum=feed_item_validation_status.FeedItemValidationStatusEnum.FeedItemValidationStatus, - ) - validation_errors = proto.RepeatedField( - proto.MESSAGE, number=7, message="FeedItemValidationError", - ) - quality_approval_status = proto.Field( - proto.ENUM, - number=8, - enum=feed_item_quality_approval_status.FeedItemQualityApprovalStatusEnum.FeedItemQualityApprovalStatus, - ) - quality_disapproval_reasons = proto.RepeatedField( - proto.ENUM, - number=9, - enum=feed_item_quality_disapproval_reason.FeedItemQualityDisapprovalReasonEnum.FeedItemQualityDisapprovalReason, - ) - - -class FeedItemValidationError(proto.Message): - r"""Stores a validation error and the set of offending feed - attributes which together are responsible for causing a feed - item validation error. - - Attributes: - validation_error (google.ads.googleads.v6.errors.types.FeedItemValidationErrorEnum.FeedItemValidationError): - Output only. Error code indicating what - validation error was triggered. The description - of the error can be found in the 'description' - field. - description (str): - Output only. The description of the - validation error. - feed_attribute_ids (Sequence[int]): - Output only. Set of feed attributes in the - feed item flagged during validation. If empty, - no specific feed attributes can be associated - with the error (e.g. error across the entire - feed item). - extra_info (str): - Output only. Any extra information related to this error - which is not captured by validation_error and - feed_attribute_id (e.g. placeholder field IDs when - feed_attribute_id is not mapped). Note that extra_info is - not localized. - """ - - validation_error = proto.Field( - proto.ENUM, - number=1, - enum=feed_item_validation_error.FeedItemValidationErrorEnum.FeedItemValidationError, - ) - description = proto.Field(proto.STRING, number=6, optional=True) - feed_attribute_ids = proto.RepeatedField(proto.INT64, number=7) - extra_info = proto.Field(proto.STRING, number=8, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_item_set.py b/google/ads/googleads/v6/resources/types/feed_item_set.py deleted file mode 100644 index 75b05b1b9..000000000 --- a/google/ads/googleads/v6/resources/types/feed_item_set.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import feed_item_set_filter_type_infos -from google.ads.googleads.v6.enums.types import feed_item_set_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSet",}, -) - - -class FeedItemSet(proto.Message): - r"""Represents a set of feed items. The set can be used and - shared among certain feed item features. For instance, the set - can be referenced within the matching functions of CustomerFeed, - CampaignFeed, and AdGroupFeed. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed item set. Feed item - set resource names have the form: - ``customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}`` - feed (str): - Immutable. The resource name of the feed - containing the feed items in the set. Immutable. - Required. - feed_item_set_id (int): - Output only. ID of the set. - display_name (str): - Name of the set. Must be unique within the - account. - status (google.ads.googleads.v6.enums.types.FeedItemSetStatusEnum.FeedItemSetStatus): - Output only. Status of the feed item set. - This field is read-only. - dynamic_location_set_filter (google.ads.googleads.v6.common.types.DynamicLocationSetFilter): - Filter for dynamic location set. - It is only used for sets of locations. - dynamic_affiliate_location_set_filter (google.ads.googleads.v6.common.types.DynamicAffiliateLocationSetFilter): - Filter for dynamic affiliate location set. - This field doesn't apply generally to feed item - sets. It is only used for sets of affiliate - locations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=2) - feed_item_set_id = proto.Field(proto.INT64, number=3) - display_name = proto.Field(proto.STRING, number=4) - status = proto.Field( - proto.ENUM, - number=8, - enum=feed_item_set_status.FeedItemSetStatusEnum.FeedItemSetStatus, - ) - dynamic_location_set_filter = proto.Field( - proto.MESSAGE, - number=5, - oneof="dynamic_set_filter", - message=feed_item_set_filter_type_infos.DynamicLocationSetFilter, - ) - dynamic_affiliate_location_set_filter = proto.Field( - proto.MESSAGE, - number=6, - oneof="dynamic_set_filter", - message=feed_item_set_filter_type_infos.DynamicAffiliateLocationSetFilter, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_item_set_link.py b/google/ads/googleads/v6/resources/types/feed_item_set_link.py deleted file mode 100644 index cb7ddaca8..000000000 --- a/google/ads/googleads/v6/resources/types/feed_item_set_link.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"FeedItemSetLink",}, -) - - -class FeedItemSetLink(proto.Message): - r"""Represents a link between a FeedItem and a FeedItemSet. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed item set link. Feed - item set link resource names have the form: - ``customers/{customer_id}/feedItemSetLinks/{feed_id}~{feed_item_set_id}~{feed_item_id}`` - feed_item (str): - Immutable. The linked FeedItem. - feed_item_set (str): - Immutable. The linked FeedItemSet. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed_item = proto.Field(proto.STRING, number=2) - feed_item_set = proto.Field(proto.STRING, number=3) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_item_target.py b/google/ads/googleads/v6/resources/types/feed_item_target.py deleted file mode 100644 index 363565438..000000000 --- a/google/ads/googleads/v6/resources/types/feed_item_target.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import feed_item_target_device -from google.ads.googleads.v6.enums.types import feed_item_target_status -from google.ads.googleads.v6.enums.types import ( - feed_item_target_type as gage_feed_item_target_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"FeedItemTarget",}, -) - - -class FeedItemTarget(proto.Message): - r"""A feed item target. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed item target. Feed - item target resource names have the form: - ``customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}`` - feed_item (str): - Immutable. The feed item to which this feed - item target belongs. - feed_item_target_type (google.ads.googleads.v6.enums.types.FeedItemTargetTypeEnum.FeedItemTargetType): - Output only. The target type of this feed - item target. This field is read-only. - feed_item_target_id (int): - Output only. The ID of the targeted resource. - This field is read-only. - status (google.ads.googleads.v6.enums.types.FeedItemTargetStatusEnum.FeedItemTargetStatus): - Output only. Status of the feed item target. - This field is read-only. - campaign (str): - Immutable. The targeted campaign. - ad_group (str): - Immutable. The targeted ad group. - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Immutable. The targeted keyword. - geo_target_constant (str): - Immutable. The targeted geo target constant - resource name. - device (google.ads.googleads.v6.enums.types.FeedItemTargetDeviceEnum.FeedItemTargetDevice): - Immutable. The targeted device. - ad_schedule (google.ads.googleads.v6.common.types.AdScheduleInfo): - Immutable. The targeted schedule. - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed_item = proto.Field(proto.STRING, number=12, optional=True) - feed_item_target_type = proto.Field( - proto.ENUM, - number=3, - enum=gage_feed_item_target_type.FeedItemTargetTypeEnum.FeedItemTargetType, - ) - feed_item_target_id = proto.Field(proto.INT64, number=13, optional=True) - status = proto.Field( - proto.ENUM, - number=11, - enum=feed_item_target_status.FeedItemTargetStatusEnum.FeedItemTargetStatus, - ) - campaign = proto.Field(proto.STRING, number=14, oneof="target") - ad_group = proto.Field(proto.STRING, number=15, oneof="target") - keyword = proto.Field( - proto.MESSAGE, number=7, oneof="target", message=criteria.KeywordInfo, - ) - geo_target_constant = proto.Field(proto.STRING, number=16, oneof="target") - device = proto.Field( - proto.ENUM, - number=9, - oneof="target", - enum=feed_item_target_device.FeedItemTargetDeviceEnum.FeedItemTargetDevice, - ) - ad_schedule = proto.Field( - proto.MESSAGE, - number=10, - oneof="target", - message=criteria.AdScheduleInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_mapping.py b/google/ads/googleads/v6/resources/types/feed_mapping.py deleted file mode 100644 index 5dd054d52..000000000 --- a/google/ads/googleads/v6/resources/types/feed_mapping.py +++ /dev/null @@ -1,319 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ad_customizer_placeholder_field -from google.ads.googleads.v6.enums.types import ( - affiliate_location_placeholder_field, -) -from google.ads.googleads.v6.enums.types import app_placeholder_field -from google.ads.googleads.v6.enums.types import call_placeholder_field -from google.ads.googleads.v6.enums.types import callout_placeholder_field -from google.ads.googleads.v6.enums.types import custom_placeholder_field -from google.ads.googleads.v6.enums.types import dsa_page_feed_criterion_field -from google.ads.googleads.v6.enums.types import education_placeholder_field -from google.ads.googleads.v6.enums.types import feed_mapping_criterion_type -from google.ads.googleads.v6.enums.types import feed_mapping_status -from google.ads.googleads.v6.enums.types import flight_placeholder_field -from google.ads.googleads.v6.enums.types import hotel_placeholder_field -from google.ads.googleads.v6.enums.types import image_placeholder_field -from google.ads.googleads.v6.enums.types import job_placeholder_field -from google.ads.googleads.v6.enums.types import local_placeholder_field -from google.ads.googleads.v6.enums.types import ( - location_extension_targeting_criterion_field, -) -from google.ads.googleads.v6.enums.types import location_placeholder_field -from google.ads.googleads.v6.enums.types import message_placeholder_field -from google.ads.googleads.v6.enums.types import ( - placeholder_type as gage_placeholder_type, -) -from google.ads.googleads.v6.enums.types import price_placeholder_field -from google.ads.googleads.v6.enums.types import promotion_placeholder_field -from google.ads.googleads.v6.enums.types import real_estate_placeholder_field -from google.ads.googleads.v6.enums.types import sitelink_placeholder_field -from google.ads.googleads.v6.enums.types import ( - structured_snippet_placeholder_field, -) -from google.ads.googleads.v6.enums.types import travel_placeholder_field - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"FeedMapping", "AttributeFieldMapping",}, -) - - -class FeedMapping(proto.Message): - r"""A feed mapping. - - Attributes: - resource_name (str): - Immutable. The resource name of the feed mapping. Feed - mapping resource names have the form: - - ``customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}`` - feed (str): - Immutable. The feed of this feed mapping. - attribute_field_mappings (Sequence[google.ads.googleads.v6.resources.types.AttributeFieldMapping]): - Immutable. Feed attributes to field mappings. - These mappings are a one-to-many relationship - meaning that 1 feed attribute can be used to - populate multiple placeholder fields, but 1 - placeholder field can only draw data from 1 feed - attribute. Ad Customizer is an exception, 1 - placeholder field can be mapped to multiple feed - attributes. Required. - status (google.ads.googleads.v6.enums.types.FeedMappingStatusEnum.FeedMappingStatus): - Output only. Status of the feed mapping. - This field is read-only. - placeholder_type (google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType): - Immutable. The placeholder type of this - mapping (i.e., if the mapping maps feed - attributes to placeholder fields). - criterion_type (google.ads.googleads.v6.enums.types.FeedMappingCriterionTypeEnum.FeedMappingCriterionType): - Immutable. The criterion type of this mapping - (i.e., if the mapping maps feed attributes to - criterion fields). - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.STRING, number=7, optional=True) - attribute_field_mappings = proto.RepeatedField( - proto.MESSAGE, number=5, message="AttributeFieldMapping", - ) - status = proto.Field( - proto.ENUM, - number=6, - enum=feed_mapping_status.FeedMappingStatusEnum.FeedMappingStatus, - ) - placeholder_type = proto.Field( - proto.ENUM, - number=3, - oneof="target", - enum=gage_placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - criterion_type = proto.Field( - proto.ENUM, - number=4, - oneof="target", - enum=feed_mapping_criterion_type.FeedMappingCriterionTypeEnum.FeedMappingCriterionType, - ) - - -class AttributeFieldMapping(proto.Message): - r"""Maps from feed attribute id to a placeholder or criterion - field id. - - Attributes: - feed_attribute_id (int): - Immutable. Feed attribute from which to map. - field_id (int): - Output only. The placeholder field ID. If a - placeholder field enum is not published in the - current API version, then this field will be - populated and the field oneof will be empty. - This field is read-only. - sitelink_field (google.ads.googleads.v6.enums.types.SitelinkPlaceholderFieldEnum.SitelinkPlaceholderField): - Immutable. Sitelink Placeholder Fields. - call_field (google.ads.googleads.v6.enums.types.CallPlaceholderFieldEnum.CallPlaceholderField): - Immutable. Call Placeholder Fields. - app_field (google.ads.googleads.v6.enums.types.AppPlaceholderFieldEnum.AppPlaceholderField): - Immutable. App Placeholder Fields. - location_field (google.ads.googleads.v6.enums.types.LocationPlaceholderFieldEnum.LocationPlaceholderField): - Output only. Location Placeholder Fields. - This field is read-only. - affiliate_location_field (google.ads.googleads.v6.enums.types.AffiliateLocationPlaceholderFieldEnum.AffiliateLocationPlaceholderField): - Output only. Affiliate Location Placeholder - Fields. This field is read-only. - callout_field (google.ads.googleads.v6.enums.types.CalloutPlaceholderFieldEnum.CalloutPlaceholderField): - Immutable. Callout Placeholder Fields. - structured_snippet_field (google.ads.googleads.v6.enums.types.StructuredSnippetPlaceholderFieldEnum.StructuredSnippetPlaceholderField): - Immutable. Structured Snippet Placeholder - Fields. - message_field (google.ads.googleads.v6.enums.types.MessagePlaceholderFieldEnum.MessagePlaceholderField): - Immutable. Message Placeholder Fields. - price_field (google.ads.googleads.v6.enums.types.PricePlaceholderFieldEnum.PricePlaceholderField): - Immutable. Price Placeholder Fields. - promotion_field (google.ads.googleads.v6.enums.types.PromotionPlaceholderFieldEnum.PromotionPlaceholderField): - Immutable. Promotion Placeholder Fields. - ad_customizer_field (google.ads.googleads.v6.enums.types.AdCustomizerPlaceholderFieldEnum.AdCustomizerPlaceholderField): - Immutable. Ad Customizer Placeholder Fields - dsa_page_feed_field (google.ads.googleads.v6.enums.types.DsaPageFeedCriterionFieldEnum.DsaPageFeedCriterionField): - Immutable. Dynamic Search Ad Page Feed - Fields. - location_extension_targeting_field (google.ads.googleads.v6.enums.types.LocationExtensionTargetingCriterionFieldEnum.LocationExtensionTargetingCriterionField): - Immutable. Location Target Fields. - education_field (google.ads.googleads.v6.enums.types.EducationPlaceholderFieldEnum.EducationPlaceholderField): - Immutable. Education Placeholder Fields - flight_field (google.ads.googleads.v6.enums.types.FlightPlaceholderFieldEnum.FlightPlaceholderField): - Immutable. Flight Placeholder Fields - custom_field (google.ads.googleads.v6.enums.types.CustomPlaceholderFieldEnum.CustomPlaceholderField): - Immutable. Custom Placeholder Fields - hotel_field (google.ads.googleads.v6.enums.types.HotelPlaceholderFieldEnum.HotelPlaceholderField): - Immutable. Hotel Placeholder Fields - real_estate_field (google.ads.googleads.v6.enums.types.RealEstatePlaceholderFieldEnum.RealEstatePlaceholderField): - Immutable. Real Estate Placeholder Fields - travel_field (google.ads.googleads.v6.enums.types.TravelPlaceholderFieldEnum.TravelPlaceholderField): - Immutable. Travel Placeholder Fields - local_field (google.ads.googleads.v6.enums.types.LocalPlaceholderFieldEnum.LocalPlaceholderField): - Immutable. Local Placeholder Fields - job_field (google.ads.googleads.v6.enums.types.JobPlaceholderFieldEnum.JobPlaceholderField): - Immutable. Job Placeholder Fields - image_field (google.ads.googleads.v6.enums.types.ImagePlaceholderFieldEnum.ImagePlaceholderField): - Immutable. Image Placeholder Fields - """ - - feed_attribute_id = proto.Field(proto.INT64, number=24, optional=True) - field_id = proto.Field(proto.INT64, number=25, optional=True) - sitelink_field = proto.Field( - proto.ENUM, - number=3, - oneof="field", - enum=sitelink_placeholder_field.SitelinkPlaceholderFieldEnum.SitelinkPlaceholderField, - ) - call_field = proto.Field( - proto.ENUM, - number=4, - oneof="field", - enum=call_placeholder_field.CallPlaceholderFieldEnum.CallPlaceholderField, - ) - app_field = proto.Field( - proto.ENUM, - number=5, - oneof="field", - enum=app_placeholder_field.AppPlaceholderFieldEnum.AppPlaceholderField, - ) - location_field = proto.Field( - proto.ENUM, - number=6, - oneof="field", - enum=location_placeholder_field.LocationPlaceholderFieldEnum.LocationPlaceholderField, - ) - affiliate_location_field = proto.Field( - proto.ENUM, - number=7, - oneof="field", - enum=affiliate_location_placeholder_field.AffiliateLocationPlaceholderFieldEnum.AffiliateLocationPlaceholderField, - ) - callout_field = proto.Field( - proto.ENUM, - number=8, - oneof="field", - enum=callout_placeholder_field.CalloutPlaceholderFieldEnum.CalloutPlaceholderField, - ) - structured_snippet_field = proto.Field( - proto.ENUM, - number=9, - oneof="field", - enum=structured_snippet_placeholder_field.StructuredSnippetPlaceholderFieldEnum.StructuredSnippetPlaceholderField, - ) - message_field = proto.Field( - proto.ENUM, - number=10, - oneof="field", - enum=message_placeholder_field.MessagePlaceholderFieldEnum.MessagePlaceholderField, - ) - price_field = proto.Field( - proto.ENUM, - number=11, - oneof="field", - enum=price_placeholder_field.PricePlaceholderFieldEnum.PricePlaceholderField, - ) - promotion_field = proto.Field( - proto.ENUM, - number=12, - oneof="field", - enum=promotion_placeholder_field.PromotionPlaceholderFieldEnum.PromotionPlaceholderField, - ) - ad_customizer_field = proto.Field( - proto.ENUM, - number=13, - oneof="field", - enum=ad_customizer_placeholder_field.AdCustomizerPlaceholderFieldEnum.AdCustomizerPlaceholderField, - ) - dsa_page_feed_field = proto.Field( - proto.ENUM, - number=14, - oneof="field", - enum=dsa_page_feed_criterion_field.DsaPageFeedCriterionFieldEnum.DsaPageFeedCriterionField, - ) - location_extension_targeting_field = proto.Field( - proto.ENUM, - number=15, - oneof="field", - enum=location_extension_targeting_criterion_field.LocationExtensionTargetingCriterionFieldEnum.LocationExtensionTargetingCriterionField, - ) - education_field = proto.Field( - proto.ENUM, - number=16, - oneof="field", - enum=education_placeholder_field.EducationPlaceholderFieldEnum.EducationPlaceholderField, - ) - flight_field = proto.Field( - proto.ENUM, - number=17, - oneof="field", - enum=flight_placeholder_field.FlightPlaceholderFieldEnum.FlightPlaceholderField, - ) - custom_field = proto.Field( - proto.ENUM, - number=18, - oneof="field", - enum=custom_placeholder_field.CustomPlaceholderFieldEnum.CustomPlaceholderField, - ) - hotel_field = proto.Field( - proto.ENUM, - number=19, - oneof="field", - enum=hotel_placeholder_field.HotelPlaceholderFieldEnum.HotelPlaceholderField, - ) - real_estate_field = proto.Field( - proto.ENUM, - number=20, - oneof="field", - enum=real_estate_placeholder_field.RealEstatePlaceholderFieldEnum.RealEstatePlaceholderField, - ) - travel_field = proto.Field( - proto.ENUM, - number=21, - oneof="field", - enum=travel_placeholder_field.TravelPlaceholderFieldEnum.TravelPlaceholderField, - ) - local_field = proto.Field( - proto.ENUM, - number=22, - oneof="field", - enum=local_placeholder_field.LocalPlaceholderFieldEnum.LocalPlaceholderField, - ) - job_field = proto.Field( - proto.ENUM, - number=23, - oneof="field", - enum=job_placeholder_field.JobPlaceholderFieldEnum.JobPlaceholderField, - ) - image_field = proto.Field( - proto.ENUM, - number=26, - oneof="field", - enum=image_placeholder_field.ImagePlaceholderFieldEnum.ImagePlaceholderField, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/feed_placeholder_view.py b/google/ads/googleads/v6/resources/types/feed_placeholder_view.py deleted file mode 100644 index ec0ee3ccf..000000000 --- a/google/ads/googleads/v6/resources/types/feed_placeholder_view.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - placeholder_type as gage_placeholder_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"FeedPlaceholderView",}, -) - - -class FeedPlaceholderView(proto.Message): - r"""A feed placeholder view. - - Attributes: - resource_name (str): - Output only. The resource name of the feed placeholder view. - Feed placeholder view resource names have the form: - - ``customers/{customer_id}/feedPlaceholderViews/{placeholder_type}`` - placeholder_type (google.ads.googleads.v6.enums.types.PlaceholderTypeEnum.PlaceholderType): - Output only. The placeholder type of the feed - placeholder view. - """ - - resource_name = proto.Field(proto.STRING, number=1) - placeholder_type = proto.Field( - proto.ENUM, - number=2, - enum=gage_placeholder_type.PlaceholderTypeEnum.PlaceholderType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/gender_view.py b/google/ads/googleads/v6/resources/types/gender_view.py deleted file mode 100644 index 11072c0d7..000000000 --- a/google/ads/googleads/v6/resources/types/gender_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"GenderView",}, -) - - -class GenderView(proto.Message): - r"""A gender view. - - Attributes: - resource_name (str): - Output only. The resource name of the gender view. Gender - view resource names have the form: - - ``customers/{customer_id}/genderViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/geo_target_constant.py b/google/ads/googleads/v6/resources/types/geo_target_constant.py deleted file mode 100644 index d9dd5a685..000000000 --- a/google/ads/googleads/v6/resources/types/geo_target_constant.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import geo_target_constant_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"GeoTargetConstant",}, -) - - -class GeoTargetConstant(proto.Message): - r"""A geo target constant. - - Attributes: - resource_name (str): - Output only. The resource name of the geo target constant. - Geo target constant resource names have the form: - - ``geoTargetConstants/{geo_target_constant_id}`` - id (int): - Output only. The ID of the geo target - constant. - name (str): - Output only. Geo target constant English - name. - country_code (str): - Output only. The ISO-3166-1 alpha-2 country - code that is associated with the target. - target_type (str): - Output only. Geo target constant target type. - status (google.ads.googleads.v6.enums.types.GeoTargetConstantStatusEnum.GeoTargetConstantStatus): - Output only. Geo target constant status. - canonical_name (str): - Output only. The fully qualified English - name, consisting of the target's name and that - of its parent and country. - parent_geo_target (str): - Output only. The resource name of the parent geo target - constant. Geo target constant resource names have the form: - - ``geoTargetConstants/{parent_geo_target_constant_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=10, optional=True) - name = proto.Field(proto.STRING, number=11, optional=True) - country_code = proto.Field(proto.STRING, number=12, optional=True) - target_type = proto.Field(proto.STRING, number=13, optional=True) - status = proto.Field( - proto.ENUM, - number=7, - enum=geo_target_constant_status.GeoTargetConstantStatusEnum.GeoTargetConstantStatus, - ) - canonical_name = proto.Field(proto.STRING, number=14, optional=True) - parent_geo_target = proto.Field(proto.STRING, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/geographic_view.py b/google/ads/googleads/v6/resources/types/geographic_view.py deleted file mode 100644 index 982ccca93..000000000 --- a/google/ads/googleads/v6/resources/types/geographic_view.py +++ /dev/null @@ -1,61 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import geo_targeting_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"GeographicView",}, -) - - -class GeographicView(proto.Message): - r"""A geographic view. - Geographic View includes all metrics aggregated at the country - level, one row per country. It reports metrics at either actual - physical location of the user or an area of interest. If other - segment fields are used, you may get more than one row per - country. - - Attributes: - resource_name (str): - Output only. The resource name of the geographic view. - Geographic view resource names have the form: - - ``customers/{customer_id}/geographicViews/{country_criterion_id}~{location_type}`` - location_type (google.ads.googleads.v6.enums.types.GeoTargetingTypeEnum.GeoTargetingType): - Output only. Type of the geo targeting of the - campaign. - country_criterion_id (int): - Output only. Criterion Id for the country. - """ - - resource_name = proto.Field(proto.STRING, number=1) - location_type = proto.Field( - proto.ENUM, - number=3, - enum=geo_targeting_type.GeoTargetingTypeEnum.GeoTargetingType, - ) - country_criterion_id = proto.Field(proto.INT64, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/google_ads_field.py b/google/ads/googleads/v6/resources/types/google_ads_field.py deleted file mode 100644 index 261d60beb..000000000 --- a/google/ads/googleads/v6/resources/types/google_ads_field.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import google_ads_field_category -from google.ads.googleads.v6.enums.types import google_ads_field_data_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"GoogleAdsField",}, -) - - -class GoogleAdsField(proto.Message): - r"""A field or resource (artifact) used by GoogleAdsService. - - Attributes: - resource_name (str): - Output only. The resource name of the artifact. Artifact - resource names have the form: - - ``googleAdsFields/{name}`` - name (str): - Output only. The name of the artifact. - category (google.ads.googleads.v6.enums.types.GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategory): - Output only. The category of the artifact. - selectable (bool): - Output only. Whether the artifact can be used - in a SELECT clause in search queries. - filterable (bool): - Output only. Whether the artifact can be used - in a WHERE clause in search queries. - sortable (bool): - Output only. Whether the artifact can be used - in a ORDER BY clause in search queries. - selectable_with (Sequence[str]): - Output only. The names of all resources, - segments, and metrics that are selectable with - the described artifact. - attribute_resources (Sequence[str]): - Output only. The names of all resources that - are selectable with the described artifact. - Fields from these resources do not segment - metrics when included in search queries. - - This field is only set for artifacts whose - category is RESOURCE. - metrics (Sequence[str]): - Output only. At and beyond version V1 this - field lists the names of all metrics that are - selectable with the described artifact when it - is used in the FROM clause. It is only set for - artifacts whose category is RESOURCE. - Before version V1 this field lists the names of - all metrics that are selectable with the - described artifact. It is only set for artifacts - whose category is either RESOURCE or SEGMENT - segments (Sequence[str]): - Output only. At and beyond version V1 this - field lists the names of all artifacts, whether - a segment or another resource, that segment - metrics when included in search queries and when - the described artifact is used in the FROM - clause. It is only set for artifacts whose - category is RESOURCE. - Before version V1 this field lists the names of - all artifacts, whether a segment or another - resource, that segment metrics when included in - search queries. It is only set for artifacts of - category RESOURCE, SEGMENT or METRIC. - enum_values (Sequence[str]): - Output only. Values the artifact can assume - if it is a field of type ENUM. - This field is only set for artifacts of category - SEGMENT or ATTRIBUTE. - data_type (google.ads.googleads.v6.enums.types.GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType): - Output only. This field determines the - operators that can be used with the artifact in - WHERE clauses. - type_url (str): - Output only. The URL of proto describing the - artifact's data type. - is_repeated (bool): - Output only. Whether the field artifact is - repeated. - """ - - resource_name = proto.Field(proto.STRING, number=1) - name = proto.Field(proto.STRING, number=21, optional=True) - category = proto.Field( - proto.ENUM, - number=3, - enum=google_ads_field_category.GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategory, - ) - selectable = proto.Field(proto.BOOL, number=22, optional=True) - filterable = proto.Field(proto.BOOL, number=23, optional=True) - sortable = proto.Field(proto.BOOL, number=24, optional=True) - selectable_with = proto.RepeatedField(proto.STRING, number=25) - attribute_resources = proto.RepeatedField(proto.STRING, number=26) - metrics = proto.RepeatedField(proto.STRING, number=27) - segments = proto.RepeatedField(proto.STRING, number=28) - enum_values = proto.RepeatedField(proto.STRING, number=29) - data_type = proto.Field( - proto.ENUM, - number=12, - enum=google_ads_field_data_type.GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType, - ) - type_url = proto.Field(proto.STRING, number=30, optional=True) - is_repeated = proto.Field(proto.BOOL, number=31, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/group_placement_view.py b/google/ads/googleads/v6/resources/types/group_placement_view.py deleted file mode 100644 index 0c45f0004..000000000 --- a/google/ads/googleads/v6/resources/types/group_placement_view.py +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - placement_type as gage_placement_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"GroupPlacementView",}, -) - - -class GroupPlacementView(proto.Message): - r"""A group placement view. - - Attributes: - resource_name (str): - Output only. The resource name of the group placement view. - Group placement view resource names have the form: - - ``customers/{customer_id}/groupPlacementViews/{ad_group_id}~{base64_placement}`` - placement (str): - Output only. The automatic placement string - at group level, e. g. web domain, mobile app ID, - or a YouTube channel ID. - display_name (str): - Output only. Domain name for websites and - YouTube channel name for YouTube channels. - target_url (str): - Output only. URL of the group placement, e.g. - domain, link to the mobile application in app - store, or a YouTube channel URL. - placement_type (google.ads.googleads.v6.enums.types.PlacementTypeEnum.PlacementType): - Output only. Type of the placement, e.g. - Website, YouTube Channel, Mobile Application. - """ - - resource_name = proto.Field(proto.STRING, number=1) - placement = proto.Field(proto.STRING, number=6, optional=True) - display_name = proto.Field(proto.STRING, number=7, optional=True) - target_url = proto.Field(proto.STRING, number=8, optional=True) - placement_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_placement_type.PlacementTypeEnum.PlacementType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/hotel_group_view.py b/google/ads/googleads/v6/resources/types/hotel_group_view.py deleted file mode 100644 index f2d946150..000000000 --- a/google/ads/googleads/v6/resources/types/hotel_group_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"HotelGroupView",}, -) - - -class HotelGroupView(proto.Message): - r"""A hotel group view. - - Attributes: - resource_name (str): - Output only. The resource name of the hotel group view. - Hotel Group view resource names have the form: - - ``customers/{customer_id}/hotelGroupViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/hotel_performance_view.py b/google/ads/googleads/v6/resources/types/hotel_performance_view.py deleted file mode 100644 index 51190f369..000000000 --- a/google/ads/googleads/v6/resources/types/hotel_performance_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"HotelPerformanceView",}, -) - - -class HotelPerformanceView(proto.Message): - r"""A hotel performance view. - - Attributes: - resource_name (str): - Output only. The resource name of the hotel performance - view. Hotel performance view resource names have the form: - - ``customers/{customer_id}/hotelPerformanceView`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/income_range_view.py b/google/ads/googleads/v6/resources/types/income_range_view.py deleted file mode 100644 index 46936358c..000000000 --- a/google/ads/googleads/v6/resources/types/income_range_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"IncomeRangeView",}, -) - - -class IncomeRangeView(proto.Message): - r"""An income range view. - - Attributes: - resource_name (str): - Output only. The resource name of the income range view. - Income range view resource names have the form: - - ``customers/{customer_id}/incomeRangeViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/invoice.py b/google/ads/googleads/v6/resources/types/invoice.py deleted file mode 100644 index 51ff40ede..000000000 --- a/google/ads/googleads/v6/resources/types/invoice.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import dates -from google.ads.googleads.v6.enums.types import invoice_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Invoice",}, -) - - -class Invoice(proto.Message): - r"""An invoice. All invoice information is snapshotted to match - the PDF invoice. For invoices older than the launch of - InvoiceService, the snapshotted information may not match the - PDF invoice. - - Attributes: - resource_name (str): - Output only. The resource name of the invoice. Multiple - customers can share a given invoice, so multiple resource - names may point to the same invoice. Invoice resource names - have the form: - - ``customers/{customer_id}/invoices/{invoice_id}`` - id (str): - Output only. The ID of the invoice. It - appears on the invoice PDF as "Invoice number". - type_ (google.ads.googleads.v6.enums.types.InvoiceTypeEnum.InvoiceType): - Output only. The type of invoice. - billing_setup (str): - Output only. The resource name of this invoice’s billing - setup. - - ``customers/{customer_id}/billingSetups/{billing_setup_id}`` - payments_account_id (str): - Output only. A 16 digit ID used to identify - the payments account associated with the billing - setup, e.g. "1234-5678-9012-3456". It appears on - the invoice PDF as "Billing Account Number". - payments_profile_id (str): - Output only. A 12 digit ID used to identify - the payments profile associated with the billing - setup, e.g. "1234-5678-9012". It appears on the - invoice PDF as "Billing ID". - issue_date (str): - Output only. The issue date in yyyy-mm-dd - format. It appears on the invoice PDF as either - "Issue date" or "Invoice date". - due_date (str): - Output only. The due date in yyyy-mm-dd - format. - service_date_range (google.ads.googleads.v6.common.types.DateRange): - Output only. The service period date range of - this invoice. The end date is inclusive. - currency_code (str): - Output only. The currency code. All costs are - returned in this currency. A subset of the - currency codes derived from the ISO 4217 - standard is supported. - adjustments_subtotal_amount_micros (int): - Output only. The pretax subtotal amount of - invoice level adjustments, in micros. - adjustments_tax_amount_micros (int): - Output only. The sum of taxes on the invoice - level adjustments, in micros. - adjustments_total_amount_micros (int): - Output only. The total amount of invoice - level adjustments, in micros. - regulatory_costs_subtotal_amount_micros (int): - Output only. The pretax subtotal amount of - invoice level regulatory costs, in micros. - regulatory_costs_tax_amount_micros (int): - Output only. The sum of taxes on the invoice - level regulatory costs, in micros. - regulatory_costs_total_amount_micros (int): - Output only. The total amount of invoice - level regulatory costs, in micros. - subtotal_amount_micros (int): - Output only. The pretax subtotal amount, in micros. This - equals the sum of the AccountBudgetSummary subtotal amounts, - Invoice.adjustments_subtotal_amount_micros, and - Invoice.regulatory_costs_subtotal_amount_micros. Starting - with v6, the Invoice.regulatory_costs_subtotal_amount_micros - is no longer included. - tax_amount_micros (int): - Output only. The sum of all taxes on the - invoice, in micros. This equals the sum of the - AccountBudgetSummary tax amounts, plus taxes not - associated with a specific account budget. - total_amount_micros (int): - Output only. The total amount, in micros. This equals the - sum of Invoice.subtotal_amount_micros and - Invoice.tax_amount_micros. Starting with v6, - Invoice.regulatory_costs_subtotal_amount_micros is also - added as it is no longer already included in - Invoice.tax_amount_micros. - corrected_invoice (str): - Output only. The resource name of the original invoice - corrected, wrote off, or canceled by this invoice, if - applicable. If ``corrected_invoice`` is set, - ``replaced_invoices`` will not be set. Invoice resource - names have the form: - - ``customers/{customer_id}/invoices/{invoice_id}`` - replaced_invoices (Sequence[str]): - Output only. The resource name of the original invoice(s) - being rebilled or replaced by this invoice, if applicable. - There might be multiple replaced invoices due to invoice - consolidation. The replaced invoices may not belong to the - same payments account. If ``replaced_invoices`` is set, - ``corrected_invoice`` will not be set. Invoice resource - names have the form: - - ``customers/{customer_id}/invoices/{invoice_id}`` - pdf_url (str): - Output only. The URL to a PDF copy of the - invoice. Users need to pass in their OAuth token - to request the PDF with this URL. - account_budget_summaries (Sequence[google.ads.googleads.v6.resources.types.Invoice.AccountBudgetSummary]): - Output only. The list of summarized account - budget information associated with this invoice. - """ - - class AccountBudgetSummary(proto.Message): - r"""Represents a summarized account budget billable cost. - - Attributes: - customer (str): - Output only. The resource name of the customer associated - with this account budget. This contains the customer ID, - which appears on the invoice PDF as "Account ID". Customer - resource names have the form: - - ``customers/{customer_id}`` - customer_descriptive_name (str): - Output only. The descriptive name of the - account budget’s customer. It appears on the - invoice PDF as "Account". - account_budget (str): - Output only. The resource name of the account budget - associated with this summarized billable cost. AccountBudget - resource names have the form: - - ``customers/{customer_id}/accountBudgets/{account_budget_id}`` - account_budget_name (str): - Output only. The name of the account budget. - It appears on the invoice PDF as "Account - budget". - purchase_order_number (str): - Output only. The purchase order number of the - account budget. It appears on the invoice PDF as - "Purchase order". - subtotal_amount_micros (int): - Output only. The pretax subtotal amount - attributable to this budget during the service - period, in micros. - tax_amount_micros (int): - Output only. The tax amount attributable to - this budget during the service period, in - micros. - total_amount_micros (int): - Output only. The total amount attributable to - this budget during the service period, in - micros. This equals the sum of the account - budget subtotal amount and the account budget - tax amount. - billable_activity_date_range (google.ads.googleads.v6.common.types.DateRange): - Output only. The billable activity date range - of the account budget, within the service date - range of this invoice. The end date is - inclusive. This can be different from the - account budget's start and end time. - """ - - customer = proto.Field(proto.STRING, number=10, optional=True) - customer_descriptive_name = proto.Field( - proto.STRING, number=11, optional=True - ) - account_budget = proto.Field(proto.STRING, number=12, optional=True) - account_budget_name = proto.Field( - proto.STRING, number=13, optional=True - ) - purchase_order_number = proto.Field( - proto.STRING, number=14, optional=True - ) - subtotal_amount_micros = proto.Field( - proto.INT64, number=15, optional=True - ) - tax_amount_micros = proto.Field(proto.INT64, number=16, optional=True) - total_amount_micros = proto.Field(proto.INT64, number=17, optional=True) - billable_activity_date_range = proto.Field( - proto.MESSAGE, number=9, message=dates.DateRange, - ) - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.STRING, number=25, optional=True) - type_ = proto.Field( - proto.ENUM, number=3, enum=invoice_type.InvoiceTypeEnum.InvoiceType, - ) - billing_setup = proto.Field(proto.STRING, number=26, optional=True) - payments_account_id = proto.Field(proto.STRING, number=27, optional=True) - payments_profile_id = proto.Field(proto.STRING, number=28, optional=True) - issue_date = proto.Field(proto.STRING, number=29, optional=True) - due_date = proto.Field(proto.STRING, number=30, optional=True) - service_date_range = proto.Field( - proto.MESSAGE, number=9, message=dates.DateRange, - ) - currency_code = proto.Field(proto.STRING, number=31, optional=True) - adjustments_subtotal_amount_micros = proto.Field(proto.INT64, number=19) - adjustments_tax_amount_micros = proto.Field(proto.INT64, number=20) - adjustments_total_amount_micros = proto.Field(proto.INT64, number=21) - regulatory_costs_subtotal_amount_micros = proto.Field( - proto.INT64, number=22 - ) - regulatory_costs_tax_amount_micros = proto.Field(proto.INT64, number=23) - regulatory_costs_total_amount_micros = proto.Field(proto.INT64, number=24) - subtotal_amount_micros = proto.Field(proto.INT64, number=33, optional=True) - tax_amount_micros = proto.Field(proto.INT64, number=34, optional=True) - total_amount_micros = proto.Field(proto.INT64, number=35, optional=True) - corrected_invoice = proto.Field(proto.STRING, number=36, optional=True) - replaced_invoices = proto.RepeatedField(proto.STRING, number=37) - pdf_url = proto.Field(proto.STRING, number=38, optional=True) - account_budget_summaries = proto.RepeatedField( - proto.MESSAGE, number=18, message=AccountBudgetSummary, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_plan.py b/google/ads/googleads/v6/resources/types/keyword_plan.py deleted file mode 100644 index 8cff38f4c..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_plan.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import dates -from google.ads.googleads.v6.enums.types import keyword_plan_forecast_interval - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlan", "KeywordPlanForecastPeriod",}, -) - - -class KeywordPlan(proto.Message): - r"""A Keyword Planner plan. - Max number of saved keyword plans: 10000. - It's possible to remove plans if limit is reached. - - Attributes: - resource_name (str): - Immutable. The resource name of the Keyword Planner plan. - KeywordPlan resource names have the form: - - ``customers/{customer_id}/keywordPlans/{kp_plan_id}`` - id (int): - Output only. The ID of the keyword plan. - name (str): - The name of the keyword plan. - This field is required and should not be empty - when creating new keyword plans. - forecast_period (google.ads.googleads.v6.resources.types.KeywordPlanForecastPeriod): - The date period used for forecasting the - plan. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=5, optional=True) - name = proto.Field(proto.STRING, number=6, optional=True) - forecast_period = proto.Field( - proto.MESSAGE, number=4, message="KeywordPlanForecastPeriod", - ) - - -class KeywordPlanForecastPeriod(proto.Message): - r"""The forecasting period associated with the keyword plan. - - Attributes: - date_interval (google.ads.googleads.v6.enums.types.KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval): - A future date range relative to the current - date used for forecasting. - date_range (google.ads.googleads.v6.common.types.DateRange): - The custom date range used for forecasting. - The start and end dates must be in the future. - Otherwise, an error will be returned when the - forecasting action is performed. The start and - end dates are inclusive. - """ - - date_interval = proto.Field( - proto.ENUM, - number=1, - oneof="interval", - enum=keyword_plan_forecast_interval.KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval, - ) - date_range = proto.Field( - proto.MESSAGE, number=2, oneof="interval", message=dates.DateRange, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_plan_ad_group.py b/google/ads/googleads/v6/resources/types/keyword_plan_ad_group.py deleted file mode 100644 index 75f97eefc..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_plan_ad_group.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanAdGroup",}, -) - - -class KeywordPlanAdGroup(proto.Message): - r"""A Keyword Planner ad group. - Max number of keyword plan ad groups per plan: 200. - - Attributes: - resource_name (str): - Immutable. The resource name of the Keyword Planner ad - group. KeywordPlanAdGroup resource names have the form: - - ``customers/{customer_id}/keywordPlanAdGroups/{kp_ad_group_id}`` - keyword_plan_campaign (str): - The keyword plan campaign to which this ad - group belongs. - id (int): - Output only. The ID of the keyword plan ad - group. - name (str): - The name of the keyword plan ad group. - This field is required and should not be empty - when creating keyword plan ad group. - cpc_bid_micros (int): - A default ad group max cpc bid in micros in - account currency for all biddable keywords under - the keyword plan ad group. If not set, will - inherit from parent campaign. - """ - - resource_name = proto.Field(proto.STRING, number=1) - keyword_plan_campaign = proto.Field(proto.STRING, number=6, optional=True) - id = proto.Field(proto.INT64, number=7, optional=True) - name = proto.Field(proto.STRING, number=8, optional=True) - cpc_bid_micros = proto.Field(proto.INT64, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_plan_ad_group_keyword.py b/google/ads/googleads/v6/resources/types/keyword_plan_ad_group_keyword.py deleted file mode 100644 index 764930370..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_plan_ad_group_keyword.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import keyword_match_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanAdGroupKeyword",}, -) - - -class KeywordPlanAdGroupKeyword(proto.Message): - r"""A Keyword Plan ad group keyword. - Max number of keyword plan keywords per plan: 10000. - - Attributes: - resource_name (str): - Immutable. The resource name of the Keyword Plan ad group - keyword. KeywordPlanAdGroupKeyword resource names have the - form: - - ``customers/{customer_id}/keywordPlanAdGroupKeywords/{kp_ad_group_keyword_id}`` - keyword_plan_ad_group (str): - The Keyword Plan ad group to which this - keyword belongs. - id (int): - Output only. The ID of the Keyword Plan - keyword. - text (str): - The keyword text. - match_type (google.ads.googleads.v6.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - The keyword match type. - cpc_bid_micros (int): - A keyword level max cpc bid in micros (e.g. - $1 = 1mm). The currency is the same as the - account currency code. This will override any - CPC bid set at the keyword plan ad group level. - Not applicable for negative keywords. (negative - = true) This field is Optional. - negative (bool): - Immutable. If true, the keyword is negative. - """ - - resource_name = proto.Field(proto.STRING, number=1) - keyword_plan_ad_group = proto.Field(proto.STRING, number=8, optional=True) - id = proto.Field(proto.INT64, number=9, optional=True) - text = proto.Field(proto.STRING, number=10, optional=True) - match_type = proto.Field( - proto.ENUM, - number=5, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - cpc_bid_micros = proto.Field(proto.INT64, number=11, optional=True) - negative = proto.Field(proto.BOOL, number=12, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_plan_campaign.py b/google/ads/googleads/v6/resources/types/keyword_plan_campaign.py deleted file mode 100644 index 571150d00..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_plan_campaign.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - keyword_plan_network as gage_keyword_plan_network, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanCampaign", "KeywordPlanGeoTarget",}, -) - - -class KeywordPlanCampaign(proto.Message): - r"""A Keyword Plan campaign. - Max number of keyword plan campaigns per plan allowed: 1. - - Attributes: - resource_name (str): - Immutable. The resource name of the Keyword Plan campaign. - KeywordPlanCampaign resource names have the form: - - ``customers/{customer_id}/keywordPlanCampaigns/{kp_campaign_id}`` - keyword_plan (str): - The keyword plan this campaign belongs to. - id (int): - Output only. The ID of the Keyword Plan - campaign. - name (str): - The name of the Keyword Plan campaign. - This field is required and should not be empty - when creating Keyword Plan campaigns. - language_constants (Sequence[str]): - The languages targeted for the Keyword Plan - campaign. Max allowed: 1. - keyword_plan_network (google.ads.googleads.v6.enums.types.KeywordPlanNetworkEnum.KeywordPlanNetwork): - Targeting network. - This field is required and should not be empty - when creating Keyword Plan campaigns. - cpc_bid_micros (int): - A default max cpc bid in micros, and in the - account currency, for all ad groups under the - campaign. - This field is required and should not be empty - when creating Keyword Plan campaigns. - geo_targets (Sequence[google.ads.googleads.v6.resources.types.KeywordPlanGeoTarget]): - The geo targets. - Max number allowed: 20. - """ - - resource_name = proto.Field(proto.STRING, number=1) - keyword_plan = proto.Field(proto.STRING, number=9, optional=True) - id = proto.Field(proto.INT64, number=10, optional=True) - name = proto.Field(proto.STRING, number=11, optional=True) - language_constants = proto.RepeatedField(proto.STRING, number=12) - keyword_plan_network = proto.Field( - proto.ENUM, - number=6, - enum=gage_keyword_plan_network.KeywordPlanNetworkEnum.KeywordPlanNetwork, - ) - cpc_bid_micros = proto.Field(proto.INT64, number=13, optional=True) - geo_targets = proto.RepeatedField( - proto.MESSAGE, number=8, message="KeywordPlanGeoTarget", - ) - - -class KeywordPlanGeoTarget(proto.Message): - r"""A geo target. - - Attributes: - geo_target_constant (str): - Required. The resource name of the geo - target. - """ - - geo_target_constant = proto.Field(proto.STRING, number=2, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_plan_campaign_keyword.py b/google/ads/googleads/v6/resources/types/keyword_plan_campaign_keyword.py deleted file mode 100644 index d26a14b5f..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_plan_campaign_keyword.py +++ /dev/null @@ -1,70 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import keyword_match_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordPlanCampaignKeyword",}, -) - - -class KeywordPlanCampaignKeyword(proto.Message): - r"""A Keyword Plan Campaign keyword. - Only negative keywords are supported for Campaign Keyword. - - Attributes: - resource_name (str): - Immutable. The resource name of the Keyword Plan Campaign - keyword. KeywordPlanCampaignKeyword resource names have the - form: - - ``customers/{customer_id}/keywordPlanCampaignKeywords/{kp_campaign_keyword_id}`` - keyword_plan_campaign (str): - The Keyword Plan campaign to which this - negative keyword belongs. - id (int): - Output only. The ID of the Keyword Plan - negative keyword. - text (str): - The keyword text. - match_type (google.ads.googleads.v6.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - The keyword match type. - negative (bool): - Immutable. If true, the keyword is negative. - Must be set to true. Only negative campaign - keywords are supported. - """ - - resource_name = proto.Field(proto.STRING, number=1) - keyword_plan_campaign = proto.Field(proto.STRING, number=8, optional=True) - id = proto.Field(proto.INT64, number=9, optional=True) - text = proto.Field(proto.STRING, number=10, optional=True) - match_type = proto.Field( - proto.ENUM, - number=5, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - negative = proto.Field(proto.BOOL, number=11, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/keyword_view.py b/google/ads/googleads/v6/resources/types/keyword_view.py deleted file mode 100644 index 45c96c9a7..000000000 --- a/google/ads/googleads/v6/resources/types/keyword_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"KeywordView",}, -) - - -class KeywordView(proto.Message): - r"""A keyword view. - - Attributes: - resource_name (str): - Output only. The resource name of the keyword view. Keyword - view resource names have the form: - - ``customers/{customer_id}/keywordViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/label.py b/google/ads/googleads/v6/resources/types/label.py deleted file mode 100644 index 4e9d67a98..000000000 --- a/google/ads/googleads/v6/resources/types/label.py +++ /dev/null @@ -1,65 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import text_label as gagc_text_label -from google.ads.googleads.v6.enums.types import label_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Label",}, -) - - -class Label(proto.Message): - r"""A label. - - Attributes: - resource_name (str): - Immutable. Name of the resource. Label resource names have - the form: ``customers/{customer_id}/labels/{label_id}`` - id (int): - Output only. Id of the label. Read only. - name (str): - The name of the label. - This field is required and should not be empty - when creating a new label. - The length of this string should be between 1 - and 80, inclusive. - status (google.ads.googleads.v6.enums.types.LabelStatusEnum.LabelStatus): - Output only. Status of the label. Read only. - text_label (google.ads.googleads.v6.common.types.TextLabel): - A type of label displaying text on a colored - background. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=6, optional=True) - name = proto.Field(proto.STRING, number=7, optional=True) - status = proto.Field( - proto.ENUM, number=4, enum=label_status.LabelStatusEnum.LabelStatus, - ) - text_label = proto.Field( - proto.MESSAGE, number=5, message=gagc_text_label.TextLabel, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/landing_page_view.py b/google/ads/googleads/v6/resources/types/landing_page_view.py deleted file mode 100644 index fffd49f4f..000000000 --- a/google/ads/googleads/v6/resources/types/landing_page_view.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"LandingPageView",}, -) - - -class LandingPageView(proto.Message): - r"""A landing page view with metrics aggregated at the unexpanded - final URL level. - - Attributes: - resource_name (str): - Output only. The resource name of the landing page view. - Landing page view resource names have the form: - - ``customers/{customer_id}/landingPageViews/{unexpanded_final_url_fingerprint}`` - unexpanded_final_url (str): - Output only. The advertiser-specified final - URL. - """ - - resource_name = proto.Field(proto.STRING, number=1) - unexpanded_final_url = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/language_constant.py b/google/ads/googleads/v6/resources/types/language_constant.py deleted file mode 100644 index 1364c8ec6..000000000 --- a/google/ads/googleads/v6/resources/types/language_constant.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"LanguageConstant",}, -) - - -class LanguageConstant(proto.Message): - r"""A language. - - Attributes: - resource_name (str): - Output only. The resource name of the language constant. - Language constant resource names have the form: - - ``languageConstants/{criterion_id}`` - id (int): - Output only. The ID of the language constant. - code (str): - Output only. The language code, e.g. "en_US", "en_AU", "es", - "fr", etc. - name (str): - Output only. The full name of the language in - English, e.g., "English (US)", "Spanish", etc. - targetable (bool): - Output only. Whether the language is - targetable. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=6, optional=True) - code = proto.Field(proto.STRING, number=7, optional=True) - name = proto.Field(proto.STRING, number=8, optional=True) - targetable = proto.Field(proto.BOOL, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/location_view.py b/google/ads/googleads/v6/resources/types/location_view.py deleted file mode 100644 index c9144f1aa..000000000 --- a/google/ads/googleads/v6/resources/types/location_view.py +++ /dev/null @@ -1,43 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"LocationView",}, -) - - -class LocationView(proto.Message): - r"""A location view summarizes the performance of campaigns by - Location criteria. - - Attributes: - resource_name (str): - Output only. The resource name of the location view. - Location view resource names have the form: - - ``customers/{customer_id}/locationViews/{campaign_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/managed_placement_view.py b/google/ads/googleads/v6/resources/types/managed_placement_view.py deleted file mode 100644 index aac4978f9..000000000 --- a/google/ads/googleads/v6/resources/types/managed_placement_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ManagedPlacementView",}, -) - - -class ManagedPlacementView(proto.Message): - r"""A managed placement view. - - Attributes: - resource_name (str): - Output only. The resource name of the Managed Placement - view. Managed placement view resource names have the form: - - ``customers/{customer_id}/managedPlacementViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/media_file.py b/google/ads/googleads/v6/resources/types/media_file.py deleted file mode 100644 index 72b72c0b2..000000000 --- a/google/ads/googleads/v6/resources/types/media_file.py +++ /dev/null @@ -1,180 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import media_type -from google.ads.googleads.v6.enums.types import mime_type as gage_mime_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={ - "MediaFile", - "MediaImage", - "MediaBundle", - "MediaAudio", - "MediaVideo", - }, -) - - -class MediaFile(proto.Message): - r"""A media file. - - Attributes: - resource_name (str): - Immutable. The resource name of the media file. Media file - resource names have the form: - - ``customers/{customer_id}/mediaFiles/{media_file_id}`` - id (int): - Output only. The ID of the media file. - type_ (google.ads.googleads.v6.enums.types.MediaTypeEnum.MediaType): - Immutable. Type of the media file. - mime_type (google.ads.googleads.v6.enums.types.MimeTypeEnum.MimeType): - Output only. The mime type of the media file. - source_url (str): - Immutable. The URL of where the original - media file was downloaded from (or a file name). - Only used for media of type AUDIO and IMAGE. - name (str): - Immutable. The name of the media file. The - name can be used by clients to help identify - previously uploaded media. - file_size (int): - Output only. The size of the media file in - bytes. - image (google.ads.googleads.v6.resources.types.MediaImage): - Immutable. Encapsulates an Image. - media_bundle (google.ads.googleads.v6.resources.types.MediaBundle): - Immutable. A ZIP archive media the content of - which contains HTML5 assets. - audio (google.ads.googleads.v6.resources.types.MediaAudio): - Output only. Encapsulates an Audio. - video (google.ads.googleads.v6.resources.types.MediaVideo): - Immutable. Encapsulates a Video. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=12, optional=True) - type_ = proto.Field( - proto.ENUM, number=5, enum=media_type.MediaTypeEnum.MediaType, - ) - mime_type = proto.Field( - proto.ENUM, number=6, enum=gage_mime_type.MimeTypeEnum.MimeType, - ) - source_url = proto.Field(proto.STRING, number=13, optional=True) - name = proto.Field(proto.STRING, number=14, optional=True) - file_size = proto.Field(proto.INT64, number=15, optional=True) - image = proto.Field( - proto.MESSAGE, number=3, oneof="mediatype", message="MediaImage", - ) - media_bundle = proto.Field( - proto.MESSAGE, number=4, oneof="mediatype", message="MediaBundle", - ) - audio = proto.Field( - proto.MESSAGE, number=10, oneof="mediatype", message="MediaAudio", - ) - video = proto.Field( - proto.MESSAGE, number=11, oneof="mediatype", message="MediaVideo", - ) - - -class MediaImage(proto.Message): - r"""Encapsulates an Image. - - Attributes: - data (bytes): - Immutable. Raw image data. - full_size_image_url (str): - Output only. The url to the full size version - of the image. - preview_size_image_url (str): - Output only. The url to the preview size - version of the image. - """ - - data = proto.Field(proto.BYTES, number=4, optional=True) - full_size_image_url = proto.Field(proto.STRING, number=2, optional=True) - preview_size_image_url = proto.Field(proto.STRING, number=3, optional=True) - - -class MediaBundle(proto.Message): - r"""Represents a ZIP archive media the content of which contains - HTML5 assets. - - Attributes: - data (bytes): - Immutable. Raw zipped data. - url (str): - Output only. The url to access the uploaded - zipped data. E.g. - https://tpc.googlesyndication.com/simgad/123 - This field is read-only. - """ - - data = proto.Field(proto.BYTES, number=3, optional=True) - url = proto.Field(proto.STRING, number=2, optional=True) - - -class MediaAudio(proto.Message): - r"""Encapsulates an Audio. - - Attributes: - ad_duration_millis (int): - Output only. The duration of the Audio in - milliseconds. - """ - - ad_duration_millis = proto.Field(proto.INT64, number=2, optional=True) - - -class MediaVideo(proto.Message): - r"""Encapsulates a Video. - - Attributes: - ad_duration_millis (int): - Output only. The duration of the Video in - milliseconds. - youtube_video_id (str): - Immutable. The YouTube video ID (as seen in - YouTube URLs). Adding prefix - "https://www.youtube.com/watch?v=" to this ID - will get the YouTube streaming URL for this - video. - advertising_id_code (str): - Output only. The Advertising Digital - Identification code for this video, as defined - by the American Association of Advertising - Agencies, used mainly for television - commercials. - isci_code (str): - Output only. The Industry Standard Commercial - Identifier code for this video, used mainly for - television commercials. - """ - - ad_duration_millis = proto.Field(proto.INT64, number=5, optional=True) - youtube_video_id = proto.Field(proto.STRING, number=6, optional=True) - advertising_id_code = proto.Field(proto.STRING, number=7, optional=True) - isci_code = proto.Field(proto.STRING, number=8, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/merchant_center_link.py b/google/ads/googleads/v6/resources/types/merchant_center_link.py deleted file mode 100644 index d062cf11e..000000000 --- a/google/ads/googleads/v6/resources/types/merchant_center_link.py +++ /dev/null @@ -1,63 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import merchant_center_link_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"MerchantCenterLink",}, -) - - -class MerchantCenterLink(proto.Message): - r"""A data sharing connection, proposed or in use, - between a Google Ads Customer and a Merchant Center account. - - Attributes: - resource_name (str): - Immutable. The resource name of the merchant center link. - Merchant center link resource names have the form: - - ``customers/{customer_id}/merchantCenterLinks/{merchant_center_id}`` - id (int): - Output only. The ID of the Merchant Center - account. This field is readonly. - merchant_center_account_name (str): - Output only. The name of the Merchant Center - account. This field is readonly. - status (google.ads.googleads.v6.enums.types.MerchantCenterLinkStatusEnum.MerchantCenterLinkStatus): - The status of the link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=6, optional=True) - merchant_center_account_name = proto.Field( - proto.STRING, number=7, optional=True - ) - status = proto.Field( - proto.ENUM, - number=5, - enum=merchant_center_link_status.MerchantCenterLinkStatusEnum.MerchantCenterLinkStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/mobile_app_category_constant.py b/google/ads/googleads/v6/resources/types/mobile_app_category_constant.py deleted file mode 100644 index eeda06d34..000000000 --- a/google/ads/googleads/v6/resources/types/mobile_app_category_constant.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"MobileAppCategoryConstant",}, -) - - -class MobileAppCategoryConstant(proto.Message): - r"""A mobile application category constant. - - Attributes: - resource_name (str): - Output only. The resource name of the mobile app category - constant. Mobile app category constant resource names have - the form: - - ``mobileAppCategoryConstants/{mobile_app_category_id}`` - id (int): - Output only. The ID of the mobile app - category constant. - name (str): - Output only. Mobile app category name. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT32, number=4, optional=True) - name = proto.Field(proto.STRING, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/mobile_device_constant.py b/google/ads/googleads/v6/resources/types/mobile_device_constant.py deleted file mode 100644 index a49eaf4d0..000000000 --- a/google/ads/googleads/v6/resources/types/mobile_device_constant.py +++ /dev/null @@ -1,68 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import mobile_device_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"MobileDeviceConstant",}, -) - - -class MobileDeviceConstant(proto.Message): - r"""A mobile device constant. - - Attributes: - resource_name (str): - Output only. The resource name of the mobile device - constant. Mobile device constant resource names have the - form: - - ``mobileDeviceConstants/{criterion_id}`` - id (int): - Output only. The ID of the mobile device - constant. - name (str): - Output only. The name of the mobile device. - manufacturer_name (str): - Output only. The manufacturer of the mobile - device. - operating_system_name (str): - Output only. The operating system of the - mobile device. - type_ (google.ads.googleads.v6.enums.types.MobileDeviceTypeEnum.MobileDeviceType): - Output only. The type of mobile device. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=7, optional=True) - name = proto.Field(proto.STRING, number=8, optional=True) - manufacturer_name = proto.Field(proto.STRING, number=9, optional=True) - operating_system_name = proto.Field(proto.STRING, number=10, optional=True) - type_ = proto.Field( - proto.ENUM, - number=6, - enum=mobile_device_type.MobileDeviceTypeEnum.MobileDeviceType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/offline_user_data_job.py b/google/ads/googleads/v6/resources/types/offline_user_data_job.py deleted file mode 100644 index 470784fb9..000000000 --- a/google/ads/googleads/v6/resources/types/offline_user_data_job.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import offline_user_data -from google.ads.googleads.v6.enums.types import ( - offline_user_data_job_failure_reason, -) -from google.ads.googleads.v6.enums.types import offline_user_data_job_status -from google.ads.googleads.v6.enums.types import offline_user_data_job_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"OfflineUserDataJob",}, -) - - -class OfflineUserDataJob(proto.Message): - r"""A job containing offline user data of store visitors, or user - list members that will be processed asynchronously. The uploaded - data isn't readable and the processing results of the job can - only be read using - OfflineUserDataJobService.GetOfflineUserDataJob. - - Attributes: - resource_name (str): - Immutable. The resource name of the offline user data job. - Offline user data job resource names have the form: - - ``customers/{customer_id}/offlineUserDataJobs/{offline_user_data_job_id}`` - id (int): - Output only. ID of this offline user data - job. - external_id (int): - Immutable. User specified job ID. - type_ (google.ads.googleads.v6.enums.types.OfflineUserDataJobTypeEnum.OfflineUserDataJobType): - Immutable. Type of the job. - status (google.ads.googleads.v6.enums.types.OfflineUserDataJobStatusEnum.OfflineUserDataJobStatus): - Output only. Status of the job. - failure_reason (google.ads.googleads.v6.enums.types.OfflineUserDataJobFailureReasonEnum.OfflineUserDataJobFailureReason): - Output only. Reason for the processing - failure, if status is FAILED. - customer_match_user_list_metadata (google.ads.googleads.v6.common.types.CustomerMatchUserListMetadata): - Immutable. Metadata for data updates to a - CRM-based user list. - store_sales_metadata (google.ads.googleads.v6.common.types.StoreSalesMetadata): - Immutable. Metadata for store sales data - update. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=9, optional=True) - external_id = proto.Field(proto.INT64, number=10, optional=True) - type_ = proto.Field( - proto.ENUM, - number=4, - enum=offline_user_data_job_type.OfflineUserDataJobTypeEnum.OfflineUserDataJobType, - ) - status = proto.Field( - proto.ENUM, - number=5, - enum=offline_user_data_job_status.OfflineUserDataJobStatusEnum.OfflineUserDataJobStatus, - ) - failure_reason = proto.Field( - proto.ENUM, - number=6, - enum=offline_user_data_job_failure_reason.OfflineUserDataJobFailureReasonEnum.OfflineUserDataJobFailureReason, - ) - customer_match_user_list_metadata = proto.Field( - proto.MESSAGE, - number=7, - oneof="metadata", - message=offline_user_data.CustomerMatchUserListMetadata, - ) - store_sales_metadata = proto.Field( - proto.MESSAGE, - number=8, - oneof="metadata", - message=offline_user_data.StoreSalesMetadata, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/operating_system_version_constant.py b/google/ads/googleads/v6/resources/types/operating_system_version_constant.py deleted file mode 100644 index 23b93cb98..000000000 --- a/google/ads/googleads/v6/resources/types/operating_system_version_constant.py +++ /dev/null @@ -1,72 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - operating_system_version_operator_type, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"OperatingSystemVersionConstant",}, -) - - -class OperatingSystemVersionConstant(proto.Message): - r"""A mobile operating system version or a range of versions, depending - on ``operator_type``. List of available mobile platforms at - https://developers.google.com/adwords/api/docs/appendix/codes-formats#mobile-platforms - - Attributes: - resource_name (str): - Output only. The resource name of the operating system - version constant. Operating system version constant resource - names have the form: - - ``operatingSystemVersionConstants/{criterion_id}`` - id (int): - Output only. The ID of the operating system - version. - name (str): - Output only. Name of the operating system. - os_major_version (int): - Output only. The OS Major Version number. - os_minor_version (int): - Output only. The OS Minor Version number. - operator_type (google.ads.googleads.v6.enums.types.OperatingSystemVersionOperatorTypeEnum.OperatingSystemVersionOperatorType): - Output only. Determines whether this constant - represents a single version or a range of - versions. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=7, optional=True) - name = proto.Field(proto.STRING, number=8, optional=True) - os_major_version = proto.Field(proto.INT32, number=9, optional=True) - os_minor_version = proto.Field(proto.INT32, number=10, optional=True) - operator_type = proto.Field( - proto.ENUM, - number=6, - enum=operating_system_version_operator_type.OperatingSystemVersionOperatorTypeEnum.OperatingSystemVersionOperatorType, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/paid_organic_search_term_view.py b/google/ads/googleads/v6/resources/types/paid_organic_search_term_view.py deleted file mode 100644 index a5165eb9b..000000000 --- a/google/ads/googleads/v6/resources/types/paid_organic_search_term_view.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"PaidOrganicSearchTermView",}, -) - - -class PaidOrganicSearchTermView(proto.Message): - r"""A paid organic search term view providing a view of search - stats across ads and organic listings aggregated by search term - at the ad group level. - - Attributes: - resource_name (str): - Output only. The resource name of the search term view. - Search term view resource names have the form: - - ``customers/{customer_id}/paidOrganicSearchTermViews/{campaign_id}~ {ad_group_id}~{URL-base64 search term}`` - search_term (str): - Output only. The search term. - """ - - resource_name = proto.Field(proto.STRING, number=1) - search_term = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/parental_status_view.py b/google/ads/googleads/v6/resources/types/parental_status_view.py deleted file mode 100644 index 914e4fb02..000000000 --- a/google/ads/googleads/v6/resources/types/parental_status_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ParentalStatusView",}, -) - - -class ParentalStatusView(proto.Message): - r"""A parental status view. - - Attributes: - resource_name (str): - Output only. The resource name of the parental status view. - Parental Status view resource names have the form: - - ``customers/{customer_id}/parentalStatusViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/payments_account.py b/google/ads/googleads/v6/resources/types/payments_account.py deleted file mode 100644 index 287d1963b..000000000 --- a/google/ads/googleads/v6/resources/types/payments_account.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"PaymentsAccount",}, -) - - -class PaymentsAccount(proto.Message): - r"""A payments account, which can be used to set up billing for - an Ads customer. - - Attributes: - resource_name (str): - Output only. The resource name of the payments account. - PaymentsAccount resource names have the form: - - ``customers/{customer_id}/paymentsAccounts/{payments_account_id}`` - payments_account_id (str): - Output only. A 16 digit ID used to identify a - payments account. - name (str): - Output only. The name of the payments - account. - currency_code (str): - Output only. The currency code of the - payments account. A subset of the currency codes - derived from the ISO 4217 standard is supported. - payments_profile_id (str): - Output only. A 12 digit ID used to identify - the payments profile associated with the - payments account. - secondary_payments_profile_id (str): - Output only. A secondary payments profile ID - present in uncommon situations, e.g. when a - sequential liability agreement has been - arranged. - paying_manager_customer (str): - Output only. Paying manager of this payment - account. - """ - - resource_name = proto.Field(proto.STRING, number=1) - payments_account_id = proto.Field(proto.STRING, number=8, optional=True) - name = proto.Field(proto.STRING, number=9, optional=True) - currency_code = proto.Field(proto.STRING, number=10, optional=True) - payments_profile_id = proto.Field(proto.STRING, number=11, optional=True) - secondary_payments_profile_id = proto.Field( - proto.STRING, number=12, optional=True - ) - paying_manager_customer = proto.Field( - proto.STRING, number=13, optional=True - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/product_bidding_category_constant.py b/google/ads/googleads/v6/resources/types/product_bidding_category_constant.py deleted file mode 100644 index 3465ddeb7..000000000 --- a/google/ads/googleads/v6/resources/types/product_bidding_category_constant.py +++ /dev/null @@ -1,88 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import product_bidding_category_level -from google.ads.googleads.v6.enums.types import product_bidding_category_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ProductBiddingCategoryConstant",}, -) - - -class ProductBiddingCategoryConstant(proto.Message): - r"""A Product Bidding Category. - - Attributes: - resource_name (str): - Output only. The resource name of the product bidding - category. Product bidding category resource names have the - form: - - ``productBiddingCategoryConstants/{country_code}~{level}~{id}`` - id (int): - Output only. ID of the product bidding category. - - This ID is equivalent to the google_product_category ID as - described in this article: - https://support.google.com/merchants/answer/6324436. - country_code (str): - Output only. Two-letter upper-case country - code of the product bidding category. - product_bidding_category_constant_parent (str): - Output only. Resource name of the parent - product bidding category. - level (google.ads.googleads.v6.enums.types.ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel): - Output only. Level of the product bidding - category. - status (google.ads.googleads.v6.enums.types.ProductBiddingCategoryStatusEnum.ProductBiddingCategoryStatus): - Output only. Status of the product bidding - category. - language_code (str): - Output only. Language code of the product - bidding category. - localized_name (str): - Output only. Display value of the product bidding category - localized according to language_code. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=10, optional=True) - country_code = proto.Field(proto.STRING, number=11, optional=True) - product_bidding_category_constant_parent = proto.Field( - proto.STRING, number=12, optional=True - ) - level = proto.Field( - proto.ENUM, - number=5, - enum=product_bidding_category_level.ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel, - ) - status = proto.Field( - proto.ENUM, - number=6, - enum=product_bidding_category_status.ProductBiddingCategoryStatusEnum.ProductBiddingCategoryStatus, - ) - language_code = proto.Field(proto.STRING, number=13, optional=True) - localized_name = proto.Field(proto.STRING, number=14, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/product_group_view.py b/google/ads/googleads/v6/resources/types/product_group_view.py deleted file mode 100644 index 84a24ccf1..000000000 --- a/google/ads/googleads/v6/resources/types/product_group_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ProductGroupView",}, -) - - -class ProductGroupView(proto.Message): - r"""A product group view. - - Attributes: - resource_name (str): - Output only. The resource name of the product group view. - Product group view resource names have the form: - - ``customers/{customer_id}/productGroupViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/recommendation.py b/google/ads/googleads/v6/resources/types/recommendation.py deleted file mode 100644 index de5e58b96..000000000 --- a/google/ads/googleads/v6/resources/types/recommendation.py +++ /dev/null @@ -1,595 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.common.types import extensions -from google.ads.googleads.v6.enums.types import keyword_match_type -from google.ads.googleads.v6.enums.types import recommendation_type -from google.ads.googleads.v6.enums.types import ( - target_cpa_opt_in_recommendation_goal, -) -from google.ads.googleads.v6.resources.types import ad as gagr_ad - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Recommendation",}, -) - - -class Recommendation(proto.Message): - r"""A recommendation. - - Attributes: - resource_name (str): - Immutable. The resource name of the recommendation. - - ``customers/{customer_id}/recommendations/{recommendation_id}`` - type_ (google.ads.googleads.v6.enums.types.RecommendationTypeEnum.RecommendationType): - Output only. The type of recommendation. - impact (google.ads.googleads.v6.resources.types.Recommendation.RecommendationImpact): - Output only. The impact on account - performance as a result of applying the - recommendation. - campaign_budget (str): - Output only. The budget targeted by this recommendation. - This will be set only when the recommendation affects a - single campaign budget. - - This field will be set for the following recommendation - types: CAMPAIGN_BUDGET, FORECASTING_CAMPAIGN_BUDGET, - MOVE_UNUSED_BUDGET - campaign (str): - Output only. The campaign targeted by this recommendation. - This will be set only when the recommendation affects a - single campaign. - - This field will be set for the following recommendation - types: CALL_EXTENSION, CALLOUT_EXTENSION, - ENHANCED_CPC_OPT_IN, KEYWORD, KEYWORD_MATCH_TYPE, - MAXIMIZE_CLICKS_OPT_IN, MAXIMIZE_CONVERSIONS_OPT_IN, - OPTIMIZE_AD_ROTATION, RESPONSIVE_SEARCH_AD, - SEARCH_PARTNERS_OPT_IN, SITELINK_EXTENSION, - TARGET_CPA_OPT_IN, TARGET_ROAS_OPT_IN, TEXT_AD - ad_group (str): - Output only. The ad group targeted by this recommendation. - This will be set only when the recommendation affects a - single ad group. - - This field will be set for the following recommendation - types: KEYWORD, OPTIMIZE_AD_ROTATION, RESPONSIVE_SEARCH_AD, - TEXT_AD - dismissed (bool): - Output only. Whether the recommendation is - dismissed or not. - campaign_budget_recommendation (google.ads.googleads.v6.resources.types.Recommendation.CampaignBudgetRecommendation): - Output only. The campaign budget - recommendation. - forecasting_campaign_budget_recommendation (google.ads.googleads.v6.resources.types.Recommendation.CampaignBudgetRecommendation): - Output only. The forecasting campaign budget - recommendation. - keyword_recommendation (google.ads.googleads.v6.resources.types.Recommendation.KeywordRecommendation): - Output only. The keyword recommendation. - text_ad_recommendation (google.ads.googleads.v6.resources.types.Recommendation.TextAdRecommendation): - Output only. Add expanded text ad - recommendation. - target_cpa_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.TargetCpaOptInRecommendation): - Output only. The TargetCPA opt-in - recommendation. - maximize_conversions_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.MaximizeConversionsOptInRecommendation): - Output only. The MaximizeConversions Opt-In - recommendation. - enhanced_cpc_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.EnhancedCpcOptInRecommendation): - Output only. The Enhanced Cost-Per-Click Opt- - n recommendation. - search_partners_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.SearchPartnersOptInRecommendation): - Output only. The Search Partners Opt-In - recommendation. - maximize_clicks_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.MaximizeClicksOptInRecommendation): - Output only. The MaximizeClicks Opt-In - recommendation. - optimize_ad_rotation_recommendation (google.ads.googleads.v6.resources.types.Recommendation.OptimizeAdRotationRecommendation): - Output only. The Optimize Ad Rotation - recommendation. - callout_extension_recommendation (google.ads.googleads.v6.resources.types.Recommendation.CalloutExtensionRecommendation): - Output only. The Callout extension - recommendation. - sitelink_extension_recommendation (google.ads.googleads.v6.resources.types.Recommendation.SitelinkExtensionRecommendation): - Output only. The Sitelink extension - recommendation. - call_extension_recommendation (google.ads.googleads.v6.resources.types.Recommendation.CallExtensionRecommendation): - Output only. The Call extension - recommendation. - keyword_match_type_recommendation (google.ads.googleads.v6.resources.types.Recommendation.KeywordMatchTypeRecommendation): - Output only. The keyword match type - recommendation. - move_unused_budget_recommendation (google.ads.googleads.v6.resources.types.Recommendation.MoveUnusedBudgetRecommendation): - Output only. The move unused budget - recommendation. - target_roas_opt_in_recommendation (google.ads.googleads.v6.resources.types.Recommendation.TargetRoasOptInRecommendation): - Output only. The Target ROAS opt-in - recommendation. - responsive_search_ad_recommendation (google.ads.googleads.v6.resources.types.Recommendation.ResponsiveSearchAdRecommendation): - Output only. The add responsive search ad - recommendation. - """ - - class RecommendationImpact(proto.Message): - r"""The impact of making the change as described in the - recommendation. Some types of recommendations may not have - impact information. - - Attributes: - base_metrics (google.ads.googleads.v6.resources.types.Recommendation.RecommendationMetrics): - Output only. Base metrics at the time the - recommendation was generated. - potential_metrics (google.ads.googleads.v6.resources.types.Recommendation.RecommendationMetrics): - Output only. Estimated metrics if the - recommendation is applied. - """ - - base_metrics = proto.Field( - proto.MESSAGE, - number=1, - message="Recommendation.RecommendationMetrics", - ) - potential_metrics = proto.Field( - proto.MESSAGE, - number=2, - message="Recommendation.RecommendationMetrics", - ) - - class RecommendationMetrics(proto.Message): - r"""Weekly account performance metrics. For some recommendation - types, these are averaged over the past 90-day period and hence - can be fractional. - - Attributes: - impressions (float): - Output only. Number of ad impressions. - clicks (float): - Output only. Number of ad clicks. - cost_micros (int): - Output only. Cost (in micros) for - advertising, in the local currency for the - account. - conversions (float): - Output only. Number of conversions. - video_views (float): - Output only. Number of video views for a - video ad campaign. - """ - - impressions = proto.Field(proto.DOUBLE, number=6, optional=True) - clicks = proto.Field(proto.DOUBLE, number=7, optional=True) - cost_micros = proto.Field(proto.INT64, number=8, optional=True) - conversions = proto.Field(proto.DOUBLE, number=9, optional=True) - video_views = proto.Field(proto.DOUBLE, number=10, optional=True) - - class CampaignBudgetRecommendation(proto.Message): - r"""The budget recommendation for budget constrained campaigns. - - Attributes: - current_budget_amount_micros (int): - Output only. The current budget amount in - micros. - recommended_budget_amount_micros (int): - Output only. The recommended budget amount in - micros. - budget_options (Sequence[google.ads.googleads.v6.resources.types.Recommendation.CampaignBudgetRecommendation.CampaignBudgetRecommendationOption]): - Output only. The budget amounts and - associated impact estimates for some values of - possible budget amounts. - """ - - class CampaignBudgetRecommendationOption(proto.Message): - r"""The impact estimates for a given budget amount. - - Attributes: - budget_amount_micros (int): - Output only. The budget amount for this - option. - impact (google.ads.googleads.v6.resources.types.Recommendation.RecommendationImpact): - Output only. The impact estimate if budget is - changed to amount specified in this option. - """ - - budget_amount_micros = proto.Field( - proto.INT64, number=3, optional=True - ) - impact = proto.Field( - proto.MESSAGE, - number=2, - message="Recommendation.RecommendationImpact", - ) - - current_budget_amount_micros = proto.Field( - proto.INT64, number=7, optional=True - ) - recommended_budget_amount_micros = proto.Field( - proto.INT64, number=8, optional=True - ) - budget_options = proto.RepeatedField( - proto.MESSAGE, - number=3, - message="Recommendation.CampaignBudgetRecommendation.CampaignBudgetRecommendationOption", - ) - - class KeywordRecommendation(proto.Message): - r"""The keyword recommendation. - - Attributes: - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Output only. The recommended keyword. - recommended_cpc_bid_micros (int): - Output only. The recommended CPC (cost-per- - lick) bid. - """ - - keyword = proto.Field( - proto.MESSAGE, number=1, message=criteria.KeywordInfo, - ) - recommended_cpc_bid_micros = proto.Field( - proto.INT64, number=3, optional=True - ) - - class TextAdRecommendation(proto.Message): - r"""The text ad recommendation. - - Attributes: - ad (google.ads.googleads.v6.resources.types.Ad): - Output only. Recommended ad. - creation_date (str): - Output only. Creation date of the recommended - ad. YYYY-MM-DD format, e.g., 2018-04-17. - auto_apply_date (str): - Output only. Date, if present, is the - earliest when the recommendation will be auto - applied. YYYY-MM-DD format, e.g., 2018-04-17. - """ - - ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) - creation_date = proto.Field(proto.STRING, number=4, optional=True) - auto_apply_date = proto.Field(proto.STRING, number=5, optional=True) - - class TargetRoasOptInRecommendation(proto.Message): - r"""The Target ROAS opt-in recommendation. - - Attributes: - recommended_target_roas (float): - Output only. The recommended target ROAS - (revenue per unit of spend). The value is - between 0.01 and 1000.0, inclusive. - required_campaign_budget_amount_micros (int): - Output only. The minimum campaign budget, in - local currency for the account, required to - achieve the target ROAS. Amount is specified in - micros, where one million is equivalent to one - currency unit. - """ - - recommended_target_roas = proto.Field( - proto.DOUBLE, number=1, optional=True - ) - required_campaign_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True - ) - - class TargetCpaOptInRecommendation(proto.Message): - r"""The Target CPA opt-in recommendation. - - Attributes: - options (Sequence[google.ads.googleads.v6.resources.types.Recommendation.TargetCpaOptInRecommendation.TargetCpaOptInRecommendationOption]): - Output only. The available goals and - corresponding options for Target CPA strategy. - recommended_target_cpa_micros (int): - Output only. The recommended average CPA - target. See required budget amount and impact of - using this recommendation in options list. - """ - - class TargetCpaOptInRecommendationOption(proto.Message): - r"""The Target CPA opt-in option with impact estimate. - - Attributes: - goal (google.ads.googleads.v6.enums.types.TargetCpaOptInRecommendationGoalEnum.TargetCpaOptInRecommendationGoal): - Output only. The goal achieved by this - option. - target_cpa_micros (int): - Output only. Average CPA target. - required_campaign_budget_amount_micros (int): - Output only. The minimum campaign budget, in - local currency for the account, required to - achieve the target CPA. Amount is specified in - micros, where one million is equivalent to one - currency unit. - impact (google.ads.googleads.v6.resources.types.Recommendation.RecommendationImpact): - Output only. The impact estimate if this - option is selected. - """ - - goal = proto.Field( - proto.ENUM, - number=1, - enum=target_cpa_opt_in_recommendation_goal.TargetCpaOptInRecommendationGoalEnum.TargetCpaOptInRecommendationGoal, - ) - target_cpa_micros = proto.Field( - proto.INT64, number=5, optional=True - ) - required_campaign_budget_amount_micros = proto.Field( - proto.INT64, number=6, optional=True - ) - impact = proto.Field( - proto.MESSAGE, - number=4, - message="Recommendation.RecommendationImpact", - ) - - options = proto.RepeatedField( - proto.MESSAGE, - number=1, - message="Recommendation.TargetCpaOptInRecommendation.TargetCpaOptInRecommendationOption", - ) - recommended_target_cpa_micros = proto.Field( - proto.INT64, number=3, optional=True - ) - - class MaximizeConversionsOptInRecommendation(proto.Message): - r"""The Maximize Conversions Opt-In recommendation. - - Attributes: - recommended_budget_amount_micros (int): - Output only. The recommended new budget - amount. - """ - - recommended_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True - ) - - class SitelinkExtensionRecommendation(proto.Message): - r"""The Sitelink extension recommendation. - - Attributes: - recommended_extensions (Sequence[google.ads.googleads.v6.common.types.SitelinkFeedItem]): - Output only. Sitelink extensions recommended - to be added. - """ - - recommended_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.SitelinkFeedItem, - ) - - class CallExtensionRecommendation(proto.Message): - r"""The Call extension recommendation. - - Attributes: - recommended_extensions (Sequence[google.ads.googleads.v6.common.types.CallFeedItem]): - Output only. Call extensions recommended to - be added. - """ - - recommended_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CallFeedItem, - ) - - class ResponsiveSearchAdRecommendation(proto.Message): - r"""The add responsive search ad recommendation. - - Attributes: - ad (google.ads.googleads.v6.resources.types.Ad): - Output only. Recommended ad. - """ - - ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) - - class EnhancedCpcOptInRecommendation(proto.Message): - r"""The Enhanced Cost-Per-Click Opt-In recommendation.""" - - class SearchPartnersOptInRecommendation(proto.Message): - r"""The Search Partners Opt-In recommendation.""" - - class MaximizeClicksOptInRecommendation(proto.Message): - r"""The Maximize Clicks opt-in recommendation. - - Attributes: - recommended_budget_amount_micros (int): - Output only. The recommended new budget - amount. Only set if the current budget is too - high. - """ - - recommended_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True - ) - - class OptimizeAdRotationRecommendation(proto.Message): - r"""The Optimize Ad Rotation recommendation.""" - - class CalloutExtensionRecommendation(proto.Message): - r"""The Callout extension recommendation. - - Attributes: - recommended_extensions (Sequence[google.ads.googleads.v6.common.types.CalloutFeedItem]): - Output only. Callout extensions recommended - to be added. - """ - - recommended_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CalloutFeedItem, - ) - - class KeywordMatchTypeRecommendation(proto.Message): - r"""The keyword match type recommendation. - - Attributes: - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Output only. The existing keyword where the - match type should be more broad. - recommended_match_type (google.ads.googleads.v6.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - Output only. The recommended new match type. - """ - - keyword = proto.Field( - proto.MESSAGE, number=1, message=criteria.KeywordInfo, - ) - recommended_match_type = proto.Field( - proto.ENUM, - number=2, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - - class MoveUnusedBudgetRecommendation(proto.Message): - r"""The move unused budget recommendation. - - Attributes: - excess_campaign_budget (str): - Output only. The excess budget's resource_name. - budget_recommendation (google.ads.googleads.v6.resources.types.Recommendation.CampaignBudgetRecommendation): - Output only. The recommendation for the - constrained budget to increase. - """ - - excess_campaign_budget = proto.Field( - proto.STRING, number=3, optional=True - ) - budget_recommendation = proto.Field( - proto.MESSAGE, - number=2, - message="Recommendation.CampaignBudgetRecommendation", - ) - - resource_name = proto.Field(proto.STRING, number=1) - type_ = proto.Field( - proto.ENUM, - number=2, - enum=recommendation_type.RecommendationTypeEnum.RecommendationType, - ) - impact = proto.Field(proto.MESSAGE, number=3, message=RecommendationImpact,) - campaign_budget = proto.Field(proto.STRING, number=24, optional=True) - campaign = proto.Field(proto.STRING, number=25, optional=True) - ad_group = proto.Field(proto.STRING, number=26, optional=True) - dismissed = proto.Field(proto.BOOL, number=27, optional=True) - campaign_budget_recommendation = proto.Field( - proto.MESSAGE, - number=4, - oneof="recommendation", - message=CampaignBudgetRecommendation, - ) - forecasting_campaign_budget_recommendation = proto.Field( - proto.MESSAGE, - number=22, - oneof="recommendation", - message=CampaignBudgetRecommendation, - ) - keyword_recommendation = proto.Field( - proto.MESSAGE, - number=8, - oneof="recommendation", - message=KeywordRecommendation, - ) - text_ad_recommendation = proto.Field( - proto.MESSAGE, - number=9, - oneof="recommendation", - message=TextAdRecommendation, - ) - target_cpa_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=10, - oneof="recommendation", - message=TargetCpaOptInRecommendation, - ) - maximize_conversions_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=11, - oneof="recommendation", - message=MaximizeConversionsOptInRecommendation, - ) - enhanced_cpc_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=12, - oneof="recommendation", - message=EnhancedCpcOptInRecommendation, - ) - search_partners_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=14, - oneof="recommendation", - message=SearchPartnersOptInRecommendation, - ) - maximize_clicks_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=15, - oneof="recommendation", - message=MaximizeClicksOptInRecommendation, - ) - optimize_ad_rotation_recommendation = proto.Field( - proto.MESSAGE, - number=16, - oneof="recommendation", - message=OptimizeAdRotationRecommendation, - ) - callout_extension_recommendation = proto.Field( - proto.MESSAGE, - number=17, - oneof="recommendation", - message=CalloutExtensionRecommendation, - ) - sitelink_extension_recommendation = proto.Field( - proto.MESSAGE, - number=18, - oneof="recommendation", - message=SitelinkExtensionRecommendation, - ) - call_extension_recommendation = proto.Field( - proto.MESSAGE, - number=19, - oneof="recommendation", - message=CallExtensionRecommendation, - ) - keyword_match_type_recommendation = proto.Field( - proto.MESSAGE, - number=20, - oneof="recommendation", - message=KeywordMatchTypeRecommendation, - ) - move_unused_budget_recommendation = proto.Field( - proto.MESSAGE, - number=21, - oneof="recommendation", - message=MoveUnusedBudgetRecommendation, - ) - target_roas_opt_in_recommendation = proto.Field( - proto.MESSAGE, - number=23, - oneof="recommendation", - message=TargetRoasOptInRecommendation, - ) - responsive_search_ad_recommendation = proto.Field( - proto.MESSAGE, - number=28, - oneof="recommendation", - message=ResponsiveSearchAdRecommendation, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/remarketing_action.py b/google/ads/googleads/v6/resources/types/remarketing_action.py deleted file mode 100644 index 29382db5f..000000000 --- a/google/ads/googleads/v6/resources/types/remarketing_action.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import tag_snippet - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"RemarketingAction",}, -) - - -class RemarketingAction(proto.Message): - r"""A remarketing action. A snippet of JavaScript code that will - collect the product id and the type of page people visited - (product page, shopping cart page, purchase page, general site - visit) on an advertiser's website. - - Attributes: - resource_name (str): - Immutable. The resource name of the remarketing action. - Remarketing action resource names have the form: - - ``customers/{customer_id}/remarketingActions/{remarketing_action_id}`` - id (int): - Output only. Id of the remarketing action. - name (str): - The name of the remarketing action. - This field is required and should not be empty - when creating new remarketing actions. - tag_snippets (Sequence[google.ads.googleads.v6.common.types.TagSnippet]): - Output only. The snippets used for tracking - remarketing actions. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=5, optional=True) - name = proto.Field(proto.STRING, number=6, optional=True) - tag_snippets = proto.RepeatedField( - proto.MESSAGE, number=4, message=tag_snippet.TagSnippet, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/search_term_view.py b/google/ads/googleads/v6/resources/types/search_term_view.py deleted file mode 100644 index e376b9c5d..000000000 --- a/google/ads/googleads/v6/resources/types/search_term_view.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import search_term_targeting_status - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"SearchTermView",}, -) - - -class SearchTermView(proto.Message): - r"""A search term view with metrics aggregated by search term at - the ad group level. - - Attributes: - resource_name (str): - Output only. The resource name of the search term view. - Search term view resource names have the form: - - ``customers/{customer_id}/searchTermViews/{campaign_id}~{ad_group_id}~{URL-base64_search_term}`` - search_term (str): - Output only. The search term. - ad_group (str): - Output only. The ad group the search term - served in. - status (google.ads.googleads.v6.enums.types.SearchTermTargetingStatusEnum.SearchTermTargetingStatus): - Output only. Indicates whether the search - term is currently one of your targeted or - excluded keywords. - """ - - resource_name = proto.Field(proto.STRING, number=1) - search_term = proto.Field(proto.STRING, number=5, optional=True) - ad_group = proto.Field(proto.STRING, number=6, optional=True) - status = proto.Field( - proto.ENUM, - number=4, - enum=search_term_targeting_status.SearchTermTargetingStatusEnum.SearchTermTargetingStatus, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/shared_criterion.py b/google/ads/googleads/v6/resources/types/shared_criterion.py deleted file mode 100644 index d5c99ee8b..000000000 --- a/google/ads/googleads/v6/resources/types/shared_criterion.py +++ /dev/null @@ -1,109 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import criterion_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"SharedCriterion",}, -) - - -class SharedCriterion(proto.Message): - r"""A criterion belonging to a shared set. - - Attributes: - resource_name (str): - Immutable. The resource name of the shared criterion. Shared - set resource names have the form: - - ``customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}`` - shared_set (str): - Immutable. The shared set to which the shared - criterion belongs. - criterion_id (int): - Output only. The ID of the criterion. - This field is ignored for mutates. - type_ (google.ads.googleads.v6.enums.types.CriterionTypeEnum.CriterionType): - Output only. The type of the criterion. - keyword (google.ads.googleads.v6.common.types.KeywordInfo): - Immutable. Keyword. - youtube_video (google.ads.googleads.v6.common.types.YouTubeVideoInfo): - Immutable. YouTube Video. - youtube_channel (google.ads.googleads.v6.common.types.YouTubeChannelInfo): - Immutable. YouTube Channel. - placement (google.ads.googleads.v6.common.types.PlacementInfo): - Immutable. Placement. - mobile_app_category (google.ads.googleads.v6.common.types.MobileAppCategoryInfo): - Immutable. Mobile App Category. - mobile_application (google.ads.googleads.v6.common.types.MobileApplicationInfo): - Immutable. Mobile application. - """ - - resource_name = proto.Field(proto.STRING, number=1) - shared_set = proto.Field(proto.STRING, number=10, optional=True) - criterion_id = proto.Field(proto.INT64, number=11, optional=True) - type_ = proto.Field( - proto.ENUM, - number=4, - enum=criterion_type.CriterionTypeEnum.CriterionType, - ) - keyword = proto.Field( - proto.MESSAGE, - number=3, - oneof="criterion", - message=criteria.KeywordInfo, - ) - youtube_video = proto.Field( - proto.MESSAGE, - number=5, - oneof="criterion", - message=criteria.YouTubeVideoInfo, - ) - youtube_channel = proto.Field( - proto.MESSAGE, - number=6, - oneof="criterion", - message=criteria.YouTubeChannelInfo, - ) - placement = proto.Field( - proto.MESSAGE, - number=7, - oneof="criterion", - message=criteria.PlacementInfo, - ) - mobile_app_category = proto.Field( - proto.MESSAGE, - number=8, - oneof="criterion", - message=criteria.MobileAppCategoryInfo, - ) - mobile_application = proto.Field( - proto.MESSAGE, - number=9, - oneof="criterion", - message=criteria.MobileApplicationInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/shared_set.py b/google/ads/googleads/v6/resources/types/shared_set.py deleted file mode 100644 index 82fb0f3bf..000000000 --- a/google/ads/googleads/v6/resources/types/shared_set.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import shared_set_status -from google.ads.googleads.v6.enums.types import shared_set_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"SharedSet",}, -) - - -class SharedSet(proto.Message): - r"""SharedSets are used for sharing criterion exclusions across - multiple campaigns. - - Attributes: - resource_name (str): - Immutable. The resource name of the shared set. Shared set - resource names have the form: - - ``customers/{customer_id}/sharedSets/{shared_set_id}`` - id (int): - Output only. The ID of this shared set. Read - only. - type_ (google.ads.googleads.v6.enums.types.SharedSetTypeEnum.SharedSetType): - Immutable. The type of this shared set: each - shared set holds only a single kind of resource. - Required. Immutable. - name (str): - The name of this shared set. Required. - Shared Sets must have names that are unique - among active shared sets of the same type. - The length of this string should be between 1 - and 255 UTF-8 bytes, inclusive. - status (google.ads.googleads.v6.enums.types.SharedSetStatusEnum.SharedSetStatus): - Output only. The status of this shared set. - Read only. - member_count (int): - Output only. The number of shared criteria - within this shared set. Read only. - reference_count (int): - Output only. The number of campaigns - associated with this shared set. Read only. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=8, optional=True) - type_ = proto.Field( - proto.ENUM, - number=3, - enum=shared_set_type.SharedSetTypeEnum.SharedSetType, - ) - name = proto.Field(proto.STRING, number=9, optional=True) - status = proto.Field( - proto.ENUM, - number=5, - enum=shared_set_status.SharedSetStatusEnum.SharedSetStatus, - ) - member_count = proto.Field(proto.INT64, number=10, optional=True) - reference_count = proto.Field(proto.INT64, number=11, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/shopping_performance_view.py b/google/ads/googleads/v6/resources/types/shopping_performance_view.py deleted file mode 100644 index cf08d0fb2..000000000 --- a/google/ads/googleads/v6/resources/types/shopping_performance_view.py +++ /dev/null @@ -1,47 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ShoppingPerformanceView",}, -) - - -class ShoppingPerformanceView(proto.Message): - r"""Shopping performance view. - Provides Shopping campaign statistics aggregated at several - product dimension levels. Product dimension values from Merchant - Center such as brand, category, custom attributes, product - condition and product type will reflect the state of each - dimension as of the date and time when the corresponding event - was recorded. - - Attributes: - resource_name (str): - Output only. The resource name of the Shopping performance - view. Shopping performance view resource names have the - form: ``customers/{customer_id}/shoppingPerformanceView`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/third_party_app_analytics_link.py b/google/ads/googleads/v6/resources/types/third_party_app_analytics_link.py deleted file mode 100644 index 23498b2da..000000000 --- a/google/ads/googleads/v6/resources/types/third_party_app_analytics_link.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"ThirdPartyAppAnalyticsLink",}, -) - - -class ThirdPartyAppAnalyticsLink(proto.Message): - r"""A data sharing connection, allowing the import of third party - app analytics into a Google Ads Customer. - - Attributes: - resource_name (str): - Immutable. The resource name of the third party app - analytics link. Third party app analytics link resource - names have the form: - - ``customers/{customer_id}/thirdPartyAppAnalyticsLinks/{account_link_id}`` - shareable_link_id (str): - Output only. The shareable link ID that - should be provided to the third party when - setting up app analytics. This is able to be - regenerated using regenerate method in the - ThirdPartyAppAnalyticsLinkService. - """ - - resource_name = proto.Field(proto.STRING, number=1) - shareable_link_id = proto.Field(proto.STRING, number=3, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/topic_constant.py b/google/ads/googleads/v6/resources/types/topic_constant.py deleted file mode 100644 index 6021adf65..000000000 --- a/google/ads/googleads/v6/resources/types/topic_constant.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"TopicConstant",}, -) - - -class TopicConstant(proto.Message): - r"""Use topics to target or exclude placements in the Google - Display Network based on the category into which the placement - falls (for example, "Pets & Animals/Pets/Dogs"). - - Attributes: - resource_name (str): - Output only. The resource name of the topic constant. topic - constant resource names have the form: - - ``topicConstants/{topic_id}`` - id (int): - Output only. The ID of the topic. - topic_constant_parent (str): - Output only. Resource name of parent of the - topic constant. - path (Sequence[str]): - Output only. The category to target or - exclude. Each subsequent element in the array - describes a more specific sub-category. For - example, {"Pets & Animals", "Pets", "Dogs"} - represents the "Pets & Animals/Pets/Dogs" - category. List of available topic categories at - https://developers.google.com/adwords/api/docs/appendix/verticals - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=5, optional=True) - topic_constant_parent = proto.Field(proto.STRING, number=6, optional=True) - path = proto.RepeatedField(proto.STRING, number=7) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/topic_view.py b/google/ads/googleads/v6/resources/types/topic_view.py deleted file mode 100644 index ea7dd446a..000000000 --- a/google/ads/googleads/v6/resources/types/topic_view.py +++ /dev/null @@ -1,42 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"TopicView",}, -) - - -class TopicView(proto.Message): - r"""A topic view. - - Attributes: - resource_name (str): - Output only. The resource name of the topic view. Topic view - resource names have the form: - - ``customers/{customer_id}/topicViews/{ad_group_id}~{criterion_id}`` - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/user_interest.py b/google/ads/googleads/v6/resources/types/user_interest.py deleted file mode 100644 index a581b348d..000000000 --- a/google/ads/googleads/v6/resources/types/user_interest.py +++ /dev/null @@ -1,76 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criterion_category_availability -from google.ads.googleads.v6.enums.types import user_interest_taxonomy_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"UserInterest",}, -) - - -class UserInterest(proto.Message): - r"""A user interest: a particular interest-based vertical to be - targeted. - - Attributes: - resource_name (str): - Output only. The resource name of the user interest. User - interest resource names have the form: - - ``customers/{customer_id}/userInterests/{user_interest_id}`` - taxonomy_type (google.ads.googleads.v6.enums.types.UserInterestTaxonomyTypeEnum.UserInterestTaxonomyType): - Output only. Taxonomy type of the user - interest. - user_interest_id (int): - Output only. The ID of the user interest. - name (str): - Output only. The name of the user interest. - user_interest_parent (str): - Output only. The parent of the user interest. - launched_to_all (bool): - Output only. True if the user interest is - launched to all channels and locales. - availabilities (Sequence[google.ads.googleads.v6.common.types.CriterionCategoryAvailability]): - Output only. Availability information of the - user interest. - """ - - resource_name = proto.Field(proto.STRING, number=1) - taxonomy_type = proto.Field( - proto.ENUM, - number=2, - enum=user_interest_taxonomy_type.UserInterestTaxonomyTypeEnum.UserInterestTaxonomyType, - ) - user_interest_id = proto.Field(proto.INT64, number=8, optional=True) - name = proto.Field(proto.STRING, number=9, optional=True) - user_interest_parent = proto.Field(proto.STRING, number=10, optional=True) - launched_to_all = proto.Field(proto.BOOL, number=11, optional=True) - availabilities = proto.RepeatedField( - proto.MESSAGE, - number=7, - message=criterion_category_availability.CriterionCategoryAvailability, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/user_list.py b/google/ads/googleads/v6/resources/types/user_list.py deleted file mode 100644 index f00eeb38d..000000000 --- a/google/ads/googleads/v6/resources/types/user_list.py +++ /dev/null @@ -1,234 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import user_lists -from google.ads.googleads.v6.enums.types import ( - access_reason as gage_access_reason, -) -from google.ads.googleads.v6.enums.types import user_list_access_status -from google.ads.googleads.v6.enums.types import user_list_closing_reason -from google.ads.googleads.v6.enums.types import user_list_membership_status -from google.ads.googleads.v6.enums.types import user_list_size_range -from google.ads.googleads.v6.enums.types import user_list_type - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"UserList",}, -) - - -class UserList(proto.Message): - r"""A user list. This is a list of users a customer may target. - - Attributes: - resource_name (str): - Immutable. The resource name of the user list. User list - resource names have the form: - - ``customers/{customer_id}/userLists/{user_list_id}`` - id (int): - Output only. Id of the user list. - read_only (bool): - Output only. A flag that indicates if a user - may edit a list. Depends on the list ownership - and list type. For example, external remarketing - user lists are not editable. - - This field is read-only. - name (str): - Name of this user list. Depending on its access_reason, the - user list name may not be unique (e.g. if - access_reason=SHARED) - description (str): - Description of this user list. - membership_status (google.ads.googleads.v6.enums.types.UserListMembershipStatusEnum.UserListMembershipStatus): - Membership status of this user list. - Indicates whether a user list is open or active. - Only open user lists can accumulate more users - and can be targeted to. - integration_code (str): - An ID from external system. It is used by - user list sellers to correlate IDs on their - systems. - membership_life_span (int): - Number of days a user's cookie stays on your list since its - most recent addition to the list. This field must be between - 0 and 540 inclusive. However, for CRM based userlists, this - field can be set to 10000 which means no expiration. - - It'll be ignored for logical_user_list. - size_for_display (int): - Output only. Estimated number of users in - this user list, on the Google Display Network. - This value is null if the number of users has - not yet been determined. - This field is read-only. - size_range_for_display (google.ads.googleads.v6.enums.types.UserListSizeRangeEnum.UserListSizeRange): - Output only. Size range in terms of number of - users of the UserList, on the Google Display - Network. - This field is read-only. - size_for_search (int): - Output only. Estimated number of users in - this user list in the google.com domain. These - are the users available for targeting in Search - campaigns. This value is null if the number of - users has not yet been determined. - This field is read-only. - size_range_for_search (google.ads.googleads.v6.enums.types.UserListSizeRangeEnum.UserListSizeRange): - Output only. Size range in terms of number of - users of the UserList, for Search ads. - This field is read-only. - type_ (google.ads.googleads.v6.enums.types.UserListTypeEnum.UserListType): - Output only. Type of this list. - This field is read-only. - closing_reason (google.ads.googleads.v6.enums.types.UserListClosingReasonEnum.UserListClosingReason): - Indicating the reason why this user list - membership status is closed. It is only - populated on lists that were automatically - closed due to inactivity, and will be cleared - once the list membership status becomes open. - access_reason (google.ads.googleads.v6.enums.types.AccessReasonEnum.AccessReason): - Output only. Indicates the reason this - account has been granted access to the list. The - reason can be SHARED, OWNED, LICENSED or - SUBSCRIBED. - This field is read-only. - account_user_list_status (google.ads.googleads.v6.enums.types.UserListAccessStatusEnum.UserListAccessStatus): - Indicates if this share is still enabled. - When a UserList is shared with the user this - field is set to ENABLED. Later the userList - owner can decide to revoke the share and make it - DISABLED. - The default value of this field is set to - ENABLED. - eligible_for_search (bool): - Indicates if this user list is eligible for - Google Search Network. - eligible_for_display (bool): - Output only. Indicates this user list is - eligible for Google Display Network. - This field is read-only. - match_rate_percentage (int): - Output only. Indicates match rate for Customer Match lists. - The range of this field is [0-100]. This will be null for - other list types or when it's not possible to calculate the - match rate. - - This field is read-only. - crm_based_user_list (google.ads.googleads.v6.common.types.CrmBasedUserListInfo): - User list of CRM users provided by the - advertiser. - similar_user_list (google.ads.googleads.v6.common.types.SimilarUserListInfo): - Output only. User list which are similar to - users from another UserList. These lists are - readonly and automatically created by google. - rule_based_user_list (google.ads.googleads.v6.common.types.RuleBasedUserListInfo): - User list generated by a rule. - logical_user_list (google.ads.googleads.v6.common.types.LogicalUserListInfo): - User list that is a custom combination of - user lists and user interests. - basic_user_list (google.ads.googleads.v6.common.types.BasicUserListInfo): - User list targeting as a collection of - conversion or remarketing actions. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.INT64, number=25, optional=True) - read_only = proto.Field(proto.BOOL, number=26, optional=True) - name = proto.Field(proto.STRING, number=27, optional=True) - description = proto.Field(proto.STRING, number=28, optional=True) - membership_status = proto.Field( - proto.ENUM, - number=6, - enum=user_list_membership_status.UserListMembershipStatusEnum.UserListMembershipStatus, - ) - integration_code = proto.Field(proto.STRING, number=29, optional=True) - membership_life_span = proto.Field(proto.INT64, number=30, optional=True) - size_for_display = proto.Field(proto.INT64, number=31, optional=True) - size_range_for_display = proto.Field( - proto.ENUM, - number=10, - enum=user_list_size_range.UserListSizeRangeEnum.UserListSizeRange, - ) - size_for_search = proto.Field(proto.INT64, number=32, optional=True) - size_range_for_search = proto.Field( - proto.ENUM, - number=12, - enum=user_list_size_range.UserListSizeRangeEnum.UserListSizeRange, - ) - type_ = proto.Field( - proto.ENUM, - number=13, - enum=user_list_type.UserListTypeEnum.UserListType, - ) - closing_reason = proto.Field( - proto.ENUM, - number=14, - enum=user_list_closing_reason.UserListClosingReasonEnum.UserListClosingReason, - ) - access_reason = proto.Field( - proto.ENUM, - number=15, - enum=gage_access_reason.AccessReasonEnum.AccessReason, - ) - account_user_list_status = proto.Field( - proto.ENUM, - number=16, - enum=user_list_access_status.UserListAccessStatusEnum.UserListAccessStatus, - ) - eligible_for_search = proto.Field(proto.BOOL, number=33, optional=True) - eligible_for_display = proto.Field(proto.BOOL, number=34, optional=True) - match_rate_percentage = proto.Field(proto.INT32, number=24, optional=True) - crm_based_user_list = proto.Field( - proto.MESSAGE, - number=19, - oneof="user_list", - message=user_lists.CrmBasedUserListInfo, - ) - similar_user_list = proto.Field( - proto.MESSAGE, - number=20, - oneof="user_list", - message=user_lists.SimilarUserListInfo, - ) - rule_based_user_list = proto.Field( - proto.MESSAGE, - number=21, - oneof="user_list", - message=user_lists.RuleBasedUserListInfo, - ) - logical_user_list = proto.Field( - proto.MESSAGE, - number=22, - oneof="user_list", - message=user_lists.LogicalUserListInfo, - ) - basic_user_list = proto.Field( - proto.MESSAGE, - number=23, - oneof="user_list", - message=user_lists.BasicUserListInfo, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/user_location_view.py b/google/ads/googleads/v6/resources/types/user_location_view.py deleted file mode 100644 index 852a1ca40..000000000 --- a/google/ads/googleads/v6/resources/types/user_location_view.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"UserLocationView",}, -) - - -class UserLocationView(proto.Message): - r"""A user location view. - User Location View includes all metrics aggregated at the - country level, one row per country. It reports metrics at the - actual physical location of the user by targeted or not targeted - location. If other segment fields are used, you may get more - than one row per country. - - Attributes: - resource_name (str): - Output only. The resource name of the user location view. - UserLocation view resource names have the form: - - ``customers/{customer_id}/userLocationViews/{country_criterion_id}~{targeting_location}`` - country_criterion_id (int): - Output only. Criterion Id for the country. - targeting_location (bool): - Output only. Indicates whether location was - targeted or not. - """ - - resource_name = proto.Field(proto.STRING, number=1) - country_criterion_id = proto.Field(proto.INT64, number=4, optional=True) - targeting_location = proto.Field(proto.BOOL, number=5, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/resources/types/video.py b/google/ads/googleads/v6/resources/types/video.py deleted file mode 100644 index a00a7f65b..000000000 --- a/google/ads/googleads/v6/resources/types/video.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.resources", - marshal="google.ads.googleads.v6", - manifest={"Video",}, -) - - -class Video(proto.Message): - r"""A video. - - Attributes: - resource_name (str): - Output only. The resource name of the video. Video resource - names have the form: - - ``customers/{customer_id}/videos/{video_id}`` - id (str): - Output only. The ID of the video. - channel_id (str): - Output only. The owner channel id of the - video. - duration_millis (int): - Output only. The duration of the video in - milliseconds. - title (str): - Output only. The title of the video. - """ - - resource_name = proto.Field(proto.STRING, number=1) - id = proto.Field(proto.STRING, number=6, optional=True) - channel_id = proto.Field(proto.STRING, number=7, optional=True) - duration_millis = proto.Field(proto.INT64, number=8, optional=True) - title = proto.Field(proto.STRING, number=9, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/__init__.py b/google/ads/googleads/v6/services/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/services/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/services/services/__init__.py b/google/ads/googleads/v6/services/services/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/services/services/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/services/services/account_budget_proposal_service/client.py b/google/ads/googleads/v6/services/services/account_budget_proposal_service/client.py deleted file mode 100644 index 9114aa7dc..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_proposal_service/client.py +++ /dev/null @@ -1,601 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import account_budget_proposal -from google.ads.googleads.v6.services.types import ( - account_budget_proposal_service, -) - -from .transports.base import ( - AccountBudgetProposalServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AccountBudgetProposalServiceGrpcTransport - - -class AccountBudgetProposalServiceClientMeta(type): - """Metaclass for the AccountBudgetProposalService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AccountBudgetProposalServiceTransport]] - _transport_registry["grpc"] = AccountBudgetProposalServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AccountBudgetProposalServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AccountBudgetProposalServiceClient( - metaclass=AccountBudgetProposalServiceClientMeta -): - """A service for managing account-level budgets via proposals. - A proposal is a request to create a new budget or make changes - to an existing one. - - Reads for account-level budgets managed by these proposals will - be supported in a future version. Until then, please use the - BudgetOrderService from the AdWords API. Learn more at - https://developers.google.com/adwords/api/docs/guides/budget- - order - Mutates: - The CREATE operation creates a new proposal. - UPDATE operations aren't supported. - The REMOVE operation cancels a pending proposal. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountBudgetProposalServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountBudgetProposalServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AccountBudgetProposalServiceTransport: - """Return the transport used by the client instance. - - Returns: - AccountBudgetProposalServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def account_budget_path(customer_id: str, account_budget_id: str,) -> str: - """Return a fully-qualified account_budget string.""" - return "customers/{customer_id}/accountBudgets/{account_budget_id}".format( - customer_id=customer_id, account_budget_id=account_budget_id, - ) - - @staticmethod - def parse_account_budget_path(path: str) -> Dict[str, str]: - """Parse a account_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def account_budget_proposal_path( - customer_id: str, account_budget_proposal_id: str, - ) -> str: - """Return a fully-qualified account_budget_proposal string.""" - return "customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}".format( - customer_id=customer_id, - account_budget_proposal_id=account_budget_proposal_id, - ) - - @staticmethod - def parse_account_budget_proposal_path(path: str) -> Dict[str, str]: - """Parse a account_budget_proposal path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgetProposals/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def billing_setup_path(customer_id: str, billing_setup_id: str,) -> str: - """Return a fully-qualified billing_setup string.""" - return "customers/{customer_id}/billingSetups/{billing_setup_id}".format( - customer_id=customer_id, billing_setup_id=billing_setup_id, - ) - - @staticmethod - def parse_billing_setup_path(path: str) -> Dict[str, str]: - """Parse a billing_setup path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/billingSetups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, AccountBudgetProposalServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the account budget proposal service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AccountBudgetProposalServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AccountBudgetProposalServiceTransport): - # transport is a AccountBudgetProposalServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AccountBudgetProposalServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_account_budget_proposal( - self, - request: account_budget_proposal_service.GetAccountBudgetProposalRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_budget_proposal.AccountBudgetProposal: - r"""Returns an account-level budget proposal in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAccountBudgetProposalRequest`): - The request object. Request message for - [AccountBudgetProposalService.GetAccountBudgetProposal][google.ads.googleads.v6.services.AccountBudgetProposalService.GetAccountBudgetProposal]. - resource_name (:class:`str`): - Required. The resource name of the - account-level budget proposal to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AccountBudgetProposal: - An account-level budget proposal. - - All fields prefixed with 'proposed' may not - necessarily be applied directly. For example, - proposed spending limits may be adjusted before their - application. This is true if the 'proposed' field has - an 'approved' counterpart, e.g. spending limits. - - Please note that the proposal type (proposal_type) - changes which fields are required and which must - remain empty. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_budget_proposal_service.GetAccountBudgetProposalRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - account_budget_proposal_service.GetAccountBudgetProposalRequest, - ): - request = account_budget_proposal_service.GetAccountBudgetProposalRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_account_budget_proposal - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_account_budget_proposal( - self, - request: account_budget_proposal_service.MutateAccountBudgetProposalRequest = None, - *, - customer_id: str = None, - operation: account_budget_proposal_service.AccountBudgetProposalOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_budget_proposal_service.MutateAccountBudgetProposalResponse: - r"""Creates, updates, or removes account budget - proposals. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAccountBudgetProposalRequest`): - The request object. Request message for - [AccountBudgetProposalService.MutateAccountBudgetProposal][google.ads.googleads.v6.services.AccountBudgetProposalService.MutateAccountBudgetProposal]. - customer_id (:class:`str`): - Required. The ID of the customer. - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.AccountBudgetProposalOperation`): - Required. The operation to perform on - an individual account-level budget - proposal. - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAccountBudgetProposalResponse: - Response message for account-level - budget mutate operations. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_budget_proposal_service.MutateAccountBudgetProposalRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - account_budget_proposal_service.MutateAccountBudgetProposalRequest, - ): - request = account_budget_proposal_service.MutateAccountBudgetProposalRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_account_budget_proposal - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AccountBudgetProposalServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/grpc.py b/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/grpc.py deleted file mode 100644 index 2905ac062..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/grpc.py +++ /dev/null @@ -1,295 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import account_budget_proposal -from google.ads.googleads.v6.services.types import ( - account_budget_proposal_service, -) - -from .base import AccountBudgetProposalServiceTransport, DEFAULT_CLIENT_INFO - - -class AccountBudgetProposalServiceGrpcTransport( - AccountBudgetProposalServiceTransport -): - """gRPC backend transport for AccountBudgetProposalService. - - A service for managing account-level budgets via proposals. - A proposal is a request to create a new budget or make changes - to an existing one. - - Reads for account-level budgets managed by these proposals will - be supported in a future version. Until then, please use the - BudgetOrderService from the AdWords API. Learn more at - https://developers.google.com/adwords/api/docs/guides/budget- - order - Mutates: - The CREATE operation creates a new proposal. - UPDATE operations aren't supported. - The REMOVE operation cancels a pending proposal. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_account_budget_proposal( - self, - ) -> Callable[ - [account_budget_proposal_service.GetAccountBudgetProposalRequest], - account_budget_proposal.AccountBudgetProposal, - ]: - r"""Return a callable for the get account budget proposal method over gRPC. - - Returns an account-level budget proposal in full - detail. - - Returns: - Callable[[~.GetAccountBudgetProposalRequest], - ~.AccountBudgetProposal]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_account_budget_proposal" not in self._stubs: - self._stubs[ - "get_account_budget_proposal" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountBudgetProposalService/GetAccountBudgetProposal", - request_serializer=account_budget_proposal_service.GetAccountBudgetProposalRequest.serialize, - response_deserializer=account_budget_proposal.AccountBudgetProposal.deserialize, - ) - return self._stubs["get_account_budget_proposal"] - - @property - def mutate_account_budget_proposal( - self, - ) -> Callable[ - [account_budget_proposal_service.MutateAccountBudgetProposalRequest], - account_budget_proposal_service.MutateAccountBudgetProposalResponse, - ]: - r"""Return a callable for the mutate account budget proposal method over gRPC. - - Creates, updates, or removes account budget - proposals. Operation statuses are returned. - - Returns: - Callable[[~.MutateAccountBudgetProposalRequest], - ~.MutateAccountBudgetProposalResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_account_budget_proposal" not in self._stubs: - self._stubs[ - "mutate_account_budget_proposal" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountBudgetProposalService/MutateAccountBudgetProposal", - request_serializer=account_budget_proposal_service.MutateAccountBudgetProposalRequest.serialize, - response_deserializer=account_budget_proposal_service.MutateAccountBudgetProposalResponse.deserialize, - ) - return self._stubs["mutate_account_budget_proposal"] - - -__all__ = ("AccountBudgetProposalServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/account_budget_service/__init__.py b/google/ads/googleads/v6/services/services/account_budget_service/__init__.py deleted file mode 100644 index 592bf4585..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AccountBudgetServiceClient - -__all__ = ("AccountBudgetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_budget_service/client.py b/google/ads/googleads/v6/services/services/account_budget_service/client.py deleted file mode 100644 index e98afc02b..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_service/client.py +++ /dev/null @@ -1,497 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import account_budget -from google.ads.googleads.v6.services.types import account_budget_service - -from .transports.base import AccountBudgetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AccountBudgetServiceGrpcTransport - - -class AccountBudgetServiceClientMeta(type): - """Metaclass for the AccountBudgetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AccountBudgetServiceTransport]] - _transport_registry["grpc"] = AccountBudgetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AccountBudgetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AccountBudgetServiceClient(metaclass=AccountBudgetServiceClientMeta): - """A service for fetching an account-level budget. - Account-level budgets are mutated by creating proposal - resources. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountBudgetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountBudgetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AccountBudgetServiceTransport: - """Return the transport used by the client instance. - - Returns: - AccountBudgetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def account_budget_path(customer_id: str, account_budget_id: str,) -> str: - """Return a fully-qualified account_budget string.""" - return "customers/{customer_id}/accountBudgets/{account_budget_id}".format( - customer_id=customer_id, account_budget_id=account_budget_id, - ) - - @staticmethod - def parse_account_budget_path(path: str) -> Dict[str, str]: - """Parse a account_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def account_budget_proposal_path( - customer_id: str, account_budget_proposal_id: str, - ) -> str: - """Return a fully-qualified account_budget_proposal string.""" - return "customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}".format( - customer_id=customer_id, - account_budget_proposal_id=account_budget_proposal_id, - ) - - @staticmethod - def parse_account_budget_proposal_path(path: str) -> Dict[str, str]: - """Parse a account_budget_proposal path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgetProposals/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def billing_setup_path(customer_id: str, billing_setup_id: str,) -> str: - """Return a fully-qualified billing_setup string.""" - return "customers/{customer_id}/billingSetups/{billing_setup_id}".format( - customer_id=customer_id, billing_setup_id=billing_setup_id, - ) - - @staticmethod - def parse_billing_setup_path(path: str) -> Dict[str, str]: - """Parse a billing_setup path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/billingSetups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AccountBudgetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the account budget service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AccountBudgetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AccountBudgetServiceTransport): - # transport is a AccountBudgetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AccountBudgetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_account_budget( - self, - request: account_budget_service.GetAccountBudgetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_budget.AccountBudget: - r"""Returns an account-level budget in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAccountBudgetRequest`): - The request object. Request message for - [AccountBudgetService.GetAccountBudget][google.ads.googleads.v6.services.AccountBudgetService.GetAccountBudget]. - resource_name (:class:`str`): - Required. The resource name of the - account-level budget to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AccountBudget: - An account-level budget. It contains information about the budget itself, - as well as the most recently approved changes to the - budget and proposed changes that are pending - approval. The proposed changes that are pending - approval, if any, are found in 'pending_proposal'. - Effective details about the budget are found in - fields prefixed '`approved <>`__', '`adjusted <>`__' - and those without a prefix. Since some effective - details may differ from what the user had originally - requested (e.g. spending limit), these differences - are juxtaposed via '`proposed <>`__', - '`approved <>`__', and possibly '`adjusted <>`__' - fields. - - This resource is mutated using AccountBudgetProposal - and cannot be mutated directly. A budget may have at - most one pending proposal at any given time. It is - read through pending_proposal. - - Once approved, a budget may be subject to - adjustments, such as credit adjustments. Adjustments - create differences between the 'approved' and - 'adjusted' fields, which would otherwise be - identical. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_budget_service.GetAccountBudgetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, account_budget_service.GetAccountBudgetRequest - ): - request = account_budget_service.GetAccountBudgetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_account_budget - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AccountBudgetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_budget_service/transports/__init__.py b/google/ads/googleads/v6/services/services/account_budget_service/transports/__init__.py deleted file mode 100644 index 9b708eda1..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AccountBudgetServiceTransport -from .grpc import AccountBudgetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AccountBudgetServiceTransport]] -_transport_registry["grpc"] = AccountBudgetServiceGrpcTransport - - -__all__ = ( - "AccountBudgetServiceTransport", - "AccountBudgetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/account_budget_service/transports/base.py b/google/ads/googleads/v6/services/services/account_budget_service/transports/base.py deleted file mode 100644 index 9d6346477..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import account_budget -from google.ads.googleads.v6.services.types import account_budget_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AccountBudgetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AccountBudgetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_account_budget: gapic_v1.method.wrap_method( - self.get_account_budget, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_account_budget( - self, - ) -> typing.Callable[ - [account_budget_service.GetAccountBudgetRequest], - account_budget.AccountBudget, - ]: - raise NotImplementedError - - -__all__ = ("AccountBudgetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/account_budget_service/transports/grpc.py b/google/ads/googleads/v6/services/services/account_budget_service/transports/grpc.py deleted file mode 100644 index 2ae2a754a..000000000 --- a/google/ads/googleads/v6/services/services/account_budget_service/transports/grpc.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import account_budget -from google.ads.googleads.v6.services.types import account_budget_service - -from .base import AccountBudgetServiceTransport, DEFAULT_CLIENT_INFO - - -class AccountBudgetServiceGrpcTransport(AccountBudgetServiceTransport): - """gRPC backend transport for AccountBudgetService. - - A service for fetching an account-level budget. - Account-level budgets are mutated by creating proposal - resources. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_account_budget( - self, - ) -> Callable[ - [account_budget_service.GetAccountBudgetRequest], - account_budget.AccountBudget, - ]: - r"""Return a callable for the get account budget method over gRPC. - - Returns an account-level budget in full detail. - - Returns: - Callable[[~.GetAccountBudgetRequest], - ~.AccountBudget]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_account_budget" not in self._stubs: - self._stubs["get_account_budget"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountBudgetService/GetAccountBudget", - request_serializer=account_budget_service.GetAccountBudgetRequest.serialize, - response_deserializer=account_budget.AccountBudget.deserialize, - ) - return self._stubs["get_account_budget"] - - -__all__ = ("AccountBudgetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/account_link_service/__init__.py b/google/ads/googleads/v6/services/services/account_link_service/__init__.py deleted file mode 100644 index 194fc9a95..000000000 --- a/google/ads/googleads/v6/services/services/account_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AccountLinkServiceClient - -__all__ = ("AccountLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_link_service/client.py b/google/ads/googleads/v6/services/services/account_link_service/client.py deleted file mode 100644 index e3f329cd7..000000000 --- a/google/ads/googleads/v6/services/services/account_link_service/client.py +++ /dev/null @@ -1,635 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import account_link -from google.ads.googleads.v6.resources.types import ( - account_link as gagr_account_link, -) -from google.ads.googleads.v6.services.types import account_link_service - -from .transports.base import AccountLinkServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AccountLinkServiceGrpcTransport - - -class AccountLinkServiceClientMeta(type): - """Metaclass for the AccountLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AccountLinkServiceTransport]] - _transport_registry["grpc"] = AccountLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AccountLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AccountLinkServiceClient(metaclass=AccountLinkServiceClientMeta): - """This service allows management of links between Google Ads - accounts and other accounts. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AccountLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AccountLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - AccountLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def account_link_path(customer_id: str, account_link_id: str,) -> str: - """Return a fully-qualified account_link string.""" - return "customers/{customer_id}/accountLinks/{account_link_id}".format( - customer_id=customer_id, account_link_id=account_link_id, - ) - - @staticmethod - def parse_account_link_path(path: str) -> Dict[str, str]: - """Parse a account_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountLinks/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AccountLinkServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the account link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AccountLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AccountLinkServiceTransport): - # transport is a AccountLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AccountLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_account_link( - self, - request: account_link_service.GetAccountLinkRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_link.AccountLink: - r"""Returns the account link in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAccountLinkRequest`): - The request object. Request message for - [AccountLinkService.GetAccountLink][google.ads.googleads.v6.services.AccountLinkService.GetAccountLink]. - resource_name (:class:`str`): - Required. Resource name of the - account link. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AccountLink: - Represents the data sharing - connection between a Google Ads account - and another account - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_link_service.GetAccountLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, account_link_service.GetAccountLinkRequest): - request = account_link_service.GetAccountLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_account_link] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def create_account_link( - self, - request: account_link_service.CreateAccountLinkRequest = None, - *, - customer_id: str = None, - account_link: gagr_account_link.AccountLink = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_link_service.CreateAccountLinkResponse: - r"""Creates an account link. - - Args: - request (:class:`google.ads.googleads.v6.services.types.CreateAccountLinkRequest`): - The request object. Request message for - [AccountLinkService.CreateAccountLink][google.ads.googleads.v6.services.AccountLinkService.CreateAccountLink]. - customer_id (:class:`str`): - Required. The ID of the customer for - which the account link is created. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - account_link (:class:`google.ads.googleads.v6.resources.types.AccountLink`): - Required. The account link to be - created. - - This corresponds to the ``account_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.CreateAccountLinkResponse: - Response message for - [AccountLinkService.CreateAccountLink][google.ads.googleads.v6.services.AccountLinkService.CreateAccountLink]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, account_link]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_link_service.CreateAccountLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, account_link_service.CreateAccountLinkRequest - ): - request = account_link_service.CreateAccountLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if account_link is not None: - request.account_link = account_link - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_account_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_account_link( - self, - request: account_link_service.MutateAccountLinkRequest = None, - *, - customer_id: str = None, - operation: account_link_service.AccountLinkOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> account_link_service.MutateAccountLinkResponse: - r"""Creates or removes an account link. - From V5, create is not supported through - AccountLinkService.MutateAccountLink. Please use - AccountLinkService.CreateAccountLink instead. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAccountLinkRequest`): - The request object. Request message for - [AccountLinkService.MutateAccountLink][google.ads.googleads.v6.services.AccountLinkService.MutateAccountLink]. - customer_id (:class:`str`): - Required. The ID of the customer - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.AccountLinkOperation`): - Required. The operation to perform on - the link. - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAccountLinkResponse: - Response message for account link - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a account_link_service.MutateAccountLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, account_link_service.MutateAccountLinkRequest - ): - request = account_link_service.MutateAccountLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_account_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AccountLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/account_link_service/transports/__init__.py deleted file mode 100644 index 373a9b11d..000000000 --- a/google/ads/googleads/v6/services/services/account_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AccountLinkServiceTransport -from .grpc import AccountLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AccountLinkServiceTransport]] -_transport_registry["grpc"] = AccountLinkServiceGrpcTransport - - -__all__ = ( - "AccountLinkServiceTransport", - "AccountLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/account_link_service/transports/base.py b/google/ads/googleads/v6/services/services/account_link_service/transports/base.py deleted file mode 100644 index 5c0496ebd..000000000 --- a/google/ads/googleads/v6/services/services/account_link_service/transports/base.py +++ /dev/null @@ -1,129 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import account_link -from google.ads.googleads.v6.services.types import account_link_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AccountLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AccountLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_account_link: gapic_v1.method.wrap_method( - self.get_account_link, - default_timeout=None, - client_info=client_info, - ), - self.create_account_link: gapic_v1.method.wrap_method( - self.create_account_link, - default_timeout=None, - client_info=client_info, - ), - self.mutate_account_link: gapic_v1.method.wrap_method( - self.mutate_account_link, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_account_link( - self, - ) -> typing.Callable[ - [account_link_service.GetAccountLinkRequest], account_link.AccountLink - ]: - raise NotImplementedError - - @property - def create_account_link( - self, - ) -> typing.Callable[ - [account_link_service.CreateAccountLinkRequest], - account_link_service.CreateAccountLinkResponse, - ]: - raise NotImplementedError - - @property - def mutate_account_link( - self, - ) -> typing.Callable[ - [account_link_service.MutateAccountLinkRequest], - account_link_service.MutateAccountLinkResponse, - ]: - raise NotImplementedError - - -__all__ = ("AccountLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/account_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/account_link_service/transports/grpc.py deleted file mode 100644 index 68b1c6029..000000000 --- a/google/ads/googleads/v6/services/services/account_link_service/transports/grpc.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import account_link -from google.ads.googleads.v6.services.types import account_link_service - -from .base import AccountLinkServiceTransport, DEFAULT_CLIENT_INFO - - -class AccountLinkServiceGrpcTransport(AccountLinkServiceTransport): - """gRPC backend transport for AccountLinkService. - - This service allows management of links between Google Ads - accounts and other accounts. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_account_link( - self, - ) -> Callable[ - [account_link_service.GetAccountLinkRequest], account_link.AccountLink - ]: - r"""Return a callable for the get account link method over gRPC. - - Returns the account link in full detail. - - Returns: - Callable[[~.GetAccountLinkRequest], - ~.AccountLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_account_link" not in self._stubs: - self._stubs["get_account_link"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountLinkService/GetAccountLink", - request_serializer=account_link_service.GetAccountLinkRequest.serialize, - response_deserializer=account_link.AccountLink.deserialize, - ) - return self._stubs["get_account_link"] - - @property - def create_account_link( - self, - ) -> Callable[ - [account_link_service.CreateAccountLinkRequest], - account_link_service.CreateAccountLinkResponse, - ]: - r"""Return a callable for the create account link method over gRPC. - - Creates an account link. - - Returns: - Callable[[~.CreateAccountLinkRequest], - ~.CreateAccountLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_account_link" not in self._stubs: - self._stubs["create_account_link"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountLinkService/CreateAccountLink", - request_serializer=account_link_service.CreateAccountLinkRequest.serialize, - response_deserializer=account_link_service.CreateAccountLinkResponse.deserialize, - ) - return self._stubs["create_account_link"] - - @property - def mutate_account_link( - self, - ) -> Callable[ - [account_link_service.MutateAccountLinkRequest], - account_link_service.MutateAccountLinkResponse, - ]: - r"""Return a callable for the mutate account link method over gRPC. - - Creates or removes an account link. - From V5, create is not supported through - AccountLinkService.MutateAccountLink. Please use - AccountLinkService.CreateAccountLink instead. - - Returns: - Callable[[~.MutateAccountLinkRequest], - ~.MutateAccountLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_account_link" not in self._stubs: - self._stubs["mutate_account_link"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AccountLinkService/MutateAccountLink", - request_serializer=account_link_service.MutateAccountLinkRequest.serialize, - response_deserializer=account_link_service.MutateAccountLinkResponse.deserialize, - ) - return self._stubs["mutate_account_link"] - - -__all__ = ("AccountLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/__init__.py deleted file mode 100644 index b4ca1c131..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupAdAssetViewServiceClient - -__all__ = ("AdGroupAdAssetViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/client.py b/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/client.py deleted file mode 100644 index b26fb238b..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/client.py +++ /dev/null @@ -1,491 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_asset_view -from google.ads.googleads.v6.services.types import ( - ad_group_ad_asset_view_service, -) - -from .transports.base import ( - AdGroupAdAssetViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupAdAssetViewServiceGrpcTransport - - -class AdGroupAdAssetViewServiceClientMeta(type): - """Metaclass for the AdGroupAdAssetViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupAdAssetViewServiceTransport]] - _transport_registry["grpc"] = AdGroupAdAssetViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupAdAssetViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupAdAssetViewServiceClient( - metaclass=AdGroupAdAssetViewServiceClientMeta -): - """Service to fetch ad group ad asset views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdAssetViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdAssetViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupAdAssetViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupAdAssetViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_asset_view_path( - customer_id: str, - ad_group_id: str, - ad_id: str, - asset_id: str, - field_type: str, - ) -> str: - """Return a fully-qualified ad_group_ad_asset_view string.""" - return "customers/{customer_id}/adGroupAdAssetViews/{ad_group_id}~{ad_id}~{asset_id}~{field_type}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - ad_id=ad_id, - asset_id=asset_id, - field_type=field_type, - ) - - @staticmethod - def parse_ad_group_ad_asset_view_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad_asset_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAdAssetViews/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupAdAssetViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group ad asset view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupAdAssetViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupAdAssetViewServiceTransport): - # transport is a AdGroupAdAssetViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupAdAssetViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_ad_asset_view( - self, - request: ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_ad_asset_view.AdGroupAdAssetView: - r"""Returns the requested ad group ad asset view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupAdAssetViewRequest`): - The request object. Request message for - [AdGroupAdAssetViewService.GetAdGroupAdAssetView][google.ads.googleads.v6.services.AdGroupAdAssetViewService.GetAdGroupAdAssetView]. - resource_name (:class:`str`): - Required. The resource name of the ad - group ad asset view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupAdAssetView: - A link between an AdGroupAd and an - Asset. Currently we only support - AdGroupAdAssetView for AppAds. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest - ): - request = ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_ad_asset_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupAdAssetViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/__init__.py deleted file mode 100644 index 5972b5ea6..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupAdAssetViewServiceTransport -from .grpc import AdGroupAdAssetViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupAdAssetViewServiceTransport]] -_transport_registry["grpc"] = AdGroupAdAssetViewServiceGrpcTransport - - -__all__ = ( - "AdGroupAdAssetViewServiceTransport", - "AdGroupAdAssetViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/base.py deleted file mode 100644 index 4715108f4..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_asset_view -from google.ads.googleads.v6.services.types import ( - ad_group_ad_asset_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupAdAssetViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupAdAssetViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_ad_asset_view: gapic_v1.method.wrap_method( - self.get_ad_group_ad_asset_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_ad_asset_view( - self, - ) -> typing.Callable[ - [ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest], - ad_group_ad_asset_view.AdGroupAdAssetView, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupAdAssetViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/grpc.py deleted file mode 100644 index 3a5a0f952..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_asset_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_asset_view -from google.ads.googleads.v6.services.types import ( - ad_group_ad_asset_view_service, -) - -from .base import AdGroupAdAssetViewServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupAdAssetViewServiceGrpcTransport( - AdGroupAdAssetViewServiceTransport -): - """gRPC backend transport for AdGroupAdAssetViewService. - - Service to fetch ad group ad asset views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_ad_asset_view( - self, - ) -> Callable[ - [ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest], - ad_group_ad_asset_view.AdGroupAdAssetView, - ]: - r"""Return a callable for the get ad group ad asset view method over gRPC. - - Returns the requested ad group ad asset view in full - detail. - - Returns: - Callable[[~.GetAdGroupAdAssetViewRequest], - ~.AdGroupAdAssetView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_ad_asset_view" not in self._stubs: - self._stubs[ - "get_ad_group_ad_asset_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAdAssetViewService/GetAdGroupAdAssetView", - request_serializer=ad_group_ad_asset_view_service.GetAdGroupAdAssetViewRequest.serialize, - response_deserializer=ad_group_ad_asset_view.AdGroupAdAssetView.deserialize, - ) - return self._stubs["get_ad_group_ad_asset_view"] - - -__all__ = ("AdGroupAdAssetViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_label_service/__init__.py deleted file mode 100644 index 87e1a04d2..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupAdLabelServiceClient - -__all__ = ("AdGroupAdLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/client.py b/google/ads/googleads/v6/services/services/ad_group_ad_label_service/client.py deleted file mode 100644 index feed180da..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/client.py +++ /dev/null @@ -1,575 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_label -from google.ads.googleads.v6.services.types import ad_group_ad_label_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdGroupAdLabelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdGroupAdLabelServiceGrpcTransport - - -class AdGroupAdLabelServiceClientMeta(type): - """Metaclass for the AdGroupAdLabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupAdLabelServiceTransport]] - _transport_registry["grpc"] = AdGroupAdLabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupAdLabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupAdLabelServiceClient(metaclass=AdGroupAdLabelServiceClientMeta): - """Service to manage labels on ad group ads.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupAdLabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupAdLabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_label_path( - customer_id: str, ad_group_id: str, ad_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad_label string.""" - return "customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - ad_id=ad_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_ad_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAdLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupAdLabelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group ad label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupAdLabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupAdLabelServiceTransport): - # transport is a AdGroupAdLabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupAdLabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_ad_label( - self, - request: ad_group_ad_label_service.GetAdGroupAdLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_ad_label.AdGroupAdLabel: - r"""Returns the requested ad group ad label in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupAdLabelRequest`): - The request object. Request message for - [AdGroupAdLabelService.GetAdGroupAdLabel][google.ads.googleads.v6.services.AdGroupAdLabelService.GetAdGroupAdLabel]. - resource_name (:class:`str`): - Required. The resource name of the ad - group ad label to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupAdLabel: - A relationship between an ad group ad - and a label. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_ad_label_service.GetAdGroupAdLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_ad_label_service.GetAdGroupAdLabelRequest - ): - request = ad_group_ad_label_service.GetAdGroupAdLabelRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_ad_label - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_ad_labels( - self, - request: ad_group_ad_label_service.MutateAdGroupAdLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_ad_label_service.AdGroupAdLabelOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_ad_label_service.MutateAdGroupAdLabelsResponse: - r"""Creates and removes ad group ad labels. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupAdLabelsRequest`): - The request object. Request message for - [AdGroupAdLabelService.MutateAdGroupAdLabels][google.ads.googleads.v6.services.AdGroupAdLabelService.MutateAdGroupAdLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose ad - group ad labels are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupAdLabelOperation]`): - Required. The list of operations to - perform on ad group ad labels. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupAdLabelsResponse: - Response message for an ad group ad - labels mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_ad_label_service.MutateAdGroupAdLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_ad_label_service.MutateAdGroupAdLabelsRequest - ): - request = ad_group_ad_label_service.MutateAdGroupAdLabelsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_ad_labels - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupAdLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/__init__.py deleted file mode 100644 index c261c2c8b..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupAdLabelServiceTransport -from .grpc import AdGroupAdLabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupAdLabelServiceTransport]] -_transport_registry["grpc"] = AdGroupAdLabelServiceGrpcTransport - - -__all__ = ( - "AdGroupAdLabelServiceTransport", - "AdGroupAdLabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/base.py deleted file mode 100644 index 1c78e8acd..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_label -from google.ads.googleads.v6.services.types import ad_group_ad_label_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupAdLabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupAdLabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_ad_label: gapic_v1.method.wrap_method( - self.get_ad_group_ad_label, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_ad_labels: gapic_v1.method.wrap_method( - self.mutate_ad_group_ad_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_ad_label( - self, - ) -> typing.Callable[ - [ad_group_ad_label_service.GetAdGroupAdLabelRequest], - ad_group_ad_label.AdGroupAdLabel, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_ad_labels( - self, - ) -> typing.Callable[ - [ad_group_ad_label_service.MutateAdGroupAdLabelsRequest], - ad_group_ad_label_service.MutateAdGroupAdLabelsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupAdLabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/grpc.py deleted file mode 100644 index 4b0b11363..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_label_service/transports/grpc.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad_label -from google.ads.googleads.v6.services.types import ad_group_ad_label_service - -from .base import AdGroupAdLabelServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupAdLabelServiceGrpcTransport(AdGroupAdLabelServiceTransport): - """gRPC backend transport for AdGroupAdLabelService. - - Service to manage labels on ad group ads. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_ad_label( - self, - ) -> Callable[ - [ad_group_ad_label_service.GetAdGroupAdLabelRequest], - ad_group_ad_label.AdGroupAdLabel, - ]: - r"""Return a callable for the get ad group ad label method over gRPC. - - Returns the requested ad group ad label in full - detail. - - Returns: - Callable[[~.GetAdGroupAdLabelRequest], - ~.AdGroupAdLabel]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_ad_label" not in self._stubs: - self._stubs[ - "get_ad_group_ad_label" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAdLabelService/GetAdGroupAdLabel", - request_serializer=ad_group_ad_label_service.GetAdGroupAdLabelRequest.serialize, - response_deserializer=ad_group_ad_label.AdGroupAdLabel.deserialize, - ) - return self._stubs["get_ad_group_ad_label"] - - @property - def mutate_ad_group_ad_labels( - self, - ) -> Callable[ - [ad_group_ad_label_service.MutateAdGroupAdLabelsRequest], - ad_group_ad_label_service.MutateAdGroupAdLabelsResponse, - ]: - r"""Return a callable for the mutate ad group ad labels method over gRPC. - - Creates and removes ad group ad labels. - Operation statuses are returned. - - Returns: - Callable[[~.MutateAdGroupAdLabelsRequest], - ~.MutateAdGroupAdLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_ad_labels" not in self._stubs: - self._stubs[ - "mutate_ad_group_ad_labels" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAdLabelService/MutateAdGroupAdLabels", - request_serializer=ad_group_ad_label_service.MutateAdGroupAdLabelsRequest.serialize, - response_deserializer=ad_group_ad_label_service.MutateAdGroupAdLabelsResponse.deserialize, - ) - return self._stubs["mutate_ad_group_ad_labels"] - - -__all__ = ("AdGroupAdLabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_service/__init__.py deleted file mode 100644 index 66856a0bb..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupAdServiceClient - -__all__ = ("AdGroupAdServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_service/client.py b/google/ads/googleads/v6/services/services/ad_group_ad_service/client.py deleted file mode 100644 index 6c3ccf0e5..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_service/client.py +++ /dev/null @@ -1,555 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad -from google.ads.googleads.v6.services.types import ad_group_ad_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdGroupAdServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdGroupAdServiceGrpcTransport - - -class AdGroupAdServiceClientMeta(type): - """Metaclass for the AdGroupAdService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupAdServiceTransport]] - _transport_registry["grpc"] = AdGroupAdServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupAdServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupAdServiceClient(metaclass=AdGroupAdServiceClientMeta): - """Service to manage ads in an ad group.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAdServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupAdServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupAdServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_path(customer_id: str, ad_id: str,) -> str: - """Return a fully-qualified ad string.""" - return "customers/{customer_id}/ads/{ad_id}".format( - customer_id=customer_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_path(path: str) -> Dict[str, str]: - """Parse a ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ads/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupAdServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group ad service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupAdServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupAdServiceTransport): - # transport is a AdGroupAdServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupAdServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_ad( - self, - request: ad_group_ad_service.GetAdGroupAdRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_ad.AdGroupAd: - r"""Returns the requested ad in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupAdRequest`): - The request object. Request message for - [AdGroupAdService.GetAdGroupAd][google.ads.googleads.v6.services.AdGroupAdService.GetAdGroupAd]. - resource_name (:class:`str`): - Required. The resource name of the ad - to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupAd: - An ad group ad. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_ad_service.GetAdGroupAdRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_group_ad_service.GetAdGroupAdRequest): - request = ad_group_ad_service.GetAdGroupAdRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ad_group_ad] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_ads( - self, - request: ad_group_ad_service.MutateAdGroupAdsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ad_group_ad_service.AdGroupAdOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_ad_service.MutateAdGroupAdsResponse: - r"""Creates, updates, or removes ads. Operation statuses - are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupAdsRequest`): - The request object. Request message for - [AdGroupAdService.MutateAdGroupAds][google.ads.googleads.v6.services.AdGroupAdService.MutateAdGroupAds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose ads are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupAdOperation]`): - Required. The list of operations to - perform on individual ads. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupAdsResponse: - Response message for an ad group ad - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_ad_service.MutateAdGroupAdsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_group_ad_service.MutateAdGroupAdsRequest): - request = ad_group_ad_service.MutateAdGroupAdsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_ads - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupAdServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/__init__.py deleted file mode 100644 index 03a8640bf..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupAdServiceTransport -from .grpc import AdGroupAdServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupAdServiceTransport]] -_transport_registry["grpc"] = AdGroupAdServiceGrpcTransport - - -__all__ = ( - "AdGroupAdServiceTransport", - "AdGroupAdServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/base.py deleted file mode 100644 index e96bc4013..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad -from google.ads.googleads.v6.services.types import ad_group_ad_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupAdServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupAdService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_ad: gapic_v1.method.wrap_method( - self.get_ad_group_ad, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_ads: gapic_v1.method.wrap_method( - self.mutate_ad_group_ads, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_ad( - self, - ) -> typing.Callable[ - [ad_group_ad_service.GetAdGroupAdRequest], ad_group_ad.AdGroupAd - ]: - raise NotImplementedError - - @property - def mutate_ad_group_ads( - self, - ) -> typing.Callable[ - [ad_group_ad_service.MutateAdGroupAdsRequest], - ad_group_ad_service.MutateAdGroupAdsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupAdServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/grpc.py deleted file mode 100644 index 767f6f13e..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_ad_service/transports/grpc.py +++ /dev/null @@ -1,273 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_ad -from google.ads.googleads.v6.services.types import ad_group_ad_service - -from .base import AdGroupAdServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupAdServiceGrpcTransport(AdGroupAdServiceTransport): - """gRPC backend transport for AdGroupAdService. - - Service to manage ads in an ad group. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_ad( - self, - ) -> Callable[ - [ad_group_ad_service.GetAdGroupAdRequest], ad_group_ad.AdGroupAd - ]: - r"""Return a callable for the get ad group ad method over gRPC. - - Returns the requested ad in full detail. - - Returns: - Callable[[~.GetAdGroupAdRequest], - ~.AdGroupAd]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_ad" not in self._stubs: - self._stubs["get_ad_group_ad"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAdService/GetAdGroupAd", - request_serializer=ad_group_ad_service.GetAdGroupAdRequest.serialize, - response_deserializer=ad_group_ad.AdGroupAd.deserialize, - ) - return self._stubs["get_ad_group_ad"] - - @property - def mutate_ad_group_ads( - self, - ) -> Callable[ - [ad_group_ad_service.MutateAdGroupAdsRequest], - ad_group_ad_service.MutateAdGroupAdsResponse, - ]: - r"""Return a callable for the mutate ad group ads method over gRPC. - - Creates, updates, or removes ads. Operation statuses - are returned. - - Returns: - Callable[[~.MutateAdGroupAdsRequest], - ~.MutateAdGroupAdsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_ads" not in self._stubs: - self._stubs["mutate_ad_group_ads"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAdService/MutateAdGroupAds", - request_serializer=ad_group_ad_service.MutateAdGroupAdsRequest.serialize, - response_deserializer=ad_group_ad_service.MutateAdGroupAdsResponse.deserialize, - ) - return self._stubs["mutate_ad_group_ads"] - - -__all__ = ("AdGroupAdServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_audience_view_service/__init__.py deleted file mode 100644 index b290548e5..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupAudienceViewServiceClient - -__all__ = ("AdGroupAudienceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/client.py b/google/ads/googleads/v6/services/services/ad_group_audience_view_service/client.py deleted file mode 100644 index c3e753c35..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/client.py +++ /dev/null @@ -1,456 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_audience_view -from google.ads.googleads.v6.services.types import ( - ad_group_audience_view_service, -) - -from .transports.base import ( - AdGroupAudienceViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupAudienceViewServiceGrpcTransport - - -class AdGroupAudienceViewServiceClientMeta(type): - """Metaclass for the AdGroupAudienceViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupAudienceViewServiceTransport]] - _transport_registry["grpc"] = AdGroupAudienceViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupAudienceViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupAudienceViewServiceClient( - metaclass=AdGroupAudienceViewServiceClientMeta -): - """Service to manage ad group audience views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAudienceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupAudienceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupAudienceViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupAudienceViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_audience_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_audience_view string.""" - return "customers/{customer_id}/adGroupAudienceViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_audience_view_path(path: str) -> Dict[str, str]: - """Parse a ad_group_audience_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAudienceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupAudienceViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group audience view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupAudienceViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupAudienceViewServiceTransport): - # transport is a AdGroupAudienceViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupAudienceViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_audience_view( - self, - request: ad_group_audience_view_service.GetAdGroupAudienceViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_audience_view.AdGroupAudienceView: - r"""Returns the requested ad group audience view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupAudienceViewRequest`): - The request object. Request message for - [AdGroupAudienceViewService.GetAdGroupAudienceView][google.ads.googleads.v6.services.AdGroupAudienceViewService.GetAdGroupAudienceView]. - resource_name (:class:`str`): - Required. The resource name of the ad - group audience view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupAudienceView: - An ad group audience view. - Includes performance data from interests - and remarketing lists for Display - Network and YouTube Network ads, and - remarketing lists for search ads (RLSA), - aggregated at the audience level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_audience_view_service.GetAdGroupAudienceViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_audience_view_service.GetAdGroupAudienceViewRequest, - ): - request = ad_group_audience_view_service.GetAdGroupAudienceViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_audience_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupAudienceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/base.py deleted file mode 100644 index 0242d99db..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_audience_view -from google.ads.googleads.v6.services.types import ( - ad_group_audience_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupAudienceViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupAudienceViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_audience_view: gapic_v1.method.wrap_method( - self.get_ad_group_audience_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_audience_view( - self, - ) -> typing.Callable[ - [ad_group_audience_view_service.GetAdGroupAudienceViewRequest], - ad_group_audience_view.AdGroupAudienceView, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupAudienceViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/grpc.py deleted file mode 100644 index 9d47493ec..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_audience_view -from google.ads.googleads.v6.services.types import ( - ad_group_audience_view_service, -) - -from .base import AdGroupAudienceViewServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupAudienceViewServiceGrpcTransport( - AdGroupAudienceViewServiceTransport -): - """gRPC backend transport for AdGroupAudienceViewService. - - Service to manage ad group audience views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_audience_view( - self, - ) -> Callable[ - [ad_group_audience_view_service.GetAdGroupAudienceViewRequest], - ad_group_audience_view.AdGroupAudienceView, - ]: - r"""Return a callable for the get ad group audience view method over gRPC. - - Returns the requested ad group audience view in full - detail. - - Returns: - Callable[[~.GetAdGroupAudienceViewRequest], - ~.AdGroupAudienceView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_audience_view" not in self._stubs: - self._stubs[ - "get_ad_group_audience_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupAudienceViewService/GetAdGroupAudienceView", - request_serializer=ad_group_audience_view_service.GetAdGroupAudienceViewRequest.serialize, - response_deserializer=ad_group_audience_view.AdGroupAudienceView.deserialize, - ) - return self._stubs["get_ad_group_audience_view"] - - -__all__ = ("AdGroupAudienceViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/__init__.py deleted file mode 100644 index 156f8dc39..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupBidModifierServiceClient - -__all__ = ("AdGroupBidModifierServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/client.py b/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/client.py deleted file mode 100644 index 755fcaf93..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/client.py +++ /dev/null @@ -1,562 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_bid_modifier -from google.ads.googleads.v6.services.types import ad_group_bid_modifier_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - AdGroupBidModifierServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupBidModifierServiceGrpcTransport - - -class AdGroupBidModifierServiceClientMeta(type): - """Metaclass for the AdGroupBidModifierService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupBidModifierServiceTransport]] - _transport_registry["grpc"] = AdGroupBidModifierServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupBidModifierServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupBidModifierServiceClient( - metaclass=AdGroupBidModifierServiceClientMeta -): - """Service to manage ad group bid modifiers.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupBidModifierServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupBidModifierServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupBidModifierServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupBidModifierServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_bid_modifier_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_bid_modifier string.""" - return "customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a ad_group_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupBidModifierServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group bid modifier service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupBidModifierServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupBidModifierServiceTransport): - # transport is a AdGroupBidModifierServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupBidModifierServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_bid_modifier( - self, - request: ad_group_bid_modifier_service.GetAdGroupBidModifierRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_bid_modifier.AdGroupBidModifier: - r"""Returns the requested ad group bid modifier in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupBidModifierRequest`): - The request object. Request message for - [AdGroupBidModifierService.GetAdGroupBidModifier][google.ads.googleads.v6.services.AdGroupBidModifierService.GetAdGroupBidModifier]. - resource_name (:class:`str`): - Required. The resource name of the ad - group bid modifier to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupBidModifier: - Represents an ad group bid modifier. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_bid_modifier_service.GetAdGroupBidModifierRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_bid_modifier_service.GetAdGroupBidModifierRequest - ): - request = ad_group_bid_modifier_service.GetAdGroupBidModifierRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_bid_modifier - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_bid_modifiers( - self, - request: ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_bid_modifier_service.AdGroupBidModifierOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_bid_modifier_service.MutateAdGroupBidModifiersResponse: - r"""Creates, updates, or removes ad group bid modifiers. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupBidModifiersRequest`): - The request object. Request message for - [AdGroupBidModifierService.MutateAdGroupBidModifiers][google.ads.googleads.v6.services.AdGroupBidModifierService.MutateAdGroupBidModifiers]. - customer_id (:class:`str`): - Required. ID of the customer whose ad - group bid modifiers are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupBidModifierOperation]`): - Required. The list of operations to - perform on individual ad group bid - modifiers. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupBidModifiersResponse: - Response message for ad group bid - modifiers mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest, - ): - request = ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_bid_modifiers - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupBidModifierServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/__init__.py deleted file mode 100644 index a76e99f10..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupBidModifierServiceTransport -from .grpc import AdGroupBidModifierServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupBidModifierServiceTransport]] -_transport_registry["grpc"] = AdGroupBidModifierServiceGrpcTransport - - -__all__ = ( - "AdGroupBidModifierServiceTransport", - "AdGroupBidModifierServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/base.py deleted file mode 100644 index e7b1b78c0..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_bid_modifier -from google.ads.googleads.v6.services.types import ad_group_bid_modifier_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupBidModifierServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupBidModifierService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_bid_modifier: gapic_v1.method.wrap_method( - self.get_ad_group_bid_modifier, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_bid_modifiers: gapic_v1.method.wrap_method( - self.mutate_ad_group_bid_modifiers, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_bid_modifier( - self, - ) -> typing.Callable[ - [ad_group_bid_modifier_service.GetAdGroupBidModifierRequest], - ad_group_bid_modifier.AdGroupBidModifier, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_bid_modifiers( - self, - ) -> typing.Callable[ - [ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest], - ad_group_bid_modifier_service.MutateAdGroupBidModifiersResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupBidModifierServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/__init__.py deleted file mode 100644 index 0a3311b97..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupCriterionLabelServiceClient - -__all__ = ("AdGroupCriterionLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/client.py b/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/client.py deleted file mode 100644 index 249188f76..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/client.py +++ /dev/null @@ -1,589 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion_label -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_label_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - AdGroupCriterionLabelServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupCriterionLabelServiceGrpcTransport - - -class AdGroupCriterionLabelServiceClientMeta(type): - """Metaclass for the AdGroupCriterionLabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupCriterionLabelServiceTransport]] - _transport_registry["grpc"] = AdGroupCriterionLabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupCriterionLabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupCriterionLabelServiceClient( - metaclass=AdGroupCriterionLabelServiceClientMeta -): - """Service to manage labels on ad group criteria.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupCriterionLabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupCriterionLabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_label_path( - customer_id: str, ad_group_id: str, criterion_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion_label string.""" - return "customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_criterion_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriterionLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, AdGroupCriterionLabelServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group criterion label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupCriterionLabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupCriterionLabelServiceTransport): - # transport is a AdGroupCriterionLabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupCriterionLabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_criterion_label( - self, - request: ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_criterion_label.AdGroupCriterionLabel: - r"""Returns the requested ad group criterion label in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupCriterionLabelRequest`): - The request object. Request message for - [AdGroupCriterionLabelService.GetAdGroupCriterionLabel][google.ads.googleads.v6.services.AdGroupCriterionLabelService.GetAdGroupCriterionLabel]. - resource_name (:class:`str`): - Required. The resource name of the ad - group criterion label to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupCriterionLabel: - A relationship between an ad group - criterion and a label. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest, - ): - request = ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_criterion_label - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_criterion_labels( - self, - request: ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_criterion_label_service.AdGroupCriterionLabelOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_criterion_label_service.MutateAdGroupCriterionLabelsResponse: - r"""Creates and removes ad group criterion labels. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupCriterionLabelsRequest`): - The request object. Request message for - [AdGroupCriterionLabelService.MutateAdGroupCriterionLabels][google.ads.googleads.v6.services.AdGroupCriterionLabelService.MutateAdGroupCriterionLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose ad - group criterion labels are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupCriterionLabelOperation]`): - Required. The list of operations to - perform on ad group criterion labels. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupCriterionLabelsResponse: - Response message for an ad group - criterion labels mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest, - ): - request = ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_criterion_labels - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupCriterionLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/__init__.py deleted file mode 100644 index cffaee288..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupCriterionLabelServiceTransport -from .grpc import AdGroupCriterionLabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupCriterionLabelServiceTransport]] -_transport_registry["grpc"] = AdGroupCriterionLabelServiceGrpcTransport - - -__all__ = ( - "AdGroupCriterionLabelServiceTransport", - "AdGroupCriterionLabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/base.py deleted file mode 100644 index cdd24471b..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/base.py +++ /dev/null @@ -1,118 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion_label -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_label_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupCriterionLabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupCriterionLabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_criterion_label: gapic_v1.method.wrap_method( - self.get_ad_group_criterion_label, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_criterion_labels: gapic_v1.method.wrap_method( - self.mutate_ad_group_criterion_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_criterion_label( - self, - ) -> typing.Callable[ - [ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest], - ad_group_criterion_label.AdGroupCriterionLabel, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_criterion_labels( - self, - ) -> typing.Callable[ - [ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest], - ad_group_criterion_label_service.MutateAdGroupCriterionLabelsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupCriterionLabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/grpc.py deleted file mode 100644 index 3858d13b5..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_label_service/transports/grpc.py +++ /dev/null @@ -1,284 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion_label -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_label_service, -) - -from .base import AdGroupCriterionLabelServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupCriterionLabelServiceGrpcTransport( - AdGroupCriterionLabelServiceTransport -): - """gRPC backend transport for AdGroupCriterionLabelService. - - Service to manage labels on ad group criteria. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_criterion_label( - self, - ) -> Callable[ - [ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest], - ad_group_criterion_label.AdGroupCriterionLabel, - ]: - r"""Return a callable for the get ad group criterion label method over gRPC. - - Returns the requested ad group criterion label in - full detail. - - Returns: - Callable[[~.GetAdGroupCriterionLabelRequest], - ~.AdGroupCriterionLabel]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_criterion_label" not in self._stubs: - self._stubs[ - "get_ad_group_criterion_label" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupCriterionLabelService/GetAdGroupCriterionLabel", - request_serializer=ad_group_criterion_label_service.GetAdGroupCriterionLabelRequest.serialize, - response_deserializer=ad_group_criterion_label.AdGroupCriterionLabel.deserialize, - ) - return self._stubs["get_ad_group_criterion_label"] - - @property - def mutate_ad_group_criterion_labels( - self, - ) -> Callable[ - [ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest], - ad_group_criterion_label_service.MutateAdGroupCriterionLabelsResponse, - ]: - r"""Return a callable for the mutate ad group criterion - labels method over gRPC. - - Creates and removes ad group criterion labels. - Operation statuses are returned. - - Returns: - Callable[[~.MutateAdGroupCriterionLabelsRequest], - ~.MutateAdGroupCriterionLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_criterion_labels" not in self._stubs: - self._stubs[ - "mutate_ad_group_criterion_labels" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupCriterionLabelService/MutateAdGroupCriterionLabels", - request_serializer=ad_group_criterion_label_service.MutateAdGroupCriterionLabelsRequest.serialize, - response_deserializer=ad_group_criterion_label_service.MutateAdGroupCriterionLabelsResponse.deserialize, - ) - return self._stubs["mutate_ad_group_criterion_labels"] - - -__all__ = ("AdGroupCriterionLabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_service/__init__.py deleted file mode 100644 index 38b76d0fc..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupCriterionServiceClient - -__all__ = ("AdGroupCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_service/client.py b/google/ads/googleads/v6/services/services/ad_group_criterion_service/client.py deleted file mode 100644 index 3a9e0e15d..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_service/client.py +++ /dev/null @@ -1,559 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion -from google.ads.googleads.v6.services.types import ad_group_criterion_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - AdGroupCriterionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupCriterionServiceGrpcTransport - - -class AdGroupCriterionServiceClientMeta(type): - """Metaclass for the AdGroupCriterionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupCriterionServiceTransport]] - _transport_registry["grpc"] = AdGroupCriterionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupCriterionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupCriterionServiceClient( - metaclass=AdGroupCriterionServiceClientMeta -): - """Service to manage ad group criteria.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupCriterionServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupCriterionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupCriterionServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group criterion service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupCriterionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupCriterionServiceTransport): - # transport is a AdGroupCriterionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupCriterionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_criterion( - self, - request: ad_group_criterion_service.GetAdGroupCriterionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_criterion.AdGroupCriterion: - r"""Returns the requested criterion in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupCriterionRequest`): - The request object. Request message for - [AdGroupCriterionService.GetAdGroupCriterion][google.ads.googleads.v6.services.AdGroupCriterionService.GetAdGroupCriterion]. - resource_name (:class:`str`): - Required. The resource name of the - criterion to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupCriterion: - An ad group criterion. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_criterion_service.GetAdGroupCriterionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_criterion_service.GetAdGroupCriterionRequest - ): - request = ad_group_criterion_service.GetAdGroupCriterionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_criterion - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_criteria( - self, - request: ad_group_criterion_service.MutateAdGroupCriteriaRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_criterion_service.AdGroupCriterionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_criterion_service.MutateAdGroupCriteriaResponse: - r"""Creates, updates, or removes criteria. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupCriteriaRequest`): - The request object. Request message for - [AdGroupCriterionService.MutateAdGroupCriteria][google.ads.googleads.v6.services.AdGroupCriterionService.MutateAdGroupCriteria]. - customer_id (:class:`str`): - Required. ID of the customer whose - criteria are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupCriterionOperation]`): - Required. The list of operations to - perform on individual criteria. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupCriteriaResponse: - Response message for an ad group - criterion mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_criterion_service.MutateAdGroupCriteriaRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_criterion_service.MutateAdGroupCriteriaRequest - ): - request = ad_group_criterion_service.MutateAdGroupCriteriaRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_criteria - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/__init__.py deleted file mode 100644 index 2afb4d15c..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupCriterionServiceTransport -from .grpc import AdGroupCriterionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupCriterionServiceTransport]] -_transport_registry["grpc"] = AdGroupCriterionServiceGrpcTransport - - -__all__ = ( - "AdGroupCriterionServiceTransport", - "AdGroupCriterionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/base.py deleted file mode 100644 index 08d329caf..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion -from google.ads.googleads.v6.services.types import ad_group_criterion_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupCriterionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupCriterionService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_criterion: gapic_v1.method.wrap_method( - self.get_ad_group_criterion, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_criteria: gapic_v1.method.wrap_method( - self.mutate_ad_group_criteria, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_criterion( - self, - ) -> typing.Callable[ - [ad_group_criterion_service.GetAdGroupCriterionRequest], - ad_group_criterion.AdGroupCriterion, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_criteria( - self, - ) -> typing.Callable[ - [ad_group_criterion_service.MutateAdGroupCriteriaRequest], - ad_group_criterion_service.MutateAdGroupCriteriaResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupCriterionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/grpc.py deleted file mode 100644 index 6fa055776..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_service/transports/grpc.py +++ /dev/null @@ -1,278 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_criterion -from google.ads.googleads.v6.services.types import ad_group_criterion_service - -from .base import AdGroupCriterionServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupCriterionServiceGrpcTransport(AdGroupCriterionServiceTransport): - """gRPC backend transport for AdGroupCriterionService. - - Service to manage ad group criteria. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_criterion( - self, - ) -> Callable[ - [ad_group_criterion_service.GetAdGroupCriterionRequest], - ad_group_criterion.AdGroupCriterion, - ]: - r"""Return a callable for the get ad group criterion method over gRPC. - - Returns the requested criterion in full detail. - - Returns: - Callable[[~.GetAdGroupCriterionRequest], - ~.AdGroupCriterion]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_criterion" not in self._stubs: - self._stubs[ - "get_ad_group_criterion" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupCriterionService/GetAdGroupCriterion", - request_serializer=ad_group_criterion_service.GetAdGroupCriterionRequest.serialize, - response_deserializer=ad_group_criterion.AdGroupCriterion.deserialize, - ) - return self._stubs["get_ad_group_criterion"] - - @property - def mutate_ad_group_criteria( - self, - ) -> Callable[ - [ad_group_criterion_service.MutateAdGroupCriteriaRequest], - ad_group_criterion_service.MutateAdGroupCriteriaResponse, - ]: - r"""Return a callable for the mutate ad group criteria method over gRPC. - - Creates, updates, or removes criteria. Operation - statuses are returned. - - Returns: - Callable[[~.MutateAdGroupCriteriaRequest], - ~.MutateAdGroupCriteriaResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_criteria" not in self._stubs: - self._stubs[ - "mutate_ad_group_criteria" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupCriterionService/MutateAdGroupCriteria", - request_serializer=ad_group_criterion_service.MutateAdGroupCriteriaRequest.serialize, - response_deserializer=ad_group_criterion_service.MutateAdGroupCriteriaResponse.deserialize, - ) - return self._stubs["mutate_ad_group_criteria"] - - -__all__ = ("AdGroupCriterionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/__init__.py deleted file mode 100644 index b7ce5c43c..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupCriterionSimulationServiceClient - -__all__ = ("AdGroupCriterionSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/client.py b/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/client.py deleted file mode 100644 index 725c314b3..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/client.py +++ /dev/null @@ -1,475 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_simulation_service, -) - -from .transports.base import ( - AdGroupCriterionSimulationServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupCriterionSimulationServiceGrpcTransport - - -class AdGroupCriterionSimulationServiceClientMeta(type): - """Metaclass for the AdGroupCriterionSimulationService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupCriterionSimulationServiceTransport]] - _transport_registry["grpc"] = AdGroupCriterionSimulationServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupCriterionSimulationServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupCriterionSimulationServiceClient( - metaclass=AdGroupCriterionSimulationServiceClientMeta -): - """Service to fetch ad group criterion simulations.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupCriterionSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupCriterionSimulationServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupCriterionSimulationServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_criterion_simulation_path( - customer_id: str, - ad_group_id: str, - criterion_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified ad_group_criterion_simulation string.""" - return "customers/{customer_id}/adGroupCriterionSimulations/{ad_group_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_ad_group_criterion_simulation_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriterionSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, AdGroupCriterionSimulationServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group criterion simulation service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupCriterionSimulationServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupCriterionSimulationServiceTransport): - # transport is a AdGroupCriterionSimulationServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupCriterionSimulationServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_criterion_simulation( - self, - request: ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_criterion_simulation.AdGroupCriterionSimulation: - r"""Returns the requested ad group criterion simulation - in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupCriterionSimulationRequest`): - The request object. Request message for - [AdGroupCriterionSimulationService.GetAdGroupCriterionSimulation][google.ads.googleads.v6.services.AdGroupCriterionSimulationService.GetAdGroupCriterionSimulation]. - resource_name (:class:`str`): - Required. The resource name of the ad - group criterion simulation to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupCriterionSimulation: - An ad group criterion simulation. Supported combinations of advertising - channel type, criterion type, simulation type, and - simulation modification method are detailed below - respectively. Hotel AdGroupCriterion simulation - operations starting in V5. - - 1. DISPLAY - KEYWORD - CPC_BID - UNIFORM - 2. SEARCH - KEYWORD - CPC_BID - UNIFORM - 3. SHOPPING - LISTING_GROUP - CPC_BID - UNIFORM - 4. HOTEL - LISTING_GROUP - CPC_BID - UNIFORM - 5. HOTEL - LISTING_GROUP - PERCENT_CPC_BID - UNIFORM - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest, - ): - request = ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_criterion_simulation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupCriterionSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/__init__.py deleted file mode 100644 index e0c07f9bd..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupCriterionSimulationServiceTransport -from .grpc import AdGroupCriterionSimulationServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupCriterionSimulationServiceTransport]] -_transport_registry["grpc"] = AdGroupCriterionSimulationServiceGrpcTransport - - -__all__ = ( - "AdGroupCriterionSimulationServiceTransport", - "AdGroupCriterionSimulationServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/base.py deleted file mode 100644 index 18507374b..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_simulation_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupCriterionSimulationServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupCriterionSimulationService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_criterion_simulation: gapic_v1.method.wrap_method( - self.get_ad_group_criterion_simulation, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_criterion_simulation( - self, - ) -> typing.Callable[ - [ - ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest - ], - ad_group_criterion_simulation.AdGroupCriterionSimulation, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupCriterionSimulationServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/grpc.py deleted file mode 100644 index 1ba39de67..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_criterion_simulation_service/transports/grpc.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_simulation_service, -) - -from .base import ( - AdGroupCriterionSimulationServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class AdGroupCriterionSimulationServiceGrpcTransport( - AdGroupCriterionSimulationServiceTransport -): - """gRPC backend transport for AdGroupCriterionSimulationService. - - Service to fetch ad group criterion simulations. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_criterion_simulation( - self, - ) -> Callable[ - [ - ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest - ], - ad_group_criterion_simulation.AdGroupCriterionSimulation, - ]: - r"""Return a callable for the get ad group criterion - simulation method over gRPC. - - Returns the requested ad group criterion simulation - in full detail. - - Returns: - Callable[[~.GetAdGroupCriterionSimulationRequest], - ~.AdGroupCriterionSimulation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_criterion_simulation" not in self._stubs: - self._stubs[ - "get_ad_group_criterion_simulation" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupCriterionSimulationService/GetAdGroupCriterionSimulation", - request_serializer=ad_group_criterion_simulation_service.GetAdGroupCriterionSimulationRequest.serialize, - response_deserializer=ad_group_criterion_simulation.AdGroupCriterionSimulation.deserialize, - ) - return self._stubs["get_ad_group_criterion_simulation"] - - -__all__ = ("AdGroupCriterionSimulationServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/__init__.py deleted file mode 100644 index 6b3505a57..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupExtensionSettingServiceClient - -__all__ = ("AdGroupExtensionSettingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/client.py b/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/client.py deleted file mode 100644 index cd50f3f8c..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/client.py +++ /dev/null @@ -1,584 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_extension_setting -from google.ads.googleads.v6.services.types import ( - ad_group_extension_setting_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - AdGroupExtensionSettingServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupExtensionSettingServiceGrpcTransport - - -class AdGroupExtensionSettingServiceClientMeta(type): - """Metaclass for the AdGroupExtensionSettingService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupExtensionSettingServiceTransport]] - _transport_registry["grpc"] = AdGroupExtensionSettingServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupExtensionSettingServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupExtensionSettingServiceClient( - metaclass=AdGroupExtensionSettingServiceClientMeta -): - """Service to manage ad group extension settings.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupExtensionSettingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupExtensionSettingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupExtensionSettingServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupExtensionSettingServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_extension_setting_path( - customer_id: str, ad_group_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified ad_group_extension_setting string.""" - return "customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - extension_type=extension_type, - ) - - @staticmethod - def parse_ad_group_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a ad_group_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupExtensionSettings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, AdGroupExtensionSettingServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group extension setting service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupExtensionSettingServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupExtensionSettingServiceTransport): - # transport is a AdGroupExtensionSettingServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupExtensionSettingServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_extension_setting( - self, - request: ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_extension_setting.AdGroupExtensionSetting: - r"""Returns the requested ad group extension setting in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupExtensionSettingRequest`): - The request object. Request message for - [AdGroupExtensionSettingService.GetAdGroupExtensionSetting][google.ads.googleads.v6.services.AdGroupExtensionSettingService.GetAdGroupExtensionSetting]. - resource_name (:class:`str`): - Required. The resource name of the ad - group extension setting to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupExtensionSetting: - An ad group extension setting. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest, - ): - request = ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_extension_setting - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_extension_settings( - self, - request: ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_extension_setting_service.AdGroupExtensionSettingOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_extension_setting_service.MutateAdGroupExtensionSettingsResponse: - r"""Creates, updates, or removes ad group extension - settings. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupExtensionSettingsRequest`): - The request object. Request message for - [AdGroupExtensionSettingService.MutateAdGroupExtensionSettings][google.ads.googleads.v6.services.AdGroupExtensionSettingService.MutateAdGroupExtensionSettings]. - customer_id (:class:`str`): - Required. The ID of the customer - whose ad group extension settings are - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupExtensionSettingOperation]`): - Required. The list of operations to - perform on individual ad group extension - settings. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupExtensionSettingsResponse: - Response message for an ad group - extension setting mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest, - ): - request = ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_extension_settings - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupExtensionSettingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/__init__.py deleted file mode 100644 index dc79a1724..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupExtensionSettingServiceTransport -from .grpc import AdGroupExtensionSettingServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupExtensionSettingServiceTransport]] -_transport_registry["grpc"] = AdGroupExtensionSettingServiceGrpcTransport - - -__all__ = ( - "AdGroupExtensionSettingServiceTransport", - "AdGroupExtensionSettingServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/base.py deleted file mode 100644 index 482e65c5b..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/base.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_extension_setting -from google.ads.googleads.v6.services.types import ( - ad_group_extension_setting_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupExtensionSettingServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupExtensionSettingService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_extension_setting: gapic_v1.method.wrap_method( - self.get_ad_group_extension_setting, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_extension_settings: gapic_v1.method.wrap_method( - self.mutate_ad_group_extension_settings, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_extension_setting( - self, - ) -> typing.Callable[ - [ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest], - ad_group_extension_setting.AdGroupExtensionSetting, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_extension_settings( - self, - ) -> typing.Callable[ - [ - ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest - ], - ad_group_extension_setting_service.MutateAdGroupExtensionSettingsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupExtensionSettingServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_feed_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_feed_service/__init__.py deleted file mode 100644 index ec07a2db3..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_feed_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupFeedServiceClient - -__all__ = ("AdGroupFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_feed_service/client.py b/google/ads/googleads/v6/services/services/ad_group_feed_service/client.py deleted file mode 100644 index ae921f473..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_feed_service/client.py +++ /dev/null @@ -1,559 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_feed -from google.ads.googleads.v6.services.types import ad_group_feed_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdGroupFeedServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdGroupFeedServiceGrpcTransport - - -class AdGroupFeedServiceClientMeta(type): - """Metaclass for the AdGroupFeedService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupFeedServiceTransport]] - _transport_registry["grpc"] = AdGroupFeedServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupFeedServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupFeedServiceClient(metaclass=AdGroupFeedServiceClientMeta): - """Service to manage ad group feeds.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupFeedServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupFeedServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_feed_path( - customer_id: str, ad_group_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified ad_group_feed string.""" - return "customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, feed_id=feed_id, - ) - - @staticmethod - def parse_ad_group_feed_path(path: str) -> Dict[str, str]: - """Parse a ad_group_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupFeedServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group feed service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupFeedServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupFeedServiceTransport): - # transport is a AdGroupFeedServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupFeedServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_feed( - self, - request: ad_group_feed_service.GetAdGroupFeedRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_feed.AdGroupFeed: - r"""Returns the requested ad group feed in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupFeedRequest`): - The request object. Request message for - [AdGroupFeedService.GetAdGroupFeed][google.ads.googleads.v6.services.AdGroupFeedService.GetAdGroupFeed]. - resource_name (:class:`str`): - Required. The resource name of the ad - group feed to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupFeed: - An ad group feed. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_feed_service.GetAdGroupFeedRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_group_feed_service.GetAdGroupFeedRequest): - request = ad_group_feed_service.GetAdGroupFeedRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_feed - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_feeds( - self, - request: ad_group_feed_service.MutateAdGroupFeedsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ad_group_feed_service.AdGroupFeedOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_feed_service.MutateAdGroupFeedsResponse: - r"""Creates, updates, or removes ad group feeds. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupFeedsRequest`): - The request object. Request message for - [AdGroupFeedService.MutateAdGroupFeeds][google.ads.googleads.v6.services.AdGroupFeedService.MutateAdGroupFeeds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose ad group feeds are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupFeedOperation]`): - Required. The list of operations to - perform on individual ad group feeds. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupFeedsResponse: - Response message for an ad group feed - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_feed_service.MutateAdGroupFeedsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_feed_service.MutateAdGroupFeedsRequest - ): - request = ad_group_feed_service.MutateAdGroupFeedsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_feeds - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/__init__.py deleted file mode 100644 index 9f5ec959f..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupFeedServiceTransport -from .grpc import AdGroupFeedServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupFeedServiceTransport]] -_transport_registry["grpc"] = AdGroupFeedServiceGrpcTransport - - -__all__ = ( - "AdGroupFeedServiceTransport", - "AdGroupFeedServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/grpc.py deleted file mode 100644 index 60a53d7d5..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/grpc.py +++ /dev/null @@ -1,275 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_feed -from google.ads.googleads.v6.services.types import ad_group_feed_service - -from .base import AdGroupFeedServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupFeedServiceGrpcTransport(AdGroupFeedServiceTransport): - """gRPC backend transport for AdGroupFeedService. - - Service to manage ad group feeds. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_feed( - self, - ) -> Callable[ - [ad_group_feed_service.GetAdGroupFeedRequest], ad_group_feed.AdGroupFeed - ]: - r"""Return a callable for the get ad group feed method over gRPC. - - Returns the requested ad group feed in full detail. - - Returns: - Callable[[~.GetAdGroupFeedRequest], - ~.AdGroupFeed]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_feed" not in self._stubs: - self._stubs["get_ad_group_feed"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupFeedService/GetAdGroupFeed", - request_serializer=ad_group_feed_service.GetAdGroupFeedRequest.serialize, - response_deserializer=ad_group_feed.AdGroupFeed.deserialize, - ) - return self._stubs["get_ad_group_feed"] - - @property - def mutate_ad_group_feeds( - self, - ) -> Callable[ - [ad_group_feed_service.MutateAdGroupFeedsRequest], - ad_group_feed_service.MutateAdGroupFeedsResponse, - ]: - r"""Return a callable for the mutate ad group feeds method over gRPC. - - Creates, updates, or removes ad group feeds. - Operation statuses are returned. - - Returns: - Callable[[~.MutateAdGroupFeedsRequest], - ~.MutateAdGroupFeedsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_feeds" not in self._stubs: - self._stubs[ - "mutate_ad_group_feeds" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupFeedService/MutateAdGroupFeeds", - request_serializer=ad_group_feed_service.MutateAdGroupFeedsRequest.serialize, - response_deserializer=ad_group_feed_service.MutateAdGroupFeedsResponse.deserialize, - ) - return self._stubs["mutate_ad_group_feeds"] - - -__all__ = ("AdGroupFeedServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_label_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_label_service/__init__.py deleted file mode 100644 index f42630048..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupLabelServiceClient - -__all__ = ("AdGroupLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_label_service/client.py b/google/ads/googleads/v6/services/services/ad_group_label_service/client.py deleted file mode 100644 index 8ec16a564..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_label_service/client.py +++ /dev/null @@ -1,565 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_label -from google.ads.googleads.v6.services.types import ad_group_label_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdGroupLabelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdGroupLabelServiceGrpcTransport - - -class AdGroupLabelServiceClientMeta(type): - """Metaclass for the AdGroupLabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupLabelServiceTransport]] - _transport_registry["grpc"] = AdGroupLabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupLabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupLabelServiceClient(metaclass=AdGroupLabelServiceClientMeta): - """Service to manage labels on ad groups.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupLabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupLabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_label_path( - customer_id: str, ad_group_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_label string.""" - return "customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, label_id=label_id, - ) - - @staticmethod - def parse_ad_group_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupLabelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupLabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupLabelServiceTransport): - # transport is a AdGroupLabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupLabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_label( - self, - request: ad_group_label_service.GetAdGroupLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_label.AdGroupLabel: - r"""Returns the requested ad group label in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupLabelRequest`): - The request object. Request message for - [AdGroupLabelService.GetAdGroupLabel][google.ads.googleads.v6.services.AdGroupLabelService.GetAdGroupLabel]. - resource_name (:class:`str`): - Required. The resource name of the ad - group label to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupLabel: - A relationship between an ad group - and a label. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_label_service.GetAdGroupLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_label_service.GetAdGroupLabelRequest - ): - request = ad_group_label_service.GetAdGroupLabelRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_label - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_group_labels( - self, - request: ad_group_label_service.MutateAdGroupLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - ad_group_label_service.AdGroupLabelOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_label_service.MutateAdGroupLabelsResponse: - r"""Creates and removes ad group labels. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupLabelsRequest`): - The request object. Request message for - [AdGroupLabelService.MutateAdGroupLabels][google.ads.googleads.v6.services.AdGroupLabelService.MutateAdGroupLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose ad - group labels are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupLabelOperation]`): - Required. The list of operations to - perform on ad group labels. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupLabelsResponse: - Response message for an ad group - labels mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_label_service.MutateAdGroupLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_label_service.MutateAdGroupLabelsRequest - ): - request = ad_group_label_service.MutateAdGroupLabelsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_group_labels - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_label_service/transports/__init__.py deleted file mode 100644 index 97e4ddaf4..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupLabelServiceTransport -from .grpc import AdGroupLabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupLabelServiceTransport]] -_transport_registry["grpc"] = AdGroupLabelServiceGrpcTransport - - -__all__ = ( - "AdGroupLabelServiceTransport", - "AdGroupLabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_label_service/transports/base.py deleted file mode 100644 index e76fda672..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_label -from google.ads.googleads.v6.services.types import ad_group_label_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupLabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupLabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_label: gapic_v1.method.wrap_method( - self.get_ad_group_label, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_group_labels: gapic_v1.method.wrap_method( - self.mutate_ad_group_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_label( - self, - ) -> typing.Callable[ - [ad_group_label_service.GetAdGroupLabelRequest], - ad_group_label.AdGroupLabel, - ]: - raise NotImplementedError - - @property - def mutate_ad_group_labels( - self, - ) -> typing.Callable[ - [ad_group_label_service.MutateAdGroupLabelsRequest], - ad_group_label_service.MutateAdGroupLabelsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupLabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_label_service/transports/grpc.py deleted file mode 100644 index da051c804..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_label_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_label -from google.ads.googleads.v6.services.types import ad_group_label_service - -from .base import AdGroupLabelServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupLabelServiceGrpcTransport(AdGroupLabelServiceTransport): - """gRPC backend transport for AdGroupLabelService. - - Service to manage labels on ad groups. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_label( - self, - ) -> Callable[ - [ad_group_label_service.GetAdGroupLabelRequest], - ad_group_label.AdGroupLabel, - ]: - r"""Return a callable for the get ad group label method over gRPC. - - Returns the requested ad group label in full detail. - - Returns: - Callable[[~.GetAdGroupLabelRequest], - ~.AdGroupLabel]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_label" not in self._stubs: - self._stubs["get_ad_group_label"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupLabelService/GetAdGroupLabel", - request_serializer=ad_group_label_service.GetAdGroupLabelRequest.serialize, - response_deserializer=ad_group_label.AdGroupLabel.deserialize, - ) - return self._stubs["get_ad_group_label"] - - @property - def mutate_ad_group_labels( - self, - ) -> Callable[ - [ad_group_label_service.MutateAdGroupLabelsRequest], - ad_group_label_service.MutateAdGroupLabelsResponse, - ]: - r"""Return a callable for the mutate ad group labels method over gRPC. - - Creates and removes ad group labels. - Operation statuses are returned. - - Returns: - Callable[[~.MutateAdGroupLabelsRequest], - ~.MutateAdGroupLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_group_labels" not in self._stubs: - self._stubs[ - "mutate_ad_group_labels" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupLabelService/MutateAdGroupLabels", - request_serializer=ad_group_label_service.MutateAdGroupLabelsRequest.serialize, - response_deserializer=ad_group_label_service.MutateAdGroupLabelsResponse.deserialize, - ) - return self._stubs["mutate_ad_group_labels"] - - -__all__ = ("AdGroupLabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_service/__init__.py deleted file mode 100644 index fb00548bd..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupServiceClient - -__all__ = ("AdGroupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_service/client.py b/google/ads/googleads/v6/services/services/ad_group_service/client.py deleted file mode 100644 index bf3d8468d..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_service/client.py +++ /dev/null @@ -1,554 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group -from google.ads.googleads.v6.services.types import ad_group_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdGroupServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdGroupServiceGrpcTransport - - -class AdGroupServiceClientMeta(type): - """Metaclass for the AdGroupService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupServiceTransport]] - _transport_registry["grpc"] = AdGroupServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupServiceClient(metaclass=AdGroupServiceClientMeta): - """Service to manage ad groups.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_label_path( - customer_id: str, ad_group_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_label string.""" - return "customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, label_id=label_id, - ) - - @staticmethod - def parse_ad_group_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupServiceTransport): - # transport is a AdGroupServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group( - self, - request: ad_group_service.GetAdGroupRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group.AdGroup: - r"""Returns the requested ad group in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupRequest`): - The request object. Request message for - [AdGroupService.GetAdGroup][google.ads.googleads.v6.services.AdGroupService.GetAdGroup]. - resource_name (:class:`str`): - Required. The resource name of the ad - group to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroup: - An ad group. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_service.GetAdGroupRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_group_service.GetAdGroupRequest): - request = ad_group_service.GetAdGroupRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ad_group] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_groups( - self, - request: ad_group_service.MutateAdGroupsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ad_group_service.AdGroupOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_service.MutateAdGroupsResponse: - r"""Creates, updates, or removes ad groups. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdGroupsRequest`): - The request object. Request message for - [AdGroupService.MutateAdGroups][google.ads.googleads.v6.services.AdGroupService.MutateAdGroups]. - customer_id (:class:`str`): - Required. The ID of the customer - whose ad groups are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdGroupOperation]`): - Required. The list of operations to - perform on individual ad groups. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdGroupsResponse: - Response message for an ad group - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_service.MutateAdGroupsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_group_service.MutateAdGroupsRequest): - request = ad_group_service.MutateAdGroupsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_ad_groups] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_service/transports/__init__.py deleted file mode 100644 index b45200a07..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupServiceTransport -from .grpc import AdGroupServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupServiceTransport]] -_transport_registry["grpc"] = AdGroupServiceGrpcTransport - - -__all__ = ( - "AdGroupServiceTransport", - "AdGroupServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_service/transports/base.py deleted file mode 100644 index b35e4cc1d..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group -from google.ads.googleads.v6.services.types import ad_group_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group: gapic_v1.method.wrap_method( - self.get_ad_group, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_groups: gapic_v1.method.wrap_method( - self.mutate_ad_groups, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group( - self, - ) -> typing.Callable[ - [ad_group_service.GetAdGroupRequest], ad_group.AdGroup - ]: - raise NotImplementedError - - @property - def mutate_ad_groups( - self, - ) -> typing.Callable[ - [ad_group_service.MutateAdGroupsRequest], - ad_group_service.MutateAdGroupsResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_service/transports/grpc.py deleted file mode 100644 index a699e11de..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_service/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group -from google.ads.googleads.v6.services.types import ad_group_service - -from .base import AdGroupServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupServiceGrpcTransport(AdGroupServiceTransport): - """gRPC backend transport for AdGroupService. - - Service to manage ad groups. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group( - self, - ) -> Callable[[ad_group_service.GetAdGroupRequest], ad_group.AdGroup]: - r"""Return a callable for the get ad group method over gRPC. - - Returns the requested ad group in full detail. - - Returns: - Callable[[~.GetAdGroupRequest], - ~.AdGroup]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group" not in self._stubs: - self._stubs["get_ad_group"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupService/GetAdGroup", - request_serializer=ad_group_service.GetAdGroupRequest.serialize, - response_deserializer=ad_group.AdGroup.deserialize, - ) - return self._stubs["get_ad_group"] - - @property - def mutate_ad_groups( - self, - ) -> Callable[ - [ad_group_service.MutateAdGroupsRequest], - ad_group_service.MutateAdGroupsResponse, - ]: - r"""Return a callable for the mutate ad groups method over gRPC. - - Creates, updates, or removes ad groups. Operation - statuses are returned. - - Returns: - Callable[[~.MutateAdGroupsRequest], - ~.MutateAdGroupsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_groups" not in self._stubs: - self._stubs["mutate_ad_groups"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupService/MutateAdGroups", - request_serializer=ad_group_service.MutateAdGroupsRequest.serialize, - response_deserializer=ad_group_service.MutateAdGroupsResponse.deserialize, - ) - return self._stubs["mutate_ad_groups"] - - -__all__ = ("AdGroupServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_simulation_service/__init__.py b/google/ads/googleads/v6/services/services/ad_group_simulation_service/__init__.py deleted file mode 100644 index ee1013b4a..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_simulation_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdGroupSimulationServiceClient - -__all__ = ("AdGroupSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_simulation_service/client.py b/google/ads/googleads/v6/services/services/ad_group_simulation_service/client.py deleted file mode 100644 index 7a41ab5d4..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_simulation_service/client.py +++ /dev/null @@ -1,468 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_simulation -from google.ads.googleads.v6.services.types import ad_group_simulation_service - -from .transports.base import ( - AdGroupSimulationServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import AdGroupSimulationServiceGrpcTransport - - -class AdGroupSimulationServiceClientMeta(type): - """Metaclass for the AdGroupSimulationService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdGroupSimulationServiceTransport]] - _transport_registry["grpc"] = AdGroupSimulationServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdGroupSimulationServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdGroupSimulationServiceClient( - metaclass=AdGroupSimulationServiceClientMeta -): - """Service to fetch ad group simulations.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdGroupSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdGroupSimulationServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdGroupSimulationServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_simulation_path( - customer_id: str, - ad_group_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified ad_group_simulation string.""" - return "customers/{customer_id}/adGroupSimulations/{ad_group_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_ad_group_simulation_path(path: str) -> Dict[str, str]: - """Parse a ad_group_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdGroupSimulationServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad group simulation service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdGroupSimulationServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdGroupSimulationServiceTransport): - # transport is a AdGroupSimulationServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdGroupSimulationServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_group_simulation( - self, - request: ad_group_simulation_service.GetAdGroupSimulationRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_group_simulation.AdGroupSimulation: - r"""Returns the requested ad group simulation in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdGroupSimulationRequest`): - The request object. Request message for - [AdGroupSimulationService.GetAdGroupSimulation][google.ads.googleads.v6.services.AdGroupSimulationService.GetAdGroupSimulation]. - resource_name (:class:`str`): - Required. The resource name of the ad - group simulation to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdGroupSimulation: - An ad group simulation. Supported combinations of advertising - channel type, simulation type and simulation - modification method is detailed below respectively. - - 1. SEARCH - CPC_BID - DEFAULT - 2. SEARCH - CPC_BID - UNIFORM - 3. SEARCH - TARGET_CPA - UNIFORM - 4. SEARCH - TARGET_ROAS - UNIFORM - 5. DISPLAY - CPC_BID - DEFAULT - 6. DISPLAY - CPC_BID - UNIFORM - 7. DISPLAY - TARGET_CPA - UNIFORM - 8. VIDEO - CPV_BID - DEFAULT - 9. VIDEO - CPV_BID - UNIFORM - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_group_simulation_service.GetAdGroupSimulationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_group_simulation_service.GetAdGroupSimulationRequest - ): - request = ad_group_simulation_service.GetAdGroupSimulationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_group_simulation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdGroupSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/__init__.py deleted file mode 100644 index ceac2d041..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdGroupSimulationServiceTransport -from .grpc import AdGroupSimulationServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdGroupSimulationServiceTransport]] -_transport_registry["grpc"] = AdGroupSimulationServiceGrpcTransport - - -__all__ = ( - "AdGroupSimulationServiceTransport", - "AdGroupSimulationServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/base.py deleted file mode 100644 index 966cb40cd..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_simulation -from google.ads.googleads.v6.services.types import ad_group_simulation_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdGroupSimulationServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupSimulationService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_group_simulation: gapic_v1.method.wrap_method( - self.get_ad_group_simulation, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_group_simulation( - self, - ) -> typing.Callable[ - [ad_group_simulation_service.GetAdGroupSimulationRequest], - ad_group_simulation.AdGroupSimulation, - ]: - raise NotImplementedError - - -__all__ = ("AdGroupSimulationServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/grpc.py deleted file mode 100644 index 65aa77db0..000000000 --- a/google/ads/googleads/v6/services/services/ad_group_simulation_service/transports/grpc.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_simulation -from google.ads.googleads.v6.services.types import ad_group_simulation_service - -from .base import AdGroupSimulationServiceTransport, DEFAULT_CLIENT_INFO - - -class AdGroupSimulationServiceGrpcTransport(AdGroupSimulationServiceTransport): - """gRPC backend transport for AdGroupSimulationService. - - Service to fetch ad group simulations. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_group_simulation( - self, - ) -> Callable[ - [ad_group_simulation_service.GetAdGroupSimulationRequest], - ad_group_simulation.AdGroupSimulation, - ]: - r"""Return a callable for the get ad group simulation method over gRPC. - - Returns the requested ad group simulation in full - detail. - - Returns: - Callable[[~.GetAdGroupSimulationRequest], - ~.AdGroupSimulation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_group_simulation" not in self._stubs: - self._stubs[ - "get_ad_group_simulation" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupSimulationService/GetAdGroupSimulation", - request_serializer=ad_group_simulation_service.GetAdGroupSimulationRequest.serialize, - response_deserializer=ad_group_simulation.AdGroupSimulation.deserialize, - ) - return self._stubs["get_ad_group_simulation"] - - -__all__ = ("AdGroupSimulationServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_parameter_service/__init__.py b/google/ads/googleads/v6/services/services/ad_parameter_service/__init__.py deleted file mode 100644 index 1dfe9b2d3..000000000 --- a/google/ads/googleads/v6/services/services/ad_parameter_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdParameterServiceClient - -__all__ = ("AdParameterServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_parameter_service/client.py b/google/ads/googleads/v6/services/services/ad_parameter_service/client.py deleted file mode 100644 index 6e6c97eb5..000000000 --- a/google/ads/googleads/v6/services/services/ad_parameter_service/client.py +++ /dev/null @@ -1,560 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_parameter -from google.ads.googleads.v6.services.types import ad_parameter_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import AdParameterServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdParameterServiceGrpcTransport - - -class AdParameterServiceClientMeta(type): - """Metaclass for the AdParameterService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdParameterServiceTransport]] - _transport_registry["grpc"] = AdParameterServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdParameterServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdParameterServiceClient(metaclass=AdParameterServiceClientMeta): - """Service to manage ad parameters.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdParameterServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdParameterServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdParameterServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdParameterServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_parameter_path( - customer_id: str, - ad_group_id: str, - criterion_id: str, - parameter_index: str, - ) -> str: - """Return a fully-qualified ad_parameter string.""" - return "customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - parameter_index=parameter_index, - ) - - @staticmethod - def parse_ad_parameter_path(path: str) -> Dict[str, str]: - """Parse a ad_parameter path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adParameters/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdParameterServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad parameter service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdParameterServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdParameterServiceTransport): - # transport is a AdParameterServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdParameterServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_parameter( - self, - request: ad_parameter_service.GetAdParameterRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_parameter.AdParameter: - r"""Returns the requested ad parameter in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdParameterRequest`): - The request object. Request message for - [AdParameterService.GetAdParameter][google.ads.googleads.v6.services.AdParameterService.GetAdParameter] - resource_name (:class:`str`): - Required. The resource name of the ad - parameter to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdParameter: - An ad parameter that is used to update numeric values (such as prices or - inventory levels) in any text line of an ad - (including URLs). There can be a maximum of two - AdParameters per ad group criterion. (One with - parameter_index = 1 and one with parameter_index = - 2.) In the ad the parameters are referenced by a - placeholder of the form "{param#:value}". E.g. - "{param1:$17}" - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_parameter_service.GetAdParameterRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_parameter_service.GetAdParameterRequest): - request = ad_parameter_service.GetAdParameterRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ad_parameter] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ad_parameters( - self, - request: ad_parameter_service.MutateAdParametersRequest = None, - *, - customer_id: str = None, - operations: Sequence[ad_parameter_service.AdParameterOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_parameter_service.MutateAdParametersResponse: - r"""Creates, updates, or removes ad parameters. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdParametersRequest`): - The request object. Request message for - [AdParameterService.MutateAdParameters][google.ads.googleads.v6.services.AdParameterService.MutateAdParameters] - customer_id (:class:`str`): - Required. The ID of the customer - whose ad parameters are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdParameterOperation]`): - Required. The list of operations to - perform on individual ad parameters. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdParametersResponse: - Response message for an ad parameter - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_parameter_service.MutateAdParametersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_parameter_service.MutateAdParametersRequest - ): - request = ad_parameter_service.MutateAdParametersRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_ad_parameters - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdParameterServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_parameter_service/transports/__init__.py deleted file mode 100644 index 8fb08a762..000000000 --- a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdParameterServiceTransport -from .grpc import AdParameterServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdParameterServiceTransport]] -_transport_registry["grpc"] = AdParameterServiceGrpcTransport - - -__all__ = ( - "AdParameterServiceTransport", - "AdParameterServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_parameter_service/transports/base.py deleted file mode 100644 index b83767bfe..000000000 --- a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_parameter -from google.ads.googleads.v6.services.types import ad_parameter_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdParameterServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdParameterService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_parameter: gapic_v1.method.wrap_method( - self.get_ad_parameter, - default_timeout=None, - client_info=client_info, - ), - self.mutate_ad_parameters: gapic_v1.method.wrap_method( - self.mutate_ad_parameters, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_parameter( - self, - ) -> typing.Callable[ - [ad_parameter_service.GetAdParameterRequest], ad_parameter.AdParameter - ]: - raise NotImplementedError - - @property - def mutate_ad_parameters( - self, - ) -> typing.Callable[ - [ad_parameter_service.MutateAdParametersRequest], - ad_parameter_service.MutateAdParametersResponse, - ]: - raise NotImplementedError - - -__all__ = ("AdParameterServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_parameter_service/transports/grpc.py deleted file mode 100644 index a0a721b69..000000000 --- a/google/ads/googleads/v6/services/services/ad_parameter_service/transports/grpc.py +++ /dev/null @@ -1,273 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_parameter -from google.ads.googleads.v6.services.types import ad_parameter_service - -from .base import AdParameterServiceTransport, DEFAULT_CLIENT_INFO - - -class AdParameterServiceGrpcTransport(AdParameterServiceTransport): - """gRPC backend transport for AdParameterService. - - Service to manage ad parameters. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_parameter( - self, - ) -> Callable[ - [ad_parameter_service.GetAdParameterRequest], ad_parameter.AdParameter - ]: - r"""Return a callable for the get ad parameter method over gRPC. - - Returns the requested ad parameter in full detail. - - Returns: - Callable[[~.GetAdParameterRequest], - ~.AdParameter]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_parameter" not in self._stubs: - self._stubs["get_ad_parameter"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdParameterService/GetAdParameter", - request_serializer=ad_parameter_service.GetAdParameterRequest.serialize, - response_deserializer=ad_parameter.AdParameter.deserialize, - ) - return self._stubs["get_ad_parameter"] - - @property - def mutate_ad_parameters( - self, - ) -> Callable[ - [ad_parameter_service.MutateAdParametersRequest], - ad_parameter_service.MutateAdParametersResponse, - ]: - r"""Return a callable for the mutate ad parameters method over gRPC. - - Creates, updates, or removes ad parameters. Operation - statuses are returned. - - Returns: - Callable[[~.MutateAdParametersRequest], - ~.MutateAdParametersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ad_parameters" not in self._stubs: - self._stubs["mutate_ad_parameters"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdParameterService/MutateAdParameters", - request_serializer=ad_parameter_service.MutateAdParametersRequest.serialize, - response_deserializer=ad_parameter_service.MutateAdParametersResponse.deserialize, - ) - return self._stubs["mutate_ad_parameters"] - - -__all__ = ("AdParameterServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_schedule_view_service/__init__.py b/google/ads/googleads/v6/services/services/ad_schedule_view_service/__init__.py deleted file mode 100644 index 50fb32e3e..000000000 --- a/google/ads/googleads/v6/services/services/ad_schedule_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdScheduleViewServiceClient - -__all__ = ("AdScheduleViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_schedule_view_service/client.py b/google/ads/googleads/v6/services/services/ad_schedule_view_service/client.py deleted file mode 100644 index 469114cbf..000000000 --- a/google/ads/googleads/v6/services/services/ad_schedule_view_service/client.py +++ /dev/null @@ -1,443 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad_schedule_view -from google.ads.googleads.v6.services.types import ad_schedule_view_service - -from .transports.base import AdScheduleViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdScheduleViewServiceGrpcTransport - - -class AdScheduleViewServiceClientMeta(type): - """Metaclass for the AdScheduleViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdScheduleViewServiceTransport]] - _transport_registry["grpc"] = AdScheduleViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdScheduleViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdScheduleViewServiceClient(metaclass=AdScheduleViewServiceClientMeta): - """Service to fetch ad schedule views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdScheduleViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdScheduleViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdScheduleViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdScheduleViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_schedule_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_schedule_view string.""" - return "customers/{customer_id}/adScheduleViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_schedule_view_path(path: str) -> Dict[str, str]: - """Parse a ad_schedule_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adScheduleViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdScheduleViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad schedule view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdScheduleViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdScheduleViewServiceTransport): - # transport is a AdScheduleViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdScheduleViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad_schedule_view( - self, - request: ad_schedule_view_service.GetAdScheduleViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_schedule_view.AdScheduleView: - r"""Returns the requested ad schedule view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdScheduleViewRequest`): - The request object. Request message for - [AdScheduleViewService.GetAdScheduleView][google.ads.googleads.v6.services.AdScheduleViewService.GetAdScheduleView]. - resource_name (:class:`str`): - Required. The resource name of the ad - schedule view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AdScheduleView: - An ad schedule view summarizes the - performance of campaigns by AdSchedule - criteria. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_schedule_view_service.GetAdScheduleViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, ad_schedule_view_service.GetAdScheduleViewRequest - ): - request = ad_schedule_view_service.GetAdScheduleViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_ad_schedule_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdScheduleViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/__init__.py deleted file mode 100644 index 9a12966ff..000000000 --- a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdScheduleViewServiceTransport -from .grpc import AdScheduleViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AdScheduleViewServiceTransport]] -_transport_registry["grpc"] = AdScheduleViewServiceGrpcTransport - - -__all__ = ( - "AdScheduleViewServiceTransport", - "AdScheduleViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/base.py deleted file mode 100644 index d1afd60a3..000000000 --- a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_schedule_view -from google.ads.googleads.v6.services.types import ad_schedule_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdScheduleViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdScheduleViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad_schedule_view: gapic_v1.method.wrap_method( - self.get_ad_schedule_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_ad_schedule_view( - self, - ) -> typing.Callable[ - [ad_schedule_view_service.GetAdScheduleViewRequest], - ad_schedule_view.AdScheduleView, - ]: - raise NotImplementedError - - -__all__ = ("AdScheduleViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/grpc.py deleted file mode 100644 index dd8a086ec..000000000 --- a/google/ads/googleads/v6/services/services/ad_schedule_view_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad_schedule_view -from google.ads.googleads.v6.services.types import ad_schedule_view_service - -from .base import AdScheduleViewServiceTransport, DEFAULT_CLIENT_INFO - - -class AdScheduleViewServiceGrpcTransport(AdScheduleViewServiceTransport): - """gRPC backend transport for AdScheduleViewService. - - Service to fetch ad schedule views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad_schedule_view( - self, - ) -> Callable[ - [ad_schedule_view_service.GetAdScheduleViewRequest], - ad_schedule_view.AdScheduleView, - ]: - r"""Return a callable for the get ad schedule view method over gRPC. - - Returns the requested ad schedule view in full - detail. - - Returns: - Callable[[~.GetAdScheduleViewRequest], - ~.AdScheduleView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad_schedule_view" not in self._stubs: - self._stubs["get_ad_schedule_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdScheduleViewService/GetAdScheduleView", - request_serializer=ad_schedule_view_service.GetAdScheduleViewRequest.serialize, - response_deserializer=ad_schedule_view.AdScheduleView.deserialize, - ) - return self._stubs["get_ad_schedule_view"] - - -__all__ = ("AdScheduleViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_service/__init__.py b/google/ads/googleads/v6/services/services/ad_service/__init__.py deleted file mode 100644 index 2e4c97fc1..000000000 --- a/google/ads/googleads/v6/services/services/ad_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AdServiceClient - -__all__ = ("AdServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_service/client.py b/google/ads/googleads/v6/services/services/ad_service/client.py deleted file mode 100644 index d6ef0be62..000000000 --- a/google/ads/googleads/v6/services/services/ad_service/client.py +++ /dev/null @@ -1,517 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ad -from google.ads.googleads.v6.services.types import ad_service - -from .transports.base import AdServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AdServiceGrpcTransport - - -class AdServiceClientMeta(type): - """Metaclass for the AdService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AdServiceTransport]] - _transport_registry["grpc"] = AdServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AdServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AdServiceClient(metaclass=AdServiceClientMeta): - """Service to manage ads.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AdServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AdServiceTransport: - """Return the transport used by the client instance. - - Returns: - AdServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_path(customer_id: str, ad_id: str,) -> str: - """Return a fully-qualified ad string.""" - return "customers/{customer_id}/ads/{ad_id}".format( - customer_id=customer_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_path(path: str) -> Dict[str, str]: - """Parse a ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ads/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AdServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the ad service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AdServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AdServiceTransport): - # transport is a AdServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AdServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_ad( - self, - request: ad_service.GetAdRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad.Ad: - r"""Returns the requested ad in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAdRequest`): - The request object. Request message for - [AdService.GetAd][google.ads.googleads.v6.services.AdService.GetAd]. - resource_name (:class:`str`): - Required. The resource name of the ad - to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Ad: - An ad. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_service.GetAdRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_service.GetAdRequest): - request = ad_service.GetAdRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ad] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_ads( - self, - request: ad_service.MutateAdsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ad_service.AdOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> ad_service.MutateAdsResponse: - r"""Updates ads. Operation statuses are returned. - Updating ads is not supported for TextAd, - ExpandedDynamicSearchAd, GmailAd and ImageAd. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAdsRequest`): - The request object. Request message for - [AdService.MutateAds][google.ads.googleads.v6.services.AdService.MutateAds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose ads are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AdOperation]`): - Required. The list of operations to - perform on individual ads. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAdsResponse: - Response message for an ad mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a ad_service.MutateAdsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, ad_service.MutateAdsRequest): - request = ad_service.MutateAdsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_ads] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AdServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_service/transports/__init__.py b/google/ads/googleads/v6/services/services/ad_service/transports/__init__.py deleted file mode 100644 index 84698f508..000000000 --- a/google/ads/googleads/v6/services/services/ad_service/transports/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AdServiceTransport -from .grpc import AdServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = OrderedDict() # type: Dict[str, Type[AdServiceTransport]] -_transport_registry["grpc"] = AdServiceGrpcTransport - - -__all__ = ( - "AdServiceTransport", - "AdServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/ad_service/transports/base.py b/google/ads/googleads/v6/services/services/ad_service/transports/base.py deleted file mode 100644 index 73947d73f..000000000 --- a/google/ads/googleads/v6/services/services/ad_service/transports/base.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad -from google.ads.googleads.v6.services.types import ad_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AdServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_ad: gapic_v1.method.wrap_method( - self.get_ad, default_timeout=None, client_info=client_info, - ), - self.mutate_ads: gapic_v1.method.wrap_method( - self.mutate_ads, default_timeout=None, client_info=client_info, - ), - } - - @property - def get_ad(self) -> typing.Callable[[ad_service.GetAdRequest], ad.Ad]: - raise NotImplementedError - - @property - def mutate_ads( - self, - ) -> typing.Callable[ - [ad_service.MutateAdsRequest], ad_service.MutateAdsResponse - ]: - raise NotImplementedError - - -__all__ = ("AdServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_service/transports/grpc.py b/google/ads/googleads/v6/services/services/ad_service/transports/grpc.py deleted file mode 100644 index e919a2d7c..000000000 --- a/google/ads/googleads/v6/services/services/ad_service/transports/grpc.py +++ /dev/null @@ -1,267 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ad -from google.ads.googleads.v6.services.types import ad_service - -from .base import AdServiceTransport, DEFAULT_CLIENT_INFO - - -class AdServiceGrpcTransport(AdServiceTransport): - """gRPC backend transport for AdService. - - Service to manage ads. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_ad(self) -> Callable[[ad_service.GetAdRequest], ad.Ad]: - r"""Return a callable for the get ad method over gRPC. - - Returns the requested ad in full detail. - - Returns: - Callable[[~.GetAdRequest], - ~.Ad]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_ad" not in self._stubs: - self._stubs["get_ad"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdService/GetAd", - request_serializer=ad_service.GetAdRequest.serialize, - response_deserializer=ad.Ad.deserialize, - ) - return self._stubs["get_ad"] - - @property - def mutate_ads( - self, - ) -> Callable[[ad_service.MutateAdsRequest], ad_service.MutateAdsResponse]: - r"""Return a callable for the mutate ads method over gRPC. - - Updates ads. Operation statuses are returned. - Updating ads is not supported for TextAd, - ExpandedDynamicSearchAd, GmailAd and ImageAd. - - Returns: - Callable[[~.MutateAdsRequest], - ~.MutateAdsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_ads" not in self._stubs: - self._stubs["mutate_ads"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdService/MutateAds", - request_serializer=ad_service.MutateAdsRequest.serialize, - response_deserializer=ad_service.MutateAdsResponse.deserialize, - ) - return self._stubs["mutate_ads"] - - -__all__ = ("AdServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/age_range_view_service/__init__.py b/google/ads/googleads/v6/services/services/age_range_view_service/__init__.py deleted file mode 100644 index 6ee5cf0e0..000000000 --- a/google/ads/googleads/v6/services/services/age_range_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AgeRangeViewServiceClient - -__all__ = ("AgeRangeViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/age_range_view_service/client.py b/google/ads/googleads/v6/services/services/age_range_view_service/client.py deleted file mode 100644 index 244c9668e..000000000 --- a/google/ads/googleads/v6/services/services/age_range_view_service/client.py +++ /dev/null @@ -1,439 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import age_range_view -from google.ads.googleads.v6.services.types import age_range_view_service - -from .transports.base import AgeRangeViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AgeRangeViewServiceGrpcTransport - - -class AgeRangeViewServiceClientMeta(type): - """Metaclass for the AgeRangeViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AgeRangeViewServiceTransport]] - _transport_registry["grpc"] = AgeRangeViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AgeRangeViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AgeRangeViewServiceClient(metaclass=AgeRangeViewServiceClientMeta): - """Service to manage age range views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AgeRangeViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AgeRangeViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AgeRangeViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - AgeRangeViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def age_range_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified age_range_view string.""" - return "customers/{customer_id}/ageRangeViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_age_range_view_path(path: str) -> Dict[str, str]: - """Parse a age_range_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ageRangeViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AgeRangeViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the age range view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AgeRangeViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AgeRangeViewServiceTransport): - # transport is a AgeRangeViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AgeRangeViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_age_range_view( - self, - request: age_range_view_service.GetAgeRangeViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> age_range_view.AgeRangeView: - r"""Returns the requested age range view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAgeRangeViewRequest`): - The request object. Request message for - [AgeRangeViewService.GetAgeRangeView][google.ads.googleads.v6.services.AgeRangeViewService.GetAgeRangeView]. - resource_name (:class:`str`): - Required. The resource name of the - age range view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.AgeRangeView: - An age range view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a age_range_view_service.GetAgeRangeViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, age_range_view_service.GetAgeRangeViewRequest - ): - request = age_range_view_service.GetAgeRangeViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_age_range_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AgeRangeViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/age_range_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/age_range_view_service/transports/__init__.py deleted file mode 100644 index 749b63b29..000000000 --- a/google/ads/googleads/v6/services/services/age_range_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AgeRangeViewServiceTransport -from .grpc import AgeRangeViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AgeRangeViewServiceTransport]] -_transport_registry["grpc"] = AgeRangeViewServiceGrpcTransport - - -__all__ = ( - "AgeRangeViewServiceTransport", - "AgeRangeViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/age_range_view_service/transports/base.py b/google/ads/googleads/v6/services/services/age_range_view_service/transports/base.py deleted file mode 100644 index 5ae2d1f64..000000000 --- a/google/ads/googleads/v6/services/services/age_range_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import age_range_view -from google.ads.googleads.v6.services.types import age_range_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AgeRangeViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AgeRangeViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_age_range_view: gapic_v1.method.wrap_method( - self.get_age_range_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_age_range_view( - self, - ) -> typing.Callable[ - [age_range_view_service.GetAgeRangeViewRequest], - age_range_view.AgeRangeView, - ]: - raise NotImplementedError - - -__all__ = ("AgeRangeViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/age_range_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/age_range_view_service/transports/grpc.py deleted file mode 100644 index 858ad3dbf..000000000 --- a/google/ads/googleads/v6/services/services/age_range_view_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import age_range_view -from google.ads.googleads.v6.services.types import age_range_view_service - -from .base import AgeRangeViewServiceTransport, DEFAULT_CLIENT_INFO - - -class AgeRangeViewServiceGrpcTransport(AgeRangeViewServiceTransport): - """gRPC backend transport for AgeRangeViewService. - - Service to manage age range views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_age_range_view( - self, - ) -> Callable[ - [age_range_view_service.GetAgeRangeViewRequest], - age_range_view.AgeRangeView, - ]: - r"""Return a callable for the get age range view method over gRPC. - - Returns the requested age range view in full detail. - - Returns: - Callable[[~.GetAgeRangeViewRequest], - ~.AgeRangeView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_age_range_view" not in self._stubs: - self._stubs["get_age_range_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AgeRangeViewService/GetAgeRangeView", - request_serializer=age_range_view_service.GetAgeRangeViewRequest.serialize, - response_deserializer=age_range_view.AgeRangeView.deserialize, - ) - return self._stubs["get_age_range_view"] - - -__all__ = ("AgeRangeViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/asset_service/__init__.py b/google/ads/googleads/v6/services/services/asset_service/__init__.py deleted file mode 100644 index 24a0b4d39..000000000 --- a/google/ads/googleads/v6/services/services/asset_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import AssetServiceClient - -__all__ = ("AssetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/asset_service/client.py b/google/ads/googleads/v6/services/services/asset_service/client.py deleted file mode 100644 index 447c47da2..000000000 --- a/google/ads/googleads/v6/services/services/asset_service/client.py +++ /dev/null @@ -1,525 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import asset -from google.ads.googleads.v6.services.types import asset_service - -from .transports.base import AssetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import AssetServiceGrpcTransport - - -class AssetServiceClientMeta(type): - """Metaclass for the AssetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[AssetServiceTransport]] - _transport_registry["grpc"] = AssetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[AssetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class AssetServiceClient(metaclass=AssetServiceClientMeta): - """Service to manage assets. Asset types can be created with - AssetService are YoutubeVideoAsset, MediaBundleAsset and - ImageAsset. TextAsset should be created with Ad inline. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AssetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - AssetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> AssetServiceTransport: - """Return the transport used by the client instance. - - Returns: - AssetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, AssetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the asset service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.AssetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, AssetServiceTransport): - # transport is a AssetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = AssetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_asset( - self, - request: asset_service.GetAssetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> asset.Asset: - r"""Returns the requested asset in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetAssetRequest`): - The request object. Request message for - [AssetService.GetAsset][google.ads.googleads.v6.services.AssetService.GetAsset] - resource_name (:class:`str`): - Required. The resource name of the - asset to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Asset: - Asset is a part of an ad which can be - shared across multiple ads. It can be an - image (ImageAsset), a video - (YoutubeVideoAsset), etc. Assets are - immutable and cannot be removed. To stop - an asset from serving, remove the asset - from the entity that is using it. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a asset_service.GetAssetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, asset_service.GetAssetRequest): - request = asset_service.GetAssetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_asset] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_assets( - self, - request: asset_service.MutateAssetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[asset_service.AssetOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> asset_service.MutateAssetsResponse: - r"""Creates assets. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateAssetsRequest`): - The request object. Request message for - [AssetService.MutateAssets][google.ads.googleads.v6.services.AssetService.MutateAssets] - customer_id (:class:`str`): - Required. The ID of the customer - whose assets are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.AssetOperation]`): - Required. The list of operations to - perform on individual assets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateAssetsResponse: - Response message for an asset mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a asset_service.MutateAssetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, asset_service.MutateAssetsRequest): - request = asset_service.MutateAssetsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_assets] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("AssetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/asset_service/transports/__init__.py b/google/ads/googleads/v6/services/services/asset_service/transports/__init__.py deleted file mode 100644 index d7da9e7ed..000000000 --- a/google/ads/googleads/v6/services/services/asset_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import AssetServiceTransport -from .grpc import AssetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[AssetServiceTransport]] -_transport_registry["grpc"] = AssetServiceGrpcTransport - - -__all__ = ( - "AssetServiceTransport", - "AssetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/asset_service/transports/base.py b/google/ads/googleads/v6/services/services/asset_service/transports/base.py deleted file mode 100644 index 2ec7cc600..000000000 --- a/google/ads/googleads/v6/services/services/asset_service/transports/base.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import asset -from google.ads.googleads.v6.services.types import asset_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class AssetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AssetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_asset: gapic_v1.method.wrap_method( - self.get_asset, default_timeout=None, client_info=client_info, - ), - self.mutate_assets: gapic_v1.method.wrap_method( - self.mutate_assets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_asset( - self, - ) -> typing.Callable[[asset_service.GetAssetRequest], asset.Asset]: - raise NotImplementedError - - @property - def mutate_assets( - self, - ) -> typing.Callable[ - [asset_service.MutateAssetsRequest], asset_service.MutateAssetsResponse - ]: - raise NotImplementedError - - -__all__ = ("AssetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/asset_service/transports/grpc.py b/google/ads/googleads/v6/services/services/asset_service/transports/grpc.py deleted file mode 100644 index ebaaf10cc..000000000 --- a/google/ads/googleads/v6/services/services/asset_service/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import asset -from google.ads.googleads.v6.services.types import asset_service - -from .base import AssetServiceTransport, DEFAULT_CLIENT_INFO - - -class AssetServiceGrpcTransport(AssetServiceTransport): - """gRPC backend transport for AssetService. - - Service to manage assets. Asset types can be created with - AssetService are YoutubeVideoAsset, MediaBundleAsset and - ImageAsset. TextAsset should be created with Ad inline. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_asset( - self, - ) -> Callable[[asset_service.GetAssetRequest], asset.Asset]: - r"""Return a callable for the get asset method over gRPC. - - Returns the requested asset in full detail. - - Returns: - Callable[[~.GetAssetRequest], - ~.Asset]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_asset" not in self._stubs: - self._stubs["get_asset"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AssetService/GetAsset", - request_serializer=asset_service.GetAssetRequest.serialize, - response_deserializer=asset.Asset.deserialize, - ) - return self._stubs["get_asset"] - - @property - def mutate_assets( - self, - ) -> Callable[ - [asset_service.MutateAssetsRequest], asset_service.MutateAssetsResponse - ]: - r"""Return a callable for the mutate assets method over gRPC. - - Creates assets. Operation statuses are returned. - - Returns: - Callable[[~.MutateAssetsRequest], - ~.MutateAssetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_assets" not in self._stubs: - self._stubs["mutate_assets"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AssetService/MutateAssets", - request_serializer=asset_service.MutateAssetsRequest.serialize, - response_deserializer=asset_service.MutateAssetsResponse.deserialize, - ) - return self._stubs["mutate_assets"] - - -__all__ = ("AssetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/__init__.py b/google/ads/googleads/v6/services/services/batch_job_service/__init__.py deleted file mode 100644 index 314d818b8..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import BatchJobServiceClient - -__all__ = ("BatchJobServiceClient",) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/client.py b/google/ads/googleads/v6/services/services/batch_job_service/client.py deleted file mode 100644 index 990772069..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/client.py +++ /dev/null @@ -1,1750 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import batch_job -from google.ads.googleads.v6.services.services.batch_job_service import pagers -from google.ads.googleads.v6.services.types import batch_job_service -from google.ads.googleads.v6.services.types import google_ads_service -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore - -from .transports.base import BatchJobServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import BatchJobServiceGrpcTransport - - -class BatchJobServiceClientMeta(type): - """Metaclass for the BatchJobService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[BatchJobServiceTransport]] - _transport_registry["grpc"] = BatchJobServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[BatchJobServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class BatchJobServiceClient(metaclass=BatchJobServiceClientMeta): - """Service to manage batch jobs.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BatchJobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BatchJobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> BatchJobServiceTransport: - """Return the transport used by the client instance. - - Returns: - BatchJobServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_path(customer_id: str, ad_id: str,) -> str: - """Return a fully-qualified ad string.""" - return "customers/{customer_id}/ads/{ad_id}".format( - customer_id=customer_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_path(path: str) -> Dict[str, str]: - """Parse a ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ads/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_label_path( - customer_id: str, ad_group_id: str, ad_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad_label string.""" - return "customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - ad_id=ad_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_ad_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAdLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_bid_modifier_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_bid_modifier string.""" - return "customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a ad_group_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_label_path( - customer_id: str, ad_group_id: str, criterion_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion_label string.""" - return "customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_criterion_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriterionLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_extension_setting_path( - customer_id: str, ad_group_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified ad_group_extension_setting string.""" - return "customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - extension_type=extension_type, - ) - - @staticmethod - def parse_ad_group_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a ad_group_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupExtensionSettings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_feed_path( - customer_id: str, ad_group_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified ad_group_feed string.""" - return "customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, feed_id=feed_id, - ) - - @staticmethod - def parse_ad_group_feed_path(path: str) -> Dict[str, str]: - """Parse a ad_group_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_label_path( - customer_id: str, ad_group_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_label string.""" - return "customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, label_id=label_id, - ) - - @staticmethod - def parse_ad_group_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_parameter_path( - customer_id: str, - ad_group_id: str, - criterion_id: str, - parameter_index: str, - ) -> str: - """Return a fully-qualified ad_parameter string.""" - return "customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - parameter_index=parameter_index, - ) - - @staticmethod - def parse_ad_parameter_path(path: str) -> Dict[str, str]: - """Parse a ad_parameter path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adParameters/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def batch_job_path(customer_id: str, batch_job_id: str,) -> str: - """Return a fully-qualified batch_job string.""" - return "customers/{customer_id}/batchJobs/{batch_job_id}".format( - customer_id=customer_id, batch_job_id=batch_job_id, - ) - - @staticmethod - def parse_batch_job_path(path: str) -> Dict[str, str]: - """Parse a batch_job path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/batchJobs/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def bidding_strategy_path( - customer_id: str, bidding_strategy_id: str, - ) -> str: - """Return a fully-qualified bidding_strategy string.""" - return "customers/{customer_id}/biddingStrategies/{bidding_strategy_id}".format( - customer_id=customer_id, bidding_strategy_id=bidding_strategy_id, - ) - - @staticmethod - def parse_bidding_strategy_path(path: str) -> Dict[str, str]: - """Parse a bidding_strategy path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/biddingStrategies/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_asset_path( - customer_id: str, campaign_id: str, asset_id: str, field_type: str, - ) -> str: - """Return a fully-qualified campaign_asset string.""" - return "customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}".format( - customer_id=customer_id, - campaign_id=campaign_id, - asset_id=asset_id, - field_type=field_type, - ) - - @staticmethod - def parse_campaign_asset_path(path: str) -> Dict[str, str]: - """Parse a campaign_asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignAssets/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_bid_modifier_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_bid_modifier string.""" - return "customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a campaign_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_budget_path(customer_id: str, campaign_budget_id: str,) -> str: - """Return a fully-qualified campaign_budget string.""" - return "customers/{customer_id}/campaignBudgets/{campaign_budget_id}".format( - customer_id=customer_id, campaign_budget_id=campaign_budget_id, - ) - - @staticmethod - def parse_campaign_budget_path(path: str) -> Dict[str, str]: - """Parse a campaign_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_criterion_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_criterion string.""" - return "customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_criterion_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_draft_path( - customer_id: str, base_campaign_id: str, draft_id: str, - ) -> str: - """Return a fully-qualified campaign_draft string.""" - return "customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}".format( - customer_id=customer_id, - base_campaign_id=base_campaign_id, - draft_id=draft_id, - ) - - @staticmethod - def parse_campaign_draft_path(path: str) -> Dict[str, str]: - """Parse a campaign_draft path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignDrafts/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_experiment_path( - customer_id: str, campaign_experiment_id: str, - ) -> str: - """Return a fully-qualified campaign_experiment string.""" - return "customers/{customer_id}/campaignExperiments/{campaign_experiment_id}".format( - customer_id=customer_id, - campaign_experiment_id=campaign_experiment_id, - ) - - @staticmethod - def parse_campaign_experiment_path(path: str) -> Dict[str, str]: - """Parse a campaign_experiment path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignExperiments/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_extension_setting_path( - customer_id: str, campaign_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified campaign_extension_setting string.""" - return "customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}".format( - customer_id=customer_id, - campaign_id=campaign_id, - extension_type=extension_type, - ) - - @staticmethod - def parse_campaign_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a campaign_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignExtensionSettings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_feed_path( - customer_id: str, campaign_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified campaign_feed string.""" - return "customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}".format( - customer_id=customer_id, campaign_id=campaign_id, feed_id=feed_id, - ) - - @staticmethod - def parse_campaign_feed_path(path: str) -> Dict[str, str]: - """Parse a campaign_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_label_path( - customer_id: str, campaign_id: str, label_id: str, - ) -> str: - """Return a fully-qualified campaign_label string.""" - return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format( - customer_id=customer_id, campaign_id=campaign_id, label_id=label_id, - ) - - @staticmethod - def parse_campaign_label_path(path: str) -> Dict[str, str]: - """Parse a campaign_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_shared_set_path( - customer_id: str, campaign_id: str, shared_set_id: str, - ) -> str: - """Return a fully-qualified campaign_shared_set string.""" - return "customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_campaign_shared_set_path(path: str) -> Dict[str, str]: - """Parse a campaign_shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignSharedSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def conversion_action_path( - customer_id: str, conversion_action_id: str, - ) -> str: - """Return a fully-qualified conversion_action string.""" - return "customers/{customer_id}/conversionActions/{conversion_action_id}".format( - customer_id=customer_id, conversion_action_id=conversion_action_id, - ) - - @staticmethod - def parse_conversion_action_path(path: str) -> Dict[str, str]: - """Parse a conversion_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/conversionActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_extension_setting_path( - customer_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified customer_extension_setting string.""" - return "customers/{customer_id}/customerExtensionSettings/{extension_type}".format( - customer_id=customer_id, extension_type=extension_type, - ) - - @staticmethod - def parse_customer_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a customer_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerExtensionSettings/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified customer_feed string.""" - return "customers/{customer_id}/customerFeeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_customer_feed_path(path: str) -> Dict[str, str]: - """Parse a customer_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerFeeds/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified customer_label string.""" - return "customers/{customer_id}/customerLabels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_customer_label_path(path: str) -> Dict[str, str]: - """Parse a customer_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerLabels/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_negative_criterion_path( - customer_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified customer_negative_criterion string.""" - return "customers/{customer_id}/customerNegativeCriteria/{criterion_id}".format( - customer_id=customer_id, criterion_id=criterion_id, - ) - - @staticmethod - def parse_customer_negative_criterion_path(path: str) -> Dict[str, str]: - """Parse a customer_negative_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerNegativeCriteria/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_path( - customer_id: str, feed_id: str, feed_item_set_id: str, - ) -> str: - """Return a fully-qualified feed_item_set string.""" - return "customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - ) - - @staticmethod - def parse_feed_item_set_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_link_path( - customer_id: str, - feed_id: str, - feed_item_set_id: str, - feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item_set_link string.""" - return "customers/{customer_id}/feedItemSetLinks/{feed_id}~{feed_item_set_id}~{feed_item_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_set_link_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSetLinks/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_target_path( - customer_id: str, - feed_id: str, - feed_item_id: str, - feed_item_target_type: str, - feed_item_target_id: str, - ) -> str: - """Return a fully-qualified feed_item_target string.""" - return "customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_id=feed_item_id, - feed_item_target_type=feed_item_target_type, - feed_item_target_id=feed_item_target_id, - ) - - @staticmethod - def parse_feed_item_target_path(path: str) -> Dict[str, str]: - """Parse a feed_item_target path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemTargets/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_mapping_path( - customer_id: str, feed_id: str, feed_mapping_id: str, - ) -> str: - """Return a fully-qualified feed_mapping string.""" - return "customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_mapping_id=feed_mapping_id, - ) - - @staticmethod - def parse_feed_mapping_path(path: str) -> Dict[str, str]: - """Parse a feed_mapping path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedMappings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_path(customer_id: str, keyword_plan_id: str,) -> str: - """Return a fully-qualified keyword_plan string.""" - return "customers/{customer_id}/keywordPlans/{keyword_plan_id}".format( - customer_id=customer_id, keyword_plan_id=keyword_plan_id, - ) - - @staticmethod - def parse_keyword_plan_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlans/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_ad_group_path( - customer_id: str, keyword_plan_ad_group_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group string.""" - return "customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_id=keyword_plan_ad_group_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_ad_group_keyword_path( - customer_id: str, keyword_plan_ad_group_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group_keyword string.""" - return "customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_keyword_id=keyword_plan_ad_group_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroupKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_path( - customer_id: str, keyword_plan_campaign_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign string.""" - return "customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}".format( - customer_id=customer_id, - keyword_plan_campaign_id=keyword_plan_campaign_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_keyword_path( - customer_id: str, keyword_plan_campaign_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign_keyword string.""" - return "customers/{customer_id}/keywordPlanCampaignKeywords/{keyword_plan_campaign_keyword_id}".format( - customer_id=customer_id, - keyword_plan_campaign_keyword_id=keyword_plan_campaign_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaignKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def language_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified language_constant string.""" - return "languageConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_language_constant_path(path: str) -> Dict[str, str]: - """Parse a language_constant path into its component segments.""" - m = re.match(r"^languageConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def media_file_path(customer_id: str, media_file_id: str,) -> str: - """Return a fully-qualified media_file string.""" - return "customers/{customer_id}/mediaFiles/{media_file_id}".format( - customer_id=customer_id, media_file_id=media_file_id, - ) - - @staticmethod - def parse_media_file_path(path: str) -> Dict[str, str]: - """Parse a media_file path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/mediaFiles/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def remarketing_action_path( - customer_id: str, remarketing_action_id: str, - ) -> str: - """Return a fully-qualified remarketing_action string.""" - return "customers/{customer_id}/remarketingActions/{remarketing_action_id}".format( - customer_id=customer_id, - remarketing_action_id=remarketing_action_id, - ) - - @staticmethod - def parse_remarketing_action_path(path: str) -> Dict[str, str]: - """Parse a remarketing_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/remarketingActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shared_criterion_path( - customer_id: str, shared_set_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified shared_criterion string.""" - return "customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}".format( - customer_id=customer_id, - shared_set_id=shared_set_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_shared_criterion_path(path: str) -> Dict[str, str]: - """Parse a shared_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shared_set_path(customer_id: str, shared_set_id: str,) -> str: - """Return a fully-qualified shared_set string.""" - return "customers/{customer_id}/sharedSets/{shared_set_id}".format( - customer_id=customer_id, shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_shared_set_path(path: str) -> Dict[str, str]: - """Parse a shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedSets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def user_list_path(customer_id: str, user_list_id: str,) -> str: - """Return a fully-qualified user_list string.""" - return "customers/{customer_id}/userLists/{user_list_id}".format( - customer_id=customer_id, user_list_id=user_list_id, - ) - - @staticmethod - def parse_user_list_path(path: str) -> Dict[str, str]: - """Parse a user_list path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLists/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, BatchJobServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the batch job service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.BatchJobServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, BatchJobServiceTransport): - # transport is a BatchJobServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = BatchJobServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def mutate_batch_job( - self, - request: batch_job_service.MutateBatchJobRequest = None, - *, - customer_id: str = None, - operation: batch_job_service.BatchJobOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> batch_job_service.MutateBatchJobResponse: - r"""Mutates a batch job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateBatchJobRequest`): - The request object. Request message for - [BatchJobService.MutateBatchJob][google.ads.googleads.v6.services.BatchJobService.MutateBatchJob]. - customer_id (:class:`str`): - Required. The ID of the customer for - which to create a batch job. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.BatchJobOperation`): - Required. The operation to perform on - an individual batch job. - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateBatchJobResponse: - Response message for - [BatchJobService.MutateBatchJob][google.ads.googleads.v6.services.BatchJobService.MutateBatchJob]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a batch_job_service.MutateBatchJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, batch_job_service.MutateBatchJobRequest): - request = batch_job_service.MutateBatchJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_batch_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def get_batch_job( - self, - request: batch_job_service.GetBatchJobRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> batch_job.BatchJob: - r"""Returns the batch job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetBatchJobRequest`): - The request object. Request message for - [BatchJobService.GetBatchJob][google.ads.googleads.v6.services.BatchJobService.GetBatchJob]. - resource_name (:class:`str`): - Required. The resource name of the - batch job to get. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.BatchJob: - A list of mutates being processed - asynchronously. The mutates are uploaded - by the user. The mutates themselves - aren't readable and the results of the - job can only be read using - BatchJobService.ListBatchJobResults. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a batch_job_service.GetBatchJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, batch_job_service.GetBatchJobRequest): - request = batch_job_service.GetBatchJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_batch_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def list_batch_job_results( - self, - request: batch_job_service.ListBatchJobResultsRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListBatchJobResultsPager: - r"""Returns the results of the batch job. The job must be - done. Supports standard list paging. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListBatchJobResultsRequest`): - The request object. Request message for - [BatchJobService.ListBatchJobResults][google.ads.googleads.v6.services.BatchJobService.ListBatchJobResults]. - resource_name (:class:`str`): - Required. The resource name of the - batch job whose results are being - listed. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.batch_job_service.pagers.ListBatchJobResultsPager: - Response message for - [BatchJobService.ListBatchJobResults][google.ads.googleads.v6.services.BatchJobService.ListBatchJobResults]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a batch_job_service.ListBatchJobResultsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, batch_job_service.ListBatchJobResultsRequest - ): - request = batch_job_service.ListBatchJobResultsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_batch_job_results - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListBatchJobResultsPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - def run_batch_job( - self, - request: batch_job_service.RunBatchJobRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Runs the batch job. - The Operation.metadata field type is BatchJobMetadata. - When finished, the long running operation will not - contain errors or a response. Instead, use - ListBatchJobResults to get the results of the job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.RunBatchJobRequest`): - The request object. Request message for - [BatchJobService.RunBatchJob][google.ads.googleads.v6.services.BatchJobService.RunBatchJob]. - resource_name (:class:`str`): - Required. The resource name of the - BatchJob to run. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - The JSON representation for Empty is empty JSON - object {}. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a batch_job_service.RunBatchJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, batch_job_service.RunBatchJobRequest): - request = batch_job_service.RunBatchJobRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.run_batch_job] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty.Empty, - metadata_type=batch_job.BatchJob.BatchJobMetadata, - ) - - # Done; return the response. - return response - - def add_batch_job_operations( - self, - request: batch_job_service.AddBatchJobOperationsRequest = None, - *, - resource_name: str = None, - sequence_token: str = None, - mutate_operations: Sequence[google_ads_service.MutateOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> batch_job_service.AddBatchJobOperationsResponse: - r"""Add operations to the batch job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.AddBatchJobOperationsRequest`): - The request object. Request message for - [BatchJobService.AddBatchJobOperations][google.ads.googleads.v6.services.BatchJobService.AddBatchJobOperations]. - resource_name (:class:`str`): - Required. The resource name of the - batch job. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - sequence_token (:class:`str`): - A token used to enforce sequencing. - - The first AddBatchJobOperations request for a batch job - should not set sequence_token. Subsequent requests must - set sequence_token to the value of next_sequence_token - received in the previous AddBatchJobOperations response. - - This corresponds to the ``sequence_token`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - mutate_operations (:class:`Sequence[google.ads.googleads.v6.services.types.MutateOperation]`): - Required. The list of mutates being - added. - Operations can use negative integers as - temp ids to signify dependencies between - entities created in this batch job. For - example, a customer with id = 1234 can - create a campaign and an ad group in - that same campaign by creating a - campaign in the first operation with the - resource name explicitly set to - "customers/1234/campaigns/-1", and - creating an ad group in the second - operation with the campaign field also - set to "customers/1234/campaigns/-1". - - This corresponds to the ``mutate_operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.AddBatchJobOperationsResponse: - Response message for - [BatchJobService.AddBatchJobOperations][google.ads.googleads.v6.services.BatchJobService.AddBatchJobOperations]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [resource_name, sequence_token, mutate_operations] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a batch_job_service.AddBatchJobOperationsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, batch_job_service.AddBatchJobOperationsRequest - ): - request = batch_job_service.AddBatchJobOperationsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - if sequence_token is not None: - request.sequence_token = sequence_token - if mutate_operations is not None: - request.mutate_operations = mutate_operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.add_batch_job_operations - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("BatchJobServiceClient",) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/pagers.py b/google/ads/googleads/v6/services/services/batch_job_service/pagers.py deleted file mode 100644 index 541fa6434..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/pagers.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.services.types import batch_job_service - - -class ListBatchJobResultsPager: - """A pager for iterating through ``list_batch_job_results`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.ListBatchJobResultsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``results`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListBatchJobResults`` requests and continue to iterate - through the ``results`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.ListBatchJobResultsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., batch_job_service.ListBatchJobResultsResponse], - request: batch_job_service.ListBatchJobResultsRequest, - response: batch_job_service.ListBatchJobResultsResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.ListBatchJobResultsRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.ListBatchJobResultsResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = batch_job_service.ListBatchJobResultsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterable[batch_job_service.ListBatchJobResultsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__(self) -> Iterable[batch_job_service.BatchJobResult]: - for page in self.pages: - yield from page.results - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/transports/__init__.py b/google/ads/googleads/v6/services/services/batch_job_service/transports/__init__.py deleted file mode 100644 index 775c7bd72..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import BatchJobServiceTransport -from .grpc import BatchJobServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[BatchJobServiceTransport]] -_transport_registry["grpc"] = BatchJobServiceGrpcTransport - - -__all__ = ( - "BatchJobServiceTransport", - "BatchJobServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/transports/base.py b/google/ads/googleads/v6/services/services/batch_job_service/transports/base.py deleted file mode 100644 index 4f0a78fc3..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/transports/base.py +++ /dev/null @@ -1,163 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import batch_job -from google.ads.googleads.v6.services.types import batch_job_service -from google.longrunning import operations_pb2 as operations # type: ignore - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class BatchJobServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for BatchJobService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.mutate_batch_job: gapic_v1.method.wrap_method( - self.mutate_batch_job, - default_timeout=None, - client_info=client_info, - ), - self.get_batch_job: gapic_v1.method.wrap_method( - self.get_batch_job, - default_timeout=None, - client_info=client_info, - ), - self.list_batch_job_results: gapic_v1.method.wrap_method( - self.list_batch_job_results, - default_timeout=None, - client_info=client_info, - ), - self.run_batch_job: gapic_v1.method.wrap_method( - self.run_batch_job, - default_timeout=None, - client_info=client_info, - ), - self.add_batch_job_operations: gapic_v1.method.wrap_method( - self.add_batch_job_operations, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Return the client designed to process long-running operations.""" - raise NotImplementedError - - @property - def mutate_batch_job( - self, - ) -> typing.Callable[ - [batch_job_service.MutateBatchJobRequest], - batch_job_service.MutateBatchJobResponse, - ]: - raise NotImplementedError - - @property - def get_batch_job( - self, - ) -> typing.Callable[ - [batch_job_service.GetBatchJobRequest], batch_job.BatchJob - ]: - raise NotImplementedError - - @property - def list_batch_job_results( - self, - ) -> typing.Callable[ - [batch_job_service.ListBatchJobResultsRequest], - batch_job_service.ListBatchJobResultsResponse, - ]: - raise NotImplementedError - - @property - def run_batch_job( - self, - ) -> typing.Callable[ - [batch_job_service.RunBatchJobRequest], operations.Operation - ]: - raise NotImplementedError - - @property - def add_batch_job_operations( - self, - ) -> typing.Callable[ - [batch_job_service.AddBatchJobOperationsRequest], - batch_job_service.AddBatchJobOperationsResponse, - ]: - raise NotImplementedError - - -__all__ = ("BatchJobServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/batch_job_service/transports/grpc.py b/google/ads/googleads/v6/services/services/batch_job_service/transports/grpc.py deleted file mode 100644 index 53d598718..000000000 --- a/google/ads/googleads/v6/services/services/batch_job_service/transports/grpc.py +++ /dev/null @@ -1,381 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import batch_job -from google.ads.googleads.v6.services.types import batch_job_service -from google.longrunning import operations_pb2 as operations # type: ignore - -from .base import BatchJobServiceTransport, DEFAULT_CLIENT_INFO - - -class BatchJobServiceGrpcTransport(BatchJobServiceTransport): - """gRPC backend transport for BatchJobService. - - Service to manage batch jobs. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Sanity check: Only create a new client if we do not already have one. - if "operations_client" not in self.__dict__: - self.__dict__["operations_client"] = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self.__dict__["operations_client"] - - @property - def mutate_batch_job( - self, - ) -> Callable[ - [batch_job_service.MutateBatchJobRequest], - batch_job_service.MutateBatchJobResponse, - ]: - r"""Return a callable for the mutate batch job method over gRPC. - - Mutates a batch job. - - Returns: - Callable[[~.MutateBatchJobRequest], - ~.MutateBatchJobResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_batch_job" not in self._stubs: - self._stubs["mutate_batch_job"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BatchJobService/MutateBatchJob", - request_serializer=batch_job_service.MutateBatchJobRequest.serialize, - response_deserializer=batch_job_service.MutateBatchJobResponse.deserialize, - ) - return self._stubs["mutate_batch_job"] - - @property - def get_batch_job( - self, - ) -> Callable[[batch_job_service.GetBatchJobRequest], batch_job.BatchJob]: - r"""Return a callable for the get batch job method over gRPC. - - Returns the batch job. - - Returns: - Callable[[~.GetBatchJobRequest], - ~.BatchJob]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_batch_job" not in self._stubs: - self._stubs["get_batch_job"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BatchJobService/GetBatchJob", - request_serializer=batch_job_service.GetBatchJobRequest.serialize, - response_deserializer=batch_job.BatchJob.deserialize, - ) - return self._stubs["get_batch_job"] - - @property - def list_batch_job_results( - self, - ) -> Callable[ - [batch_job_service.ListBatchJobResultsRequest], - batch_job_service.ListBatchJobResultsResponse, - ]: - r"""Return a callable for the list batch job results method over gRPC. - - Returns the results of the batch job. The job must be - done. Supports standard list paging. - - Returns: - Callable[[~.ListBatchJobResultsRequest], - ~.ListBatchJobResultsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_batch_job_results" not in self._stubs: - self._stubs[ - "list_batch_job_results" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BatchJobService/ListBatchJobResults", - request_serializer=batch_job_service.ListBatchJobResultsRequest.serialize, - response_deserializer=batch_job_service.ListBatchJobResultsResponse.deserialize, - ) - return self._stubs["list_batch_job_results"] - - @property - def run_batch_job( - self, - ) -> Callable[[batch_job_service.RunBatchJobRequest], operations.Operation]: - r"""Return a callable for the run batch job method over gRPC. - - Runs the batch job. - The Operation.metadata field type is BatchJobMetadata. - When finished, the long running operation will not - contain errors or a response. Instead, use - ListBatchJobResults to get the results of the job. - - Returns: - Callable[[~.RunBatchJobRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "run_batch_job" not in self._stubs: - self._stubs["run_batch_job"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BatchJobService/RunBatchJob", - request_serializer=batch_job_service.RunBatchJobRequest.serialize, - response_deserializer=operations.Operation.FromString, - ) - return self._stubs["run_batch_job"] - - @property - def add_batch_job_operations( - self, - ) -> Callable[ - [batch_job_service.AddBatchJobOperationsRequest], - batch_job_service.AddBatchJobOperationsResponse, - ]: - r"""Return a callable for the add batch job operations method over gRPC. - - Add operations to the batch job. - - Returns: - Callable[[~.AddBatchJobOperationsRequest], - ~.AddBatchJobOperationsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "add_batch_job_operations" not in self._stubs: - self._stubs[ - "add_batch_job_operations" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BatchJobService/AddBatchJobOperations", - request_serializer=batch_job_service.AddBatchJobOperationsRequest.serialize, - response_deserializer=batch_job_service.AddBatchJobOperationsResponse.deserialize, - ) - return self._stubs["add_batch_job_operations"] - - -__all__ = ("BatchJobServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/bidding_strategy_service/__init__.py b/google/ads/googleads/v6/services/services/bidding_strategy_service/__init__.py deleted file mode 100644 index eaf6a6f2e..000000000 --- a/google/ads/googleads/v6/services/services/bidding_strategy_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import BiddingStrategyServiceClient - -__all__ = ("BiddingStrategyServiceClient",) diff --git a/google/ads/googleads/v6/services/services/bidding_strategy_service/client.py b/google/ads/googleads/v6/services/services/bidding_strategy_service/client.py deleted file mode 100644 index 599739026..000000000 --- a/google/ads/googleads/v6/services/services/bidding_strategy_service/client.py +++ /dev/null @@ -1,542 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import bidding_strategy -from google.ads.googleads.v6.services.types import bidding_strategy_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - BiddingStrategyServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import BiddingStrategyServiceGrpcTransport - - -class BiddingStrategyServiceClientMeta(type): - """Metaclass for the BiddingStrategyService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[BiddingStrategyServiceTransport]] - _transport_registry["grpc"] = BiddingStrategyServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[BiddingStrategyServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class BiddingStrategyServiceClient(metaclass=BiddingStrategyServiceClientMeta): - """Service to manage bidding strategies.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BiddingStrategyServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BiddingStrategyServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> BiddingStrategyServiceTransport: - """Return the transport used by the client instance. - - Returns: - BiddingStrategyServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def bidding_strategy_path( - customer_id: str, bidding_strategy_id: str, - ) -> str: - """Return a fully-qualified bidding_strategy string.""" - return "customers/{customer_id}/biddingStrategies/{bidding_strategy_id}".format( - customer_id=customer_id, bidding_strategy_id=bidding_strategy_id, - ) - - @staticmethod - def parse_bidding_strategy_path(path: str) -> Dict[str, str]: - """Parse a bidding_strategy path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/biddingStrategies/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, BiddingStrategyServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the bidding strategy service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.BiddingStrategyServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, BiddingStrategyServiceTransport): - # transport is a BiddingStrategyServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = BiddingStrategyServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_bidding_strategy( - self, - request: bidding_strategy_service.GetBiddingStrategyRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> bidding_strategy.BiddingStrategy: - r"""Returns the requested bidding strategy in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetBiddingStrategyRequest`): - The request object. Request message for - [BiddingStrategyService.GetBiddingStrategy][google.ads.googleads.v6.services.BiddingStrategyService.GetBiddingStrategy]. - resource_name (:class:`str`): - Required. The resource name of the - bidding strategy to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.BiddingStrategy: - A bidding strategy. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a bidding_strategy_service.GetBiddingStrategyRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, bidding_strategy_service.GetBiddingStrategyRequest - ): - request = bidding_strategy_service.GetBiddingStrategyRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_bidding_strategy - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_bidding_strategies( - self, - request: bidding_strategy_service.MutateBiddingStrategiesRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - bidding_strategy_service.BiddingStrategyOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> bidding_strategy_service.MutateBiddingStrategiesResponse: - r"""Creates, updates, or removes bidding strategies. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateBiddingStrategiesRequest`): - The request object. Request message for - [BiddingStrategyService.MutateBiddingStrategies][google.ads.googleads.v6.services.BiddingStrategyService.MutateBiddingStrategies]. - customer_id (:class:`str`): - Required. The ID of the customer - whose bidding strategies are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.BiddingStrategyOperation]`): - Required. The list of operations to - perform on individual bidding - strategies. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateBiddingStrategiesResponse: - Response message for bidding strategy - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a bidding_strategy_service.MutateBiddingStrategiesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, bidding_strategy_service.MutateBiddingStrategiesRequest - ): - request = bidding_strategy_service.MutateBiddingStrategiesRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_bidding_strategies - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("BiddingStrategyServiceClient",) diff --git a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/__init__.py b/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/__init__.py deleted file mode 100644 index d6b5e80e4..000000000 --- a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import BiddingStrategyServiceTransport -from .grpc import BiddingStrategyServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[BiddingStrategyServiceTransport]] -_transport_registry["grpc"] = BiddingStrategyServiceGrpcTransport - - -__all__ = ( - "BiddingStrategyServiceTransport", - "BiddingStrategyServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/base.py b/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/base.py deleted file mode 100644 index 22c3f59a3..000000000 --- a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import bidding_strategy -from google.ads.googleads.v6.services.types import bidding_strategy_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class BiddingStrategyServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for BiddingStrategyService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_bidding_strategy: gapic_v1.method.wrap_method( - self.get_bidding_strategy, - default_timeout=None, - client_info=client_info, - ), - self.mutate_bidding_strategies: gapic_v1.method.wrap_method( - self.mutate_bidding_strategies, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_bidding_strategy( - self, - ) -> typing.Callable[ - [bidding_strategy_service.GetBiddingStrategyRequest], - bidding_strategy.BiddingStrategy, - ]: - raise NotImplementedError - - @property - def mutate_bidding_strategies( - self, - ) -> typing.Callable[ - [bidding_strategy_service.MutateBiddingStrategiesRequest], - bidding_strategy_service.MutateBiddingStrategiesResponse, - ]: - raise NotImplementedError - - -__all__ = ("BiddingStrategyServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/grpc.py b/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/grpc.py deleted file mode 100644 index be297a84d..000000000 --- a/google/ads/googleads/v6/services/services/bidding_strategy_service/transports/grpc.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import bidding_strategy -from google.ads.googleads.v6.services.types import bidding_strategy_service - -from .base import BiddingStrategyServiceTransport, DEFAULT_CLIENT_INFO - - -class BiddingStrategyServiceGrpcTransport(BiddingStrategyServiceTransport): - """gRPC backend transport for BiddingStrategyService. - - Service to manage bidding strategies. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_bidding_strategy( - self, - ) -> Callable[ - [bidding_strategy_service.GetBiddingStrategyRequest], - bidding_strategy.BiddingStrategy, - ]: - r"""Return a callable for the get bidding strategy method over gRPC. - - Returns the requested bidding strategy in full - detail. - - Returns: - Callable[[~.GetBiddingStrategyRequest], - ~.BiddingStrategy]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_bidding_strategy" not in self._stubs: - self._stubs["get_bidding_strategy"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BiddingStrategyService/GetBiddingStrategy", - request_serializer=bidding_strategy_service.GetBiddingStrategyRequest.serialize, - response_deserializer=bidding_strategy.BiddingStrategy.deserialize, - ) - return self._stubs["get_bidding_strategy"] - - @property - def mutate_bidding_strategies( - self, - ) -> Callable[ - [bidding_strategy_service.MutateBiddingStrategiesRequest], - bidding_strategy_service.MutateBiddingStrategiesResponse, - ]: - r"""Return a callable for the mutate bidding strategies method over gRPC. - - Creates, updates, or removes bidding strategies. - Operation statuses are returned. - - Returns: - Callable[[~.MutateBiddingStrategiesRequest], - ~.MutateBiddingStrategiesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_bidding_strategies" not in self._stubs: - self._stubs[ - "mutate_bidding_strategies" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BiddingStrategyService/MutateBiddingStrategies", - request_serializer=bidding_strategy_service.MutateBiddingStrategiesRequest.serialize, - response_deserializer=bidding_strategy_service.MutateBiddingStrategiesResponse.deserialize, - ) - return self._stubs["mutate_bidding_strategies"] - - -__all__ = ("BiddingStrategyServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/billing_setup_service/__init__.py b/google/ads/googleads/v6/services/services/billing_setup_service/__init__.py deleted file mode 100644 index 5557226d4..000000000 --- a/google/ads/googleads/v6/services/services/billing_setup_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import BillingSetupServiceClient - -__all__ = ("BillingSetupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/billing_setup_service/client.py b/google/ads/googleads/v6/services/services/billing_setup_service/client.py deleted file mode 100644 index aaa0bea23..000000000 --- a/google/ads/googleads/v6/services/services/billing_setup_service/client.py +++ /dev/null @@ -1,557 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import billing_setup -from google.ads.googleads.v6.services.types import billing_setup_service - -from .transports.base import BillingSetupServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import BillingSetupServiceGrpcTransport - - -class BillingSetupServiceClientMeta(type): - """Metaclass for the BillingSetupService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[BillingSetupServiceTransport]] - _transport_registry["grpc"] = BillingSetupServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[BillingSetupServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class BillingSetupServiceClient(metaclass=BillingSetupServiceClientMeta): - """A service for designating the business entity responsible for - accrued costs. - A billing setup is associated with a payments account. Billing- - related activity for all billing setups associated with a - particular payments account will appear on a single invoice - generated monthly. - - Mutates: - The REMOVE operation cancels a pending billing setup. The CREATE - operation creates a new billing setup. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BillingSetupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - BillingSetupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> BillingSetupServiceTransport: - """Return the transport used by the client instance. - - Returns: - BillingSetupServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def billing_setup_path(customer_id: str, billing_setup_id: str,) -> str: - """Return a fully-qualified billing_setup string.""" - return "customers/{customer_id}/billingSetups/{billing_setup_id}".format( - customer_id=customer_id, billing_setup_id=billing_setup_id, - ) - - @staticmethod - def parse_billing_setup_path(path: str) -> Dict[str, str]: - """Parse a billing_setup path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/billingSetups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def payments_account_path( - customer_id: str, payments_account_id: str, - ) -> str: - """Return a fully-qualified payments_account string.""" - return "customers/{customer_id}/paymentsAccounts/{payments_account_id}".format( - customer_id=customer_id, payments_account_id=payments_account_id, - ) - - @staticmethod - def parse_payments_account_path(path: str) -> Dict[str, str]: - """Parse a payments_account path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/paymentsAccounts/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, BillingSetupServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the billing setup service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.BillingSetupServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, BillingSetupServiceTransport): - # transport is a BillingSetupServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = BillingSetupServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_billing_setup( - self, - request: billing_setup_service.GetBillingSetupRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> billing_setup.BillingSetup: - r"""Returns a billing setup. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetBillingSetupRequest`): - The request object. Request message for - [BillingSetupService.GetBillingSetup][google.ads.googleads.v6.services.BillingSetupService.GetBillingSetup]. - resource_name (:class:`str`): - Required. The resource name of the - billing setup to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.BillingSetup: - A billing setup, which associates a - payments account and an advertiser. A - billing setup is specific to one - advertiser. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a billing_setup_service.GetBillingSetupRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, billing_setup_service.GetBillingSetupRequest - ): - request = billing_setup_service.GetBillingSetupRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_billing_setup - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_billing_setup( - self, - request: billing_setup_service.MutateBillingSetupRequest = None, - *, - customer_id: str = None, - operation: billing_setup_service.BillingSetupOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> billing_setup_service.MutateBillingSetupResponse: - r"""Creates a billing setup, or cancels an existing - billing setup. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateBillingSetupRequest`): - The request object. Request message for billing setup - mutate operations. - customer_id (:class:`str`): - Required. Id of the customer to apply - the billing setup mutate operation to. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.BillingSetupOperation`): - Required. The operation to perform. - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateBillingSetupResponse: - Response message for a billing setup - operation. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a billing_setup_service.MutateBillingSetupRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, billing_setup_service.MutateBillingSetupRequest - ): - request = billing_setup_service.MutateBillingSetupRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_billing_setup - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("BillingSetupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/billing_setup_service/transports/__init__.py b/google/ads/googleads/v6/services/services/billing_setup_service/transports/__init__.py deleted file mode 100644 index 6601c05d3..000000000 --- a/google/ads/googleads/v6/services/services/billing_setup_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import BillingSetupServiceTransport -from .grpc import BillingSetupServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[BillingSetupServiceTransport]] -_transport_registry["grpc"] = BillingSetupServiceGrpcTransport - - -__all__ = ( - "BillingSetupServiceTransport", - "BillingSetupServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/billing_setup_service/transports/base.py b/google/ads/googleads/v6/services/services/billing_setup_service/transports/base.py deleted file mode 100644 index 7c2b0ec6d..000000000 --- a/google/ads/googleads/v6/services/services/billing_setup_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import billing_setup -from google.ads.googleads.v6.services.types import billing_setup_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class BillingSetupServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for BillingSetupService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_billing_setup: gapic_v1.method.wrap_method( - self.get_billing_setup, - default_timeout=None, - client_info=client_info, - ), - self.mutate_billing_setup: gapic_v1.method.wrap_method( - self.mutate_billing_setup, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_billing_setup( - self, - ) -> typing.Callable[ - [billing_setup_service.GetBillingSetupRequest], - billing_setup.BillingSetup, - ]: - raise NotImplementedError - - @property - def mutate_billing_setup( - self, - ) -> typing.Callable[ - [billing_setup_service.MutateBillingSetupRequest], - billing_setup_service.MutateBillingSetupResponse, - ]: - raise NotImplementedError - - -__all__ = ("BillingSetupServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/billing_setup_service/transports/grpc.py b/google/ads/googleads/v6/services/services/billing_setup_service/transports/grpc.py deleted file mode 100644 index d3de6aaf5..000000000 --- a/google/ads/googleads/v6/services/services/billing_setup_service/transports/grpc.py +++ /dev/null @@ -1,283 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import billing_setup -from google.ads.googleads.v6.services.types import billing_setup_service - -from .base import BillingSetupServiceTransport, DEFAULT_CLIENT_INFO - - -class BillingSetupServiceGrpcTransport(BillingSetupServiceTransport): - """gRPC backend transport for BillingSetupService. - - A service for designating the business entity responsible for - accrued costs. - A billing setup is associated with a payments account. Billing- - related activity for all billing setups associated with a - particular payments account will appear on a single invoice - generated monthly. - - Mutates: - The REMOVE operation cancels a pending billing setup. The CREATE - operation creates a new billing setup. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_billing_setup( - self, - ) -> Callable[ - [billing_setup_service.GetBillingSetupRequest], - billing_setup.BillingSetup, - ]: - r"""Return a callable for the get billing setup method over gRPC. - - Returns a billing setup. - - Returns: - Callable[[~.GetBillingSetupRequest], - ~.BillingSetup]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_billing_setup" not in self._stubs: - self._stubs["get_billing_setup"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BillingSetupService/GetBillingSetup", - request_serializer=billing_setup_service.GetBillingSetupRequest.serialize, - response_deserializer=billing_setup.BillingSetup.deserialize, - ) - return self._stubs["get_billing_setup"] - - @property - def mutate_billing_setup( - self, - ) -> Callable[ - [billing_setup_service.MutateBillingSetupRequest], - billing_setup_service.MutateBillingSetupResponse, - ]: - r"""Return a callable for the mutate billing setup method over gRPC. - - Creates a billing setup, or cancels an existing - billing setup. - - Returns: - Callable[[~.MutateBillingSetupRequest], - ~.MutateBillingSetupResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_billing_setup" not in self._stubs: - self._stubs["mutate_billing_setup"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.BillingSetupService/MutateBillingSetup", - request_serializer=billing_setup_service.MutateBillingSetupRequest.serialize, - response_deserializer=billing_setup_service.MutateBillingSetupResponse.deserialize, - ) - return self._stubs["mutate_billing_setup"] - - -__all__ = ("BillingSetupServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_asset_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_asset_service/__init__.py deleted file mode 100644 index ea2a45525..000000000 --- a/google/ads/googleads/v6/services/services/campaign_asset_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignAssetServiceClient - -__all__ = ("CampaignAssetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_asset_service/client.py b/google/ads/googleads/v6/services/services/campaign_asset_service/client.py deleted file mode 100644 index 42ed86f22..000000000 --- a/google/ads/googleads/v6/services/services/campaign_asset_service/client.py +++ /dev/null @@ -1,571 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_asset -from google.ads.googleads.v6.services.types import campaign_asset_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignAssetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignAssetServiceGrpcTransport - - -class CampaignAssetServiceClientMeta(type): - """Metaclass for the CampaignAssetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignAssetServiceTransport]] - _transport_registry["grpc"] = CampaignAssetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignAssetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignAssetServiceClient(metaclass=CampaignAssetServiceClientMeta): - """Service to manage campaign assets.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignAssetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignAssetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignAssetServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignAssetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_asset_path( - customer_id: str, campaign_id: str, asset_id: str, field_type: str, - ) -> str: - """Return a fully-qualified campaign_asset string.""" - return "customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}".format( - customer_id=customer_id, - campaign_id=campaign_id, - asset_id=asset_id, - field_type=field_type, - ) - - @staticmethod - def parse_campaign_asset_path(path: str) -> Dict[str, str]: - """Parse a campaign_asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignAssets/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignAssetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign asset service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignAssetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignAssetServiceTransport): - # transport is a CampaignAssetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignAssetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_asset( - self, - request: campaign_asset_service.GetCampaignAssetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_asset.CampaignAsset: - r"""Returns the requested campaign asset in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignAssetRequest`): - The request object. Request message for - [CampaignAssetService.GetCampaignAsset][google.ads.googleads.v6.services.CampaignAssetService.GetCampaignAsset]. - resource_name (:class:`str`): - Required. The resource name of the - campaign asset to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignAsset: - A link between a Campaign and an - Asset. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_asset_service.GetCampaignAssetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_asset_service.GetCampaignAssetRequest - ): - request = campaign_asset_service.GetCampaignAssetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_asset - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_assets( - self, - request: campaign_asset_service.MutateCampaignAssetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_asset_service.CampaignAssetOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_asset_service.MutateCampaignAssetsResponse: - r"""Creates or removes campaign assets. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignAssetsRequest`): - The request object. Request message for - [CampaignAssetService.MutateCampaignAssets][google.ads.googleads.v6.services.CampaignAssetService.MutateCampaignAssets]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign assets are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignAssetOperation]`): - Required. The list of operations to - perform on individual campaign assets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignAssetsResponse: - Response message for a campaign asset - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_asset_service.MutateCampaignAssetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_asset_service.MutateCampaignAssetsRequest - ): - request = campaign_asset_service.MutateCampaignAssetsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_assets - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignAssetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_asset_service/transports/__init__.py deleted file mode 100644 index 11edf6e69..000000000 --- a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignAssetServiceTransport -from .grpc import CampaignAssetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignAssetServiceTransport]] -_transport_registry["grpc"] = CampaignAssetServiceGrpcTransport - - -__all__ = ( - "CampaignAssetServiceTransport", - "CampaignAssetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_asset_service/transports/base.py deleted file mode 100644 index 4d684945c..000000000 --- a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_asset -from google.ads.googleads.v6.services.types import campaign_asset_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignAssetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignAssetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_asset: gapic_v1.method.wrap_method( - self.get_campaign_asset, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_assets: gapic_v1.method.wrap_method( - self.mutate_campaign_assets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_asset( - self, - ) -> typing.Callable[ - [campaign_asset_service.GetCampaignAssetRequest], - campaign_asset.CampaignAsset, - ]: - raise NotImplementedError - - @property - def mutate_campaign_assets( - self, - ) -> typing.Callable[ - [campaign_asset_service.MutateCampaignAssetsRequest], - campaign_asset_service.MutateCampaignAssetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignAssetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_asset_service/transports/grpc.py deleted file mode 100644 index 8b43d4972..000000000 --- a/google/ads/googleads/v6/services/services/campaign_asset_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_asset -from google.ads.googleads.v6.services.types import campaign_asset_service - -from .base import CampaignAssetServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignAssetServiceGrpcTransport(CampaignAssetServiceTransport): - """gRPC backend transport for CampaignAssetService. - - Service to manage campaign assets. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_asset( - self, - ) -> Callable[ - [campaign_asset_service.GetCampaignAssetRequest], - campaign_asset.CampaignAsset, - ]: - r"""Return a callable for the get campaign asset method over gRPC. - - Returns the requested campaign asset in full detail. - - Returns: - Callable[[~.GetCampaignAssetRequest], - ~.CampaignAsset]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_asset" not in self._stubs: - self._stubs["get_campaign_asset"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignAssetService/GetCampaignAsset", - request_serializer=campaign_asset_service.GetCampaignAssetRequest.serialize, - response_deserializer=campaign_asset.CampaignAsset.deserialize, - ) - return self._stubs["get_campaign_asset"] - - @property - def mutate_campaign_assets( - self, - ) -> Callable[ - [campaign_asset_service.MutateCampaignAssetsRequest], - campaign_asset_service.MutateCampaignAssetsResponse, - ]: - r"""Return a callable for the mutate campaign assets method over gRPC. - - Creates or removes campaign assets. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCampaignAssetsRequest], - ~.MutateCampaignAssetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_assets" not in self._stubs: - self._stubs[ - "mutate_campaign_assets" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignAssetService/MutateCampaignAssets", - request_serializer=campaign_asset_service.MutateCampaignAssetsRequest.serialize, - response_deserializer=campaign_asset_service.MutateCampaignAssetsResponse.deserialize, - ) - return self._stubs["mutate_campaign_assets"] - - -__all__ = ("CampaignAssetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_audience_view_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_audience_view_service/__init__.py deleted file mode 100644 index 2d6bbb891..000000000 --- a/google/ads/googleads/v6/services/services/campaign_audience_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignAudienceViewServiceClient - -__all__ = ("CampaignAudienceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_audience_view_service/client.py b/google/ads/googleads/v6/services/services/campaign_audience_view_service/client.py deleted file mode 100644 index fac71fe44..000000000 --- a/google/ads/googleads/v6/services/services/campaign_audience_view_service/client.py +++ /dev/null @@ -1,461 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_audience_view -from google.ads.googleads.v6.services.types import ( - campaign_audience_view_service, -) - -from .transports.base import ( - CampaignAudienceViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CampaignAudienceViewServiceGrpcTransport - - -class CampaignAudienceViewServiceClientMeta(type): - """Metaclass for the CampaignAudienceViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignAudienceViewServiceTransport]] - _transport_registry["grpc"] = CampaignAudienceViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignAudienceViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignAudienceViewServiceClient( - metaclass=CampaignAudienceViewServiceClientMeta -): - """Service to manage campaign audience views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignAudienceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignAudienceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignAudienceViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignAudienceViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_audience_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_audience_view string.""" - return "customers/{customer_id}/campaignAudienceViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_audience_view_path(path: str) -> Dict[str, str]: - """Parse a campaign_audience_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignAudienceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, CampaignAudienceViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign audience view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignAudienceViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignAudienceViewServiceTransport): - # transport is a CampaignAudienceViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignAudienceViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_audience_view( - self, - request: campaign_audience_view_service.GetCampaignAudienceViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_audience_view.CampaignAudienceView: - r"""Returns the requested campaign audience view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignAudienceViewRequest`): - The request object. Request message for - [CampaignAudienceViewService.GetCampaignAudienceView][google.ads.googleads.v6.services.CampaignAudienceViewService.GetCampaignAudienceView]. - resource_name (:class:`str`): - Required. The resource name of the - campaign audience view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignAudienceView: - A campaign audience view. - Includes performance data from interests - and remarketing lists for Display - Network and YouTube Network ads, and - remarketing lists for search ads (RLSA), - aggregated by campaign and audience - criterion. This view only includes - audiences attached at the campaign - level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_audience_view_service.GetCampaignAudienceViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_audience_view_service.GetCampaignAudienceViewRequest, - ): - request = campaign_audience_view_service.GetCampaignAudienceViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_audience_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignAudienceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/base.py deleted file mode 100644 index 708859781..000000000 --- a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_audience_view -from google.ads.googleads.v6.services.types import ( - campaign_audience_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignAudienceViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignAudienceViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_audience_view: gapic_v1.method.wrap_method( - self.get_campaign_audience_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_audience_view( - self, - ) -> typing.Callable[ - [campaign_audience_view_service.GetCampaignAudienceViewRequest], - campaign_audience_view.CampaignAudienceView, - ]: - raise NotImplementedError - - -__all__ = ("CampaignAudienceViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/grpc.py deleted file mode 100644 index 6aeffe953..000000000 --- a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_audience_view -from google.ads.googleads.v6.services.types import ( - campaign_audience_view_service, -) - -from .base import CampaignAudienceViewServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignAudienceViewServiceGrpcTransport( - CampaignAudienceViewServiceTransport -): - """gRPC backend transport for CampaignAudienceViewService. - - Service to manage campaign audience views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_audience_view( - self, - ) -> Callable[ - [campaign_audience_view_service.GetCampaignAudienceViewRequest], - campaign_audience_view.CampaignAudienceView, - ]: - r"""Return a callable for the get campaign audience view method over gRPC. - - Returns the requested campaign audience view in full - detail. - - Returns: - Callable[[~.GetCampaignAudienceViewRequest], - ~.CampaignAudienceView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_audience_view" not in self._stubs: - self._stubs[ - "get_campaign_audience_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignAudienceViewService/GetCampaignAudienceView", - request_serializer=campaign_audience_view_service.GetCampaignAudienceViewRequest.serialize, - response_deserializer=campaign_audience_view.CampaignAudienceView.deserialize, - ) - return self._stubs["get_campaign_audience_view"] - - -__all__ = ("CampaignAudienceViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/__init__.py deleted file mode 100644 index c02c1877f..000000000 --- a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignBidModifierServiceClient - -__all__ = ("CampaignBidModifierServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/__init__.py deleted file mode 100644 index bbaf87f83..000000000 --- a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignBidModifierServiceTransport -from .grpc import CampaignBidModifierServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignBidModifierServiceTransport]] -_transport_registry["grpc"] = CampaignBidModifierServiceGrpcTransport - - -__all__ = ( - "CampaignBidModifierServiceTransport", - "CampaignBidModifierServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/base.py deleted file mode 100644 index 713250684..000000000 --- a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_bid_modifier -from google.ads.googleads.v6.services.types import campaign_bid_modifier_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignBidModifierServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignBidModifierService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_bid_modifier: gapic_v1.method.wrap_method( - self.get_campaign_bid_modifier, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_bid_modifiers: gapic_v1.method.wrap_method( - self.mutate_campaign_bid_modifiers, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_bid_modifier( - self, - ) -> typing.Callable[ - [campaign_bid_modifier_service.GetCampaignBidModifierRequest], - campaign_bid_modifier.CampaignBidModifier, - ]: - raise NotImplementedError - - @property - def mutate_campaign_bid_modifiers( - self, - ) -> typing.Callable[ - [campaign_bid_modifier_service.MutateCampaignBidModifiersRequest], - campaign_bid_modifier_service.MutateCampaignBidModifiersResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignBidModifierServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_budget_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_budget_service/__init__.py deleted file mode 100644 index 3af02b516..000000000 --- a/google/ads/googleads/v6/services/services/campaign_budget_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignBudgetServiceClient - -__all__ = ("CampaignBudgetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_budget_service/client.py b/google/ads/googleads/v6/services/services/campaign_budget_service/client.py deleted file mode 100644 index bb0c34db2..000000000 --- a/google/ads/googleads/v6/services/services/campaign_budget_service/client.py +++ /dev/null @@ -1,533 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_budget -from google.ads.googleads.v6.services.types import campaign_budget_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignBudgetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignBudgetServiceGrpcTransport - - -class CampaignBudgetServiceClientMeta(type): - """Metaclass for the CampaignBudgetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignBudgetServiceTransport]] - _transport_registry["grpc"] = CampaignBudgetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignBudgetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignBudgetServiceClient(metaclass=CampaignBudgetServiceClientMeta): - """Service to manage campaign budgets.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignBudgetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignBudgetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignBudgetServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignBudgetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_budget_path(customer_id: str, campaign_budget_id: str,) -> str: - """Return a fully-qualified campaign_budget string.""" - return "customers/{customer_id}/campaignBudgets/{campaign_budget_id}".format( - customer_id=customer_id, campaign_budget_id=campaign_budget_id, - ) - - @staticmethod - def parse_campaign_budget_path(path: str) -> Dict[str, str]: - """Parse a campaign_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignBudgetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign budget service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignBudgetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignBudgetServiceTransport): - # transport is a CampaignBudgetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignBudgetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_budget( - self, - request: campaign_budget_service.GetCampaignBudgetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_budget.CampaignBudget: - r"""Returns the requested Campaign Budget in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignBudgetRequest`): - The request object. Request message for - [CampaignBudgetService.GetCampaignBudget][google.ads.googleads.v6.services.CampaignBudgetService.GetCampaignBudget]. - resource_name (:class:`str`): - Required. The resource name of the - campaign budget to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignBudget: - A campaign budget. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_budget_service.GetCampaignBudgetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_budget_service.GetCampaignBudgetRequest - ): - request = campaign_budget_service.GetCampaignBudgetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_budget - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_budgets( - self, - request: campaign_budget_service.MutateCampaignBudgetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_budget_service.CampaignBudgetOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_budget_service.MutateCampaignBudgetsResponse: - r"""Creates, updates, or removes campaign budgets. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignBudgetsRequest`): - The request object. Request message for - [CampaignBudgetService.MutateCampaignBudgets][google.ads.googleads.v6.services.CampaignBudgetService.MutateCampaignBudgets]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign budgets are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignBudgetOperation]`): - Required. The list of operations to - perform on individual campaign budgets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignBudgetsResponse: - Response message for campaign budget - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_budget_service.MutateCampaignBudgetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_budget_service.MutateCampaignBudgetsRequest - ): - request = campaign_budget_service.MutateCampaignBudgetsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_budgets - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignBudgetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_budget_service/transports/__init__.py deleted file mode 100644 index fa96aec2a..000000000 --- a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignBudgetServiceTransport -from .grpc import CampaignBudgetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignBudgetServiceTransport]] -_transport_registry["grpc"] = CampaignBudgetServiceGrpcTransport - - -__all__ = ( - "CampaignBudgetServiceTransport", - "CampaignBudgetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_budget_service/transports/base.py deleted file mode 100644 index 39140e780..000000000 --- a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_budget -from google.ads.googleads.v6.services.types import campaign_budget_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignBudgetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignBudgetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_budget: gapic_v1.method.wrap_method( - self.get_campaign_budget, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_budgets: gapic_v1.method.wrap_method( - self.mutate_campaign_budgets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_budget( - self, - ) -> typing.Callable[ - [campaign_budget_service.GetCampaignBudgetRequest], - campaign_budget.CampaignBudget, - ]: - raise NotImplementedError - - @property - def mutate_campaign_budgets( - self, - ) -> typing.Callable[ - [campaign_budget_service.MutateCampaignBudgetsRequest], - campaign_budget_service.MutateCampaignBudgetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignBudgetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_budget_service/transports/grpc.py deleted file mode 100644 index 7f3406a89..000000000 --- a/google/ads/googleads/v6/services/services/campaign_budget_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_budget -from google.ads.googleads.v6.services.types import campaign_budget_service - -from .base import CampaignBudgetServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignBudgetServiceGrpcTransport(CampaignBudgetServiceTransport): - """gRPC backend transport for CampaignBudgetService. - - Service to manage campaign budgets. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_budget( - self, - ) -> Callable[ - [campaign_budget_service.GetCampaignBudgetRequest], - campaign_budget.CampaignBudget, - ]: - r"""Return a callable for the get campaign budget method over gRPC. - - Returns the requested Campaign Budget in full detail. - - Returns: - Callable[[~.GetCampaignBudgetRequest], - ~.CampaignBudget]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_budget" not in self._stubs: - self._stubs["get_campaign_budget"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignBudgetService/GetCampaignBudget", - request_serializer=campaign_budget_service.GetCampaignBudgetRequest.serialize, - response_deserializer=campaign_budget.CampaignBudget.deserialize, - ) - return self._stubs["get_campaign_budget"] - - @property - def mutate_campaign_budgets( - self, - ) -> Callable[ - [campaign_budget_service.MutateCampaignBudgetsRequest], - campaign_budget_service.MutateCampaignBudgetsResponse, - ]: - r"""Return a callable for the mutate campaign budgets method over gRPC. - - Creates, updates, or removes campaign budgets. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCampaignBudgetsRequest], - ~.MutateCampaignBudgetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_budgets" not in self._stubs: - self._stubs[ - "mutate_campaign_budgets" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignBudgetService/MutateCampaignBudgets", - request_serializer=campaign_budget_service.MutateCampaignBudgetsRequest.serialize, - response_deserializer=campaign_budget_service.MutateCampaignBudgetsResponse.deserialize, - ) - return self._stubs["mutate_campaign_budgets"] - - -__all__ = ("CampaignBudgetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_criterion_service/__init__.py deleted file mode 100644 index be70c9880..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignCriterionServiceClient - -__all__ = ("CampaignCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_service/client.py b/google/ads/googleads/v6/services/services/campaign_criterion_service/client.py deleted file mode 100644 index cd255be87..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_service/client.py +++ /dev/null @@ -1,559 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_criterion -from google.ads.googleads.v6.services.types import campaign_criterion_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - CampaignCriterionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CampaignCriterionServiceGrpcTransport - - -class CampaignCriterionServiceClientMeta(type): - """Metaclass for the CampaignCriterionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignCriterionServiceTransport]] - _transport_registry["grpc"] = CampaignCriterionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignCriterionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignCriterionServiceClient( - metaclass=CampaignCriterionServiceClientMeta -): - """Service to manage campaign criteria.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignCriterionServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignCriterionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_criterion_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_criterion string.""" - return "customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_criterion_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignCriterionServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign criterion service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignCriterionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignCriterionServiceTransport): - # transport is a CampaignCriterionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignCriterionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_criterion( - self, - request: campaign_criterion_service.GetCampaignCriterionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_criterion.CampaignCriterion: - r"""Returns the requested criterion in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignCriterionRequest`): - The request object. Request message for - [CampaignCriterionService.GetCampaignCriterion][google.ads.googleads.v6.services.CampaignCriterionService.GetCampaignCriterion]. - resource_name (:class:`str`): - Required. The resource name of the - criterion to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignCriterion: - A campaign criterion. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_criterion_service.GetCampaignCriterionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_criterion_service.GetCampaignCriterionRequest - ): - request = campaign_criterion_service.GetCampaignCriterionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_criterion - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_criteria( - self, - request: campaign_criterion_service.MutateCampaignCriteriaRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_criterion_service.CampaignCriterionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_criterion_service.MutateCampaignCriteriaResponse: - r"""Creates, updates, or removes criteria. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignCriteriaRequest`): - The request object. Request message for - [CampaignCriterionService.MutateCampaignCriteria][google.ads.googleads.v6.services.CampaignCriterionService.MutateCampaignCriteria]. - customer_id (:class:`str`): - Required. The ID of the customer - whose criteria are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignCriterionOperation]`): - Required. The list of operations to - perform on individual criteria. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignCriteriaResponse: - Response message for campaign - criterion mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_criterion_service.MutateCampaignCriteriaRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_criterion_service.MutateCampaignCriteriaRequest - ): - request = campaign_criterion_service.MutateCampaignCriteriaRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_criteria - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/__init__.py deleted file mode 100644 index 96a80f371..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignCriterionServiceTransport -from .grpc import CampaignCriterionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignCriterionServiceTransport]] -_transport_registry["grpc"] = CampaignCriterionServiceGrpcTransport - - -__all__ = ( - "CampaignCriterionServiceTransport", - "CampaignCriterionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/base.py deleted file mode 100644 index 23c882719..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_criterion -from google.ads.googleads.v6.services.types import campaign_criterion_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignCriterionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignCriterionService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_criterion: gapic_v1.method.wrap_method( - self.get_campaign_criterion, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_criteria: gapic_v1.method.wrap_method( - self.mutate_campaign_criteria, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_criterion( - self, - ) -> typing.Callable[ - [campaign_criterion_service.GetCampaignCriterionRequest], - campaign_criterion.CampaignCriterion, - ]: - raise NotImplementedError - - @property - def mutate_campaign_criteria( - self, - ) -> typing.Callable[ - [campaign_criterion_service.MutateCampaignCriteriaRequest], - campaign_criterion_service.MutateCampaignCriteriaResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignCriterionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/grpc.py deleted file mode 100644 index 265d7b91e..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_service/transports/grpc.py +++ /dev/null @@ -1,278 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_criterion -from google.ads.googleads.v6.services.types import campaign_criterion_service - -from .base import CampaignCriterionServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignCriterionServiceGrpcTransport(CampaignCriterionServiceTransport): - """gRPC backend transport for CampaignCriterionService. - - Service to manage campaign criteria. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_criterion( - self, - ) -> Callable[ - [campaign_criterion_service.GetCampaignCriterionRequest], - campaign_criterion.CampaignCriterion, - ]: - r"""Return a callable for the get campaign criterion method over gRPC. - - Returns the requested criterion in full detail. - - Returns: - Callable[[~.GetCampaignCriterionRequest], - ~.CampaignCriterion]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_criterion" not in self._stubs: - self._stubs[ - "get_campaign_criterion" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignCriterionService/GetCampaignCriterion", - request_serializer=campaign_criterion_service.GetCampaignCriterionRequest.serialize, - response_deserializer=campaign_criterion.CampaignCriterion.deserialize, - ) - return self._stubs["get_campaign_criterion"] - - @property - def mutate_campaign_criteria( - self, - ) -> Callable[ - [campaign_criterion_service.MutateCampaignCriteriaRequest], - campaign_criterion_service.MutateCampaignCriteriaResponse, - ]: - r"""Return a callable for the mutate campaign criteria method over gRPC. - - Creates, updates, or removes criteria. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCampaignCriteriaRequest], - ~.MutateCampaignCriteriaResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_criteria" not in self._stubs: - self._stubs[ - "mutate_campaign_criteria" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignCriterionService/MutateCampaignCriteria", - request_serializer=campaign_criterion_service.MutateCampaignCriteriaRequest.serialize, - response_deserializer=campaign_criterion_service.MutateCampaignCriteriaResponse.deserialize, - ) - return self._stubs["mutate_campaign_criteria"] - - -__all__ = ("CampaignCriterionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/__init__.py deleted file mode 100644 index 02e44fcdf..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignCriterionSimulationServiceClient - -__all__ = ("CampaignCriterionSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/client.py b/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/client.py deleted file mode 100644 index edb8d24f3..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/client.py +++ /dev/null @@ -1,476 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - campaign_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - campaign_criterion_simulation_service, -) - -from .transports.base import ( - CampaignCriterionSimulationServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CampaignCriterionSimulationServiceGrpcTransport - - -class CampaignCriterionSimulationServiceClientMeta(type): - """Metaclass for the CampaignCriterionSimulationService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignCriterionSimulationServiceTransport]] - _transport_registry[ - "grpc" - ] = CampaignCriterionSimulationServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignCriterionSimulationServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignCriterionSimulationServiceClient( - metaclass=CampaignCriterionSimulationServiceClientMeta -): - """Service to fetch campaign criterion simulations.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignCriterionSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignCriterionSimulationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignCriterionSimulationServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignCriterionSimulationServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_criterion_simulation_path( - customer_id: str, - campaign_id: str, - criterion_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified campaign_criterion_simulation string.""" - return "customers/{customer_id}/campaignCriterionSimulations/{campaign_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_campaign_criterion_simulation_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriterionSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, CampaignCriterionSimulationServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign criterion simulation service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignCriterionSimulationServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignCriterionSimulationServiceTransport): - # transport is a CampaignCriterionSimulationServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignCriterionSimulationServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_criterion_simulation( - self, - request: campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_criterion_simulation.CampaignCriterionSimulation: - r"""Returns the requested campaign criterion simulation - in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignCriterionSimulationRequest`): - The request object. Request message for - [CampaignCriterionSimulationService.GetCampaignCriterionSimulation][google.ads.googleads.v6.services.CampaignCriterionSimulationService.GetCampaignCriterionSimulation]. - resource_name (:class:`str`): - Required. The resource name of the - campaign criterion simulation to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignCriterionSimulation: - A campaign criterion simulation. Supported combinations of advertising - channel type, criterion ids, simulation type and - simulation modification method is detailed below - respectively. - - 1. SEARCH - 30000,30001,30002 - BID_MODIFIER - - UNIFORM - 2. SHOPPING - 30000,30001,30002 - BID_MODIFIER - - UNIFORM - 3. DISPLAY - 30001 - BID_MODIFIER - UNIFORM - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest, - ): - request = campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_criterion_simulation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignCriterionSimulationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/__init__.py deleted file mode 100644 index dc79c9ced..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignCriterionSimulationServiceTransport -from .grpc import CampaignCriterionSimulationServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignCriterionSimulationServiceTransport]] -_transport_registry["grpc"] = CampaignCriterionSimulationServiceGrpcTransport - - -__all__ = ( - "CampaignCriterionSimulationServiceTransport", - "CampaignCriterionSimulationServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/base.py deleted file mode 100644 index d757d86e6..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - campaign_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - campaign_criterion_simulation_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignCriterionSimulationServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignCriterionSimulationService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_criterion_simulation: gapic_v1.method.wrap_method( - self.get_campaign_criterion_simulation, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_criterion_simulation( - self, - ) -> typing.Callable[ - [ - campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest - ], - campaign_criterion_simulation.CampaignCriterionSimulation, - ]: - raise NotImplementedError - - -__all__ = ("CampaignCriterionSimulationServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/grpc.py deleted file mode 100644 index d612bcdb7..000000000 --- a/google/ads/googleads/v6/services/services/campaign_criterion_simulation_service/transports/grpc.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - campaign_criterion_simulation, -) -from google.ads.googleads.v6.services.types import ( - campaign_criterion_simulation_service, -) - -from .base import ( - CampaignCriterionSimulationServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class CampaignCriterionSimulationServiceGrpcTransport( - CampaignCriterionSimulationServiceTransport -): - """gRPC backend transport for CampaignCriterionSimulationService. - - Service to fetch campaign criterion simulations. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_criterion_simulation( - self, - ) -> Callable[ - [ - campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest - ], - campaign_criterion_simulation.CampaignCriterionSimulation, - ]: - r"""Return a callable for the get campaign criterion - simulation method over gRPC. - - Returns the requested campaign criterion simulation - in full detail. - - Returns: - Callable[[~.GetCampaignCriterionSimulationRequest], - ~.CampaignCriterionSimulation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_criterion_simulation" not in self._stubs: - self._stubs[ - "get_campaign_criterion_simulation" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignCriterionSimulationService/GetCampaignCriterionSimulation", - request_serializer=campaign_criterion_simulation_service.GetCampaignCriterionSimulationRequest.serialize, - response_deserializer=campaign_criterion_simulation.CampaignCriterionSimulation.deserialize, - ) - return self._stubs["get_campaign_criterion_simulation"] - - -__all__ = ("CampaignCriterionSimulationServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_draft_service/__init__.py deleted file mode 100644 index 1b6915fe8..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignDraftServiceClient - -__all__ = ("CampaignDraftServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/client.py b/google/ads/googleads/v6/services/services/campaign_draft_service/client.py deleted file mode 100644 index 1d9e2a766..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/client.py +++ /dev/null @@ -1,767 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_draft -from google.ads.googleads.v6.services.services.campaign_draft_service import ( - pagers, -) -from google.ads.googleads.v6.services.types import campaign_draft_service -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignDraftServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignDraftServiceGrpcTransport - - -class CampaignDraftServiceClientMeta(type): - """Metaclass for the CampaignDraftService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignDraftServiceTransport]] - _transport_registry["grpc"] = CampaignDraftServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignDraftServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignDraftServiceClient(metaclass=CampaignDraftServiceClientMeta): - """Service to manage campaign drafts.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignDraftServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignDraftServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignDraftServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignDraftServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_draft_path( - customer_id: str, base_campaign_id: str, draft_id: str, - ) -> str: - """Return a fully-qualified campaign_draft string.""" - return "customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}".format( - customer_id=customer_id, - base_campaign_id=base_campaign_id, - draft_id=draft_id, - ) - - @staticmethod - def parse_campaign_draft_path(path: str) -> Dict[str, str]: - """Parse a campaign_draft path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignDrafts/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignDraftServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign draft service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignDraftServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignDraftServiceTransport): - # transport is a CampaignDraftServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignDraftServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_draft( - self, - request: campaign_draft_service.GetCampaignDraftRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_draft.CampaignDraft: - r"""Returns the requested campaign draft in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignDraftRequest`): - The request object. Request message for - [CampaignDraftService.GetCampaignDraft][google.ads.googleads.v6.services.CampaignDraftService.GetCampaignDraft]. - resource_name (:class:`str`): - Required. The resource name of the - campaign draft to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignDraft: - A campaign draft. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_draft_service.GetCampaignDraftRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_draft_service.GetCampaignDraftRequest - ): - request = campaign_draft_service.GetCampaignDraftRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_draft - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_drafts( - self, - request: campaign_draft_service.MutateCampaignDraftsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_draft_service.CampaignDraftOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_draft_service.MutateCampaignDraftsResponse: - r"""Creates, updates, or removes campaign drafts. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignDraftsRequest`): - The request object. Request message for - [CampaignDraftService.MutateCampaignDrafts][google.ads.googleads.v6.services.CampaignDraftService.MutateCampaignDrafts]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign drafts are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignDraftOperation]`): - Required. The list of operations to - perform on individual campaign drafts. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignDraftsResponse: - Response message for campaign draft - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_draft_service.MutateCampaignDraftsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_draft_service.MutateCampaignDraftsRequest - ): - request = campaign_draft_service.MutateCampaignDraftsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_drafts - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def promote_campaign_draft( - self, - request: campaign_draft_service.PromoteCampaignDraftRequest = None, - *, - campaign_draft: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Promotes the changes in a draft back to the base campaign. - - This method returns a Long Running Operation (LRO) indicating if - the Promote is done. Use [Operations.GetOperation] to poll the - LRO until it is done. Only a done status is returned in the - response. See the status in the Campaign Draft resource to - determine if the promotion was successful. If the LRO failed, - use - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors] - to view the list of error reasons. - - Args: - request (:class:`google.ads.googleads.v6.services.types.PromoteCampaignDraftRequest`): - The request object. Request message for - [CampaignDraftService.PromoteCampaignDraft][google.ads.googleads.v6.services.CampaignDraftService.PromoteCampaignDraft]. - campaign_draft (:class:`str`): - Required. The resource name of the - campaign draft to promote. - - This corresponds to the ``campaign_draft`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - The JSON representation for Empty is empty JSON - object {}. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([campaign_draft]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_draft_service.PromoteCampaignDraftRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_draft_service.PromoteCampaignDraftRequest - ): - request = campaign_draft_service.PromoteCampaignDraftRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if campaign_draft is not None: - request.campaign_draft = campaign_draft - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.promote_campaign_draft - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("campaign_draft", request.campaign_draft),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty.Empty, - metadata_type=empty.Empty, - ) - - # Done; return the response. - return response - - def list_campaign_draft_async_errors( - self, - request: campaign_draft_service.ListCampaignDraftAsyncErrorsRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCampaignDraftAsyncErrorsPager: - r"""Returns all errors that occurred during CampaignDraft - promote. Throws an error if called before campaign draft - is promoted. Supports standard list paging. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListCampaignDraftAsyncErrorsRequest`): - The request object. Request message for - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors]. - resource_name (:class:`str`): - Required. The name of the campaign - draft from which to retrieve the async - errors. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.campaign_draft_service.pagers.ListCampaignDraftAsyncErrorsPager: - Response message for - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_draft_service.ListCampaignDraftAsyncErrorsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_draft_service.ListCampaignDraftAsyncErrorsRequest - ): - request = campaign_draft_service.ListCampaignDraftAsyncErrorsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_campaign_draft_async_errors - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCampaignDraftAsyncErrorsPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignDraftServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/pagers.py b/google/ads/googleads/v6/services/services/campaign_draft_service/pagers.py deleted file mode 100644 index 965c1ee5a..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/pagers.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.services.types import campaign_draft_service -from google.rpc import status_pb2 as status # type: ignore - - -class ListCampaignDraftAsyncErrorsPager: - """A pager for iterating through ``list_campaign_draft_async_errors`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.ListCampaignDraftAsyncErrorsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``errors`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCampaignDraftAsyncErrors`` requests and continue to iterate - through the ``errors`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.ListCampaignDraftAsyncErrorsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[ - ..., campaign_draft_service.ListCampaignDraftAsyncErrorsResponse - ], - request: campaign_draft_service.ListCampaignDraftAsyncErrorsRequest, - response: campaign_draft_service.ListCampaignDraftAsyncErrorsResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.ListCampaignDraftAsyncErrorsRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.ListCampaignDraftAsyncErrorsResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = campaign_draft_service.ListCampaignDraftAsyncErrorsRequest( - request - ) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages( - self, - ) -> Iterable[campaign_draft_service.ListCampaignDraftAsyncErrorsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__(self) -> Iterable[status.Status]: - for page in self.pages: - yield from page.errors - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_draft_service/transports/__init__.py deleted file mode 100644 index b8d959ae5..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignDraftServiceTransport -from .grpc import CampaignDraftServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignDraftServiceTransport]] -_transport_registry["grpc"] = CampaignDraftServiceGrpcTransport - - -__all__ = ( - "CampaignDraftServiceTransport", - "CampaignDraftServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_draft_service/transports/base.py deleted file mode 100644 index a70cc751e..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/base.py +++ /dev/null @@ -1,151 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_draft -from google.ads.googleads.v6.services.types import campaign_draft_service -from google.longrunning import operations_pb2 as operations # type: ignore - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignDraftServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignDraftService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_draft: gapic_v1.method.wrap_method( - self.get_campaign_draft, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_drafts: gapic_v1.method.wrap_method( - self.mutate_campaign_drafts, - default_timeout=None, - client_info=client_info, - ), - self.promote_campaign_draft: gapic_v1.method.wrap_method( - self.promote_campaign_draft, - default_timeout=None, - client_info=client_info, - ), - self.list_campaign_draft_async_errors: gapic_v1.method.wrap_method( - self.list_campaign_draft_async_errors, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Return the client designed to process long-running operations.""" - raise NotImplementedError - - @property - def get_campaign_draft( - self, - ) -> typing.Callable[ - [campaign_draft_service.GetCampaignDraftRequest], - campaign_draft.CampaignDraft, - ]: - raise NotImplementedError - - @property - def mutate_campaign_drafts( - self, - ) -> typing.Callable[ - [campaign_draft_service.MutateCampaignDraftsRequest], - campaign_draft_service.MutateCampaignDraftsResponse, - ]: - raise NotImplementedError - - @property - def promote_campaign_draft( - self, - ) -> typing.Callable[ - [campaign_draft_service.PromoteCampaignDraftRequest], - operations.Operation, - ]: - raise NotImplementedError - - @property - def list_campaign_draft_async_errors( - self, - ) -> typing.Callable[ - [campaign_draft_service.ListCampaignDraftAsyncErrorsRequest], - campaign_draft_service.ListCampaignDraftAsyncErrorsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignDraftServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_draft_service/transports/grpc.py deleted file mode 100644 index 0f9aafd02..000000000 --- a/google/ads/googleads/v6/services/services/campaign_draft_service/transports/grpc.py +++ /dev/null @@ -1,368 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_draft -from google.ads.googleads.v6.services.types import campaign_draft_service -from google.longrunning import operations_pb2 as operations # type: ignore - -from .base import CampaignDraftServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignDraftServiceGrpcTransport(CampaignDraftServiceTransport): - """gRPC backend transport for CampaignDraftService. - - Service to manage campaign drafts. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Sanity check: Only create a new client if we do not already have one. - if "operations_client" not in self.__dict__: - self.__dict__["operations_client"] = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self.__dict__["operations_client"] - - @property - def get_campaign_draft( - self, - ) -> Callable[ - [campaign_draft_service.GetCampaignDraftRequest], - campaign_draft.CampaignDraft, - ]: - r"""Return a callable for the get campaign draft method over gRPC. - - Returns the requested campaign draft in full detail. - - Returns: - Callable[[~.GetCampaignDraftRequest], - ~.CampaignDraft]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_draft" not in self._stubs: - self._stubs["get_campaign_draft"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignDraftService/GetCampaignDraft", - request_serializer=campaign_draft_service.GetCampaignDraftRequest.serialize, - response_deserializer=campaign_draft.CampaignDraft.deserialize, - ) - return self._stubs["get_campaign_draft"] - - @property - def mutate_campaign_drafts( - self, - ) -> Callable[ - [campaign_draft_service.MutateCampaignDraftsRequest], - campaign_draft_service.MutateCampaignDraftsResponse, - ]: - r"""Return a callable for the mutate campaign drafts method over gRPC. - - Creates, updates, or removes campaign drafts. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCampaignDraftsRequest], - ~.MutateCampaignDraftsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_drafts" not in self._stubs: - self._stubs[ - "mutate_campaign_drafts" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignDraftService/MutateCampaignDrafts", - request_serializer=campaign_draft_service.MutateCampaignDraftsRequest.serialize, - response_deserializer=campaign_draft_service.MutateCampaignDraftsResponse.deserialize, - ) - return self._stubs["mutate_campaign_drafts"] - - @property - def promote_campaign_draft( - self, - ) -> Callable[ - [campaign_draft_service.PromoteCampaignDraftRequest], - operations.Operation, - ]: - r"""Return a callable for the promote campaign draft method over gRPC. - - Promotes the changes in a draft back to the base campaign. - - This method returns a Long Running Operation (LRO) indicating if - the Promote is done. Use [Operations.GetOperation] to poll the - LRO until it is done. Only a done status is returned in the - response. See the status in the Campaign Draft resource to - determine if the promotion was successful. If the LRO failed, - use - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors] - to view the list of error reasons. - - Returns: - Callable[[~.PromoteCampaignDraftRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "promote_campaign_draft" not in self._stubs: - self._stubs[ - "promote_campaign_draft" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignDraftService/PromoteCampaignDraft", - request_serializer=campaign_draft_service.PromoteCampaignDraftRequest.serialize, - response_deserializer=operations.Operation.FromString, - ) - return self._stubs["promote_campaign_draft"] - - @property - def list_campaign_draft_async_errors( - self, - ) -> Callable[ - [campaign_draft_service.ListCampaignDraftAsyncErrorsRequest], - campaign_draft_service.ListCampaignDraftAsyncErrorsResponse, - ]: - r"""Return a callable for the list campaign draft async - errors method over gRPC. - - Returns all errors that occurred during CampaignDraft - promote. Throws an error if called before campaign draft - is promoted. Supports standard list paging. - - Returns: - Callable[[~.ListCampaignDraftAsyncErrorsRequest], - ~.ListCampaignDraftAsyncErrorsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_campaign_draft_async_errors" not in self._stubs: - self._stubs[ - "list_campaign_draft_async_errors" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignDraftService/ListCampaignDraftAsyncErrors", - request_serializer=campaign_draft_service.ListCampaignDraftAsyncErrorsRequest.serialize, - response_deserializer=campaign_draft_service.ListCampaignDraftAsyncErrorsResponse.deserialize, - ) - return self._stubs["list_campaign_draft_async_errors"] - - -__all__ = ("CampaignDraftServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/__init__.py deleted file mode 100644 index 3dd55946d..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignExperimentServiceClient - -__all__ = ("CampaignExperimentServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/client.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/client.py deleted file mode 100644 index 0fb56343f..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/client.py +++ /dev/null @@ -1,1114 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_experiment -from google.ads.googleads.v6.resources.types import ( - campaign_experiment as gagr_campaign_experiment, -) -from google.ads.googleads.v6.services.services.campaign_experiment_service import ( - pagers, -) -from google.ads.googleads.v6.services.types import campaign_experiment_service -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - CampaignExperimentServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CampaignExperimentServiceGrpcTransport - - -class CampaignExperimentServiceClientMeta(type): - """Metaclass for the CampaignExperimentService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignExperimentServiceTransport]] - _transport_registry["grpc"] = CampaignExperimentServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignExperimentServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignExperimentServiceClient( - metaclass=CampaignExperimentServiceClientMeta -): - """CampaignExperimentService manages the life cycle of campaign - experiments. It is used to create new experiments from drafts, - modify experiment properties, promote changes in an experiment - back to its base campaign, graduate experiments into new stand- - alone campaigns, and to remove an experiment. - - An experiment consists of two variants or arms - the base - campaign and the experiment campaign, directing a fixed share of - traffic to each arm. A campaign experiment is created from a - draft of changes to the base campaign and will be a snapshot of - changes in the draft at the time of creation. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignExperimentServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignExperimentServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignExperimentServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignExperimentServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_draft_path( - customer_id: str, base_campaign_id: str, draft_id: str, - ) -> str: - """Return a fully-qualified campaign_draft string.""" - return "customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}".format( - customer_id=customer_id, - base_campaign_id=base_campaign_id, - draft_id=draft_id, - ) - - @staticmethod - def parse_campaign_draft_path(path: str) -> Dict[str, str]: - """Parse a campaign_draft path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignDrafts/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_experiment_path( - customer_id: str, campaign_experiment_id: str, - ) -> str: - """Return a fully-qualified campaign_experiment string.""" - return "customers/{customer_id}/campaignExperiments/{campaign_experiment_id}".format( - customer_id=customer_id, - campaign_experiment_id=campaign_experiment_id, - ) - - @staticmethod - def parse_campaign_experiment_path(path: str) -> Dict[str, str]: - """Parse a campaign_experiment path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignExperiments/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignExperimentServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign experiment service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignExperimentServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignExperimentServiceTransport): - # transport is a CampaignExperimentServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignExperimentServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_experiment( - self, - request: campaign_experiment_service.GetCampaignExperimentRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_experiment.CampaignExperiment: - r"""Returns the requested campaign experiment in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignExperimentRequest`): - The request object. Request message for - [CampaignExperimentService.GetCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.GetCampaignExperiment]. - resource_name (:class:`str`): - Required. The resource name of the - campaign experiment to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignExperiment: - An A/B experiment that compares the - performance of the base campaign (the - control) and a variation of that - campaign (the experiment). - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.GetCampaignExperimentRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_experiment_service.GetCampaignExperimentRequest - ): - request = campaign_experiment_service.GetCampaignExperimentRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_experiment - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def create_campaign_experiment( - self, - request: campaign_experiment_service.CreateCampaignExperimentRequest = None, - *, - customer_id: str = None, - campaign_experiment: gagr_campaign_experiment.CampaignExperiment = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Creates a campaign experiment based on a campaign - draft. The draft campaign will be forked into a real - campaign (called the experiment campaign) that will - begin serving ads if successfully created. - - The campaign experiment is created immediately with - status INITIALIZING. This method return a long running - operation that tracks the forking of the draft campaign. - If the forking fails, a list of errors can be retrieved - using the ListCampaignExperimentAsyncErrors method. The - operation's metadata will be a StringValue containing - the resource name of the created campaign experiment. - - Args: - request (:class:`google.ads.googleads.v6.services.types.CreateCampaignExperimentRequest`): - The request object. Request message for - [CampaignExperimentService.CreateCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.CreateCampaignExperiment]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign experiment is being - created. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - campaign_experiment (:class:`google.ads.googleads.v6.resources.types.CampaignExperiment`): - Required. The campaign experiment to - be created. - - This corresponds to the ``campaign_experiment`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - The JSON representation for Empty is empty JSON - object {}. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, campaign_experiment]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.CreateCampaignExperimentRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_experiment_service.CreateCampaignExperimentRequest - ): - request = campaign_experiment_service.CreateCampaignExperimentRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if campaign_experiment is not None: - request.campaign_experiment = campaign_experiment - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_campaign_experiment - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty.Empty, - metadata_type=campaign_experiment_service.CreateCampaignExperimentMetadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_experiments( - self, - request: campaign_experiment_service.MutateCampaignExperimentsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_experiment_service.CampaignExperimentOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_experiment_service.MutateCampaignExperimentsResponse: - r"""Updates campaign experiments. Operation statuses are - returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignExperimentsRequest`): - The request object. Request message for - [CampaignExperimentService.MutateCampaignExperiments][google.ads.googleads.v6.services.CampaignExperimentService.MutateCampaignExperiments]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign experiments are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignExperimentOperation]`): - Required. The list of operations to - perform on individual campaign - experiments. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignExperimentsResponse: - Response message for campaign - experiment mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.MutateCampaignExperimentsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_experiment_service.MutateCampaignExperimentsRequest, - ): - request = campaign_experiment_service.MutateCampaignExperimentsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_experiments - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def graduate_campaign_experiment( - self, - request: campaign_experiment_service.GraduateCampaignExperimentRequest = None, - *, - campaign_experiment: str = None, - campaign_budget: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_experiment_service.GraduateCampaignExperimentResponse: - r"""Graduates a campaign experiment to a full campaign. - The base and experiment campaigns will start running - independently with their own budgets. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GraduateCampaignExperimentRequest`): - The request object. Request message for - [CampaignExperimentService.GraduateCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.GraduateCampaignExperiment]. - campaign_experiment (:class:`str`): - Required. The resource name of the - campaign experiment to graduate. - - This corresponds to the ``campaign_experiment`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - campaign_budget (:class:`str`): - Required. Resource name of the budget - to attach to the campaign graduated from - the experiment. - - This corresponds to the ``campaign_budget`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GraduateCampaignExperimentResponse: - Response message for campaign - experiment graduate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([campaign_experiment, campaign_budget]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.GraduateCampaignExperimentRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_experiment_service.GraduateCampaignExperimentRequest, - ): - request = campaign_experiment_service.GraduateCampaignExperimentRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if campaign_experiment is not None: - request.campaign_experiment = campaign_experiment - if campaign_budget is not None: - request.campaign_budget = campaign_budget - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.graduate_campaign_experiment - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("campaign_experiment", request.campaign_experiment),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def promote_campaign_experiment( - self, - request: campaign_experiment_service.PromoteCampaignExperimentRequest = None, - *, - campaign_experiment: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Promotes the changes in a experiment campaign back to - the base campaign. - The campaign experiment is updated immediately with - status PROMOTING. This method return a long running - operation that tracks the promoting of the experiment - campaign. If the promoting fails, a list of errors can - be retrieved using the ListCampaignExperimentAsyncErrors - method. - - Args: - request (:class:`google.ads.googleads.v6.services.types.PromoteCampaignExperimentRequest`): - The request object. Request message for - [CampaignExperimentService.PromoteCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.PromoteCampaignExperiment]. - campaign_experiment (:class:`str`): - Required. The resource name of the - campaign experiment to promote. - - This corresponds to the ``campaign_experiment`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - The JSON representation for Empty is empty JSON - object {}. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([campaign_experiment]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.PromoteCampaignExperimentRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_experiment_service.PromoteCampaignExperimentRequest, - ): - request = campaign_experiment_service.PromoteCampaignExperimentRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if campaign_experiment is not None: - request.campaign_experiment = campaign_experiment - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.promote_campaign_experiment - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("campaign_experiment", request.campaign_experiment),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty.Empty, - metadata_type=empty.Empty, - ) - - # Done; return the response. - return response - - def end_campaign_experiment( - self, - request: campaign_experiment_service.EndCampaignExperimentRequest = None, - *, - campaign_experiment: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Immediately ends a campaign experiment, changing the - experiment's scheduled end date and without waiting for - end of day. End date is updated to be the time of the - request. - - Args: - request (:class:`google.ads.googleads.v6.services.types.EndCampaignExperimentRequest`): - The request object. Request message for - [CampaignExperimentService.EndCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.EndCampaignExperiment]. - campaign_experiment (:class:`str`): - Required. The resource name of the - campaign experiment to end. - - This corresponds to the ``campaign_experiment`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([campaign_experiment]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.EndCampaignExperimentRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_experiment_service.EndCampaignExperimentRequest - ): - request = campaign_experiment_service.EndCampaignExperimentRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if campaign_experiment is not None: - request.campaign_experiment = campaign_experiment - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.end_campaign_experiment - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("campaign_experiment", request.campaign_experiment),) - ), - ) - - # Send the request. - rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - def list_campaign_experiment_async_errors( - self, - request: campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCampaignExperimentAsyncErrorsPager: - r"""Returns all errors that occurred during - CampaignExperiment create or promote (whichever occurred - last). Supports standard list paging. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListCampaignExperimentAsyncErrorsRequest`): - The request object. Request message for - [CampaignExperimentService.ListCampaignExperimentAsyncErrors][google.ads.googleads.v6.services.CampaignExperimentService.ListCampaignExperimentAsyncErrors]. - resource_name (:class:`str`): - Required. The name of the campaign - experiment from which to retrieve the - async errors. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.campaign_experiment_service.pagers.ListCampaignExperimentAsyncErrorsPager: - Response message for - [CampaignExperimentService.ListCampaignExperimentAsyncErrors][google.ads.googleads.v6.services.CampaignExperimentService.ListCampaignExperimentAsyncErrors]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest, - ): - request = campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_campaign_experiment_async_errors - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCampaignExperimentAsyncErrorsPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignExperimentServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/pagers.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/pagers.py deleted file mode 100644 index 064449521..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/pagers.py +++ /dev/null @@ -1,93 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.services.types import campaign_experiment_service -from google.rpc import status_pb2 as status # type: ignore - - -class ListCampaignExperimentAsyncErrorsPager: - """A pager for iterating through ``list_campaign_experiment_async_errors`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.ListCampaignExperimentAsyncErrorsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``errors`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListCampaignExperimentAsyncErrors`` requests and continue to iterate - through the ``errors`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.ListCampaignExperimentAsyncErrorsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[ - ..., - campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse, - ], - request: campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest, - response: campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.ListCampaignExperimentAsyncErrorsRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.ListCampaignExperimentAsyncErrorsResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest( - request - ) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages( - self, - ) -> Iterable[ - campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse - ]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__(self) -> Iterable[status.Status]: - for page in self.pages: - yield from page.errors - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/__init__.py deleted file mode 100644 index 6811f5b53..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignExperimentServiceTransport -from .grpc import CampaignExperimentServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignExperimentServiceTransport]] -_transport_registry["grpc"] = CampaignExperimentServiceGrpcTransport - - -__all__ = ( - "CampaignExperimentServiceTransport", - "CampaignExperimentServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/base.py deleted file mode 100644 index 6bc2fbf2b..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/base.py +++ /dev/null @@ -1,193 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_experiment -from google.ads.googleads.v6.services.types import campaign_experiment_service -from google.longrunning import operations_pb2 as operations # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignExperimentServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignExperimentService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_experiment: gapic_v1.method.wrap_method( - self.get_campaign_experiment, - default_timeout=None, - client_info=client_info, - ), - self.create_campaign_experiment: gapic_v1.method.wrap_method( - self.create_campaign_experiment, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_experiments: gapic_v1.method.wrap_method( - self.mutate_campaign_experiments, - default_timeout=None, - client_info=client_info, - ), - self.graduate_campaign_experiment: gapic_v1.method.wrap_method( - self.graduate_campaign_experiment, - default_timeout=None, - client_info=client_info, - ), - self.promote_campaign_experiment: gapic_v1.method.wrap_method( - self.promote_campaign_experiment, - default_timeout=None, - client_info=client_info, - ), - self.end_campaign_experiment: gapic_v1.method.wrap_method( - self.end_campaign_experiment, - default_timeout=None, - client_info=client_info, - ), - self.list_campaign_experiment_async_errors: gapic_v1.method.wrap_method( - self.list_campaign_experiment_async_errors, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Return the client designed to process long-running operations.""" - raise NotImplementedError - - @property - def get_campaign_experiment( - self, - ) -> typing.Callable[ - [campaign_experiment_service.GetCampaignExperimentRequest], - campaign_experiment.CampaignExperiment, - ]: - raise NotImplementedError - - @property - def create_campaign_experiment( - self, - ) -> typing.Callable[ - [campaign_experiment_service.CreateCampaignExperimentRequest], - operations.Operation, - ]: - raise NotImplementedError - - @property - def mutate_campaign_experiments( - self, - ) -> typing.Callable[ - [campaign_experiment_service.MutateCampaignExperimentsRequest], - campaign_experiment_service.MutateCampaignExperimentsResponse, - ]: - raise NotImplementedError - - @property - def graduate_campaign_experiment( - self, - ) -> typing.Callable[ - [campaign_experiment_service.GraduateCampaignExperimentRequest], - campaign_experiment_service.GraduateCampaignExperimentResponse, - ]: - raise NotImplementedError - - @property - def promote_campaign_experiment( - self, - ) -> typing.Callable[ - [campaign_experiment_service.PromoteCampaignExperimentRequest], - operations.Operation, - ]: - raise NotImplementedError - - @property - def end_campaign_experiment( - self, - ) -> typing.Callable[ - [campaign_experiment_service.EndCampaignExperimentRequest], empty.Empty - ]: - raise NotImplementedError - - @property - def list_campaign_experiment_async_errors( - self, - ) -> typing.Callable[ - [campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest], - campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignExperimentServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/grpc.py deleted file mode 100644 index 92c76fd19..000000000 --- a/google/ads/googleads/v6/services/services/campaign_experiment_service/transports/grpc.py +++ /dev/null @@ -1,490 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_experiment -from google.ads.googleads.v6.services.types import campaign_experiment_service -from google.longrunning import operations_pb2 as operations # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore - -from .base import CampaignExperimentServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignExperimentServiceGrpcTransport( - CampaignExperimentServiceTransport -): - """gRPC backend transport for CampaignExperimentService. - - CampaignExperimentService manages the life cycle of campaign - experiments. It is used to create new experiments from drafts, - modify experiment properties, promote changes in an experiment - back to its base campaign, graduate experiments into new stand- - alone campaigns, and to remove an experiment. - - An experiment consists of two variants or arms - the base - campaign and the experiment campaign, directing a fixed share of - traffic to each arm. A campaign experiment is created from a - draft of changes to the base campaign and will be a snapshot of - changes in the draft at the time of creation. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Sanity check: Only create a new client if we do not already have one. - if "operations_client" not in self.__dict__: - self.__dict__["operations_client"] = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self.__dict__["operations_client"] - - @property - def get_campaign_experiment( - self, - ) -> Callable[ - [campaign_experiment_service.GetCampaignExperimentRequest], - campaign_experiment.CampaignExperiment, - ]: - r"""Return a callable for the get campaign experiment method over gRPC. - - Returns the requested campaign experiment in full - detail. - - Returns: - Callable[[~.GetCampaignExperimentRequest], - ~.CampaignExperiment]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_experiment" not in self._stubs: - self._stubs[ - "get_campaign_experiment" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/GetCampaignExperiment", - request_serializer=campaign_experiment_service.GetCampaignExperimentRequest.serialize, - response_deserializer=campaign_experiment.CampaignExperiment.deserialize, - ) - return self._stubs["get_campaign_experiment"] - - @property - def create_campaign_experiment( - self, - ) -> Callable[ - [campaign_experiment_service.CreateCampaignExperimentRequest], - operations.Operation, - ]: - r"""Return a callable for the create campaign experiment method over gRPC. - - Creates a campaign experiment based on a campaign - draft. The draft campaign will be forked into a real - campaign (called the experiment campaign) that will - begin serving ads if successfully created. - - The campaign experiment is created immediately with - status INITIALIZING. This method return a long running - operation that tracks the forking of the draft campaign. - If the forking fails, a list of errors can be retrieved - using the ListCampaignExperimentAsyncErrors method. The - operation's metadata will be a StringValue containing - the resource name of the created campaign experiment. - - Returns: - Callable[[~.CreateCampaignExperimentRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_campaign_experiment" not in self._stubs: - self._stubs[ - "create_campaign_experiment" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/CreateCampaignExperiment", - request_serializer=campaign_experiment_service.CreateCampaignExperimentRequest.serialize, - response_deserializer=operations.Operation.FromString, - ) - return self._stubs["create_campaign_experiment"] - - @property - def mutate_campaign_experiments( - self, - ) -> Callable[ - [campaign_experiment_service.MutateCampaignExperimentsRequest], - campaign_experiment_service.MutateCampaignExperimentsResponse, - ]: - r"""Return a callable for the mutate campaign experiments method over gRPC. - - Updates campaign experiments. Operation statuses are - returned. - - Returns: - Callable[[~.MutateCampaignExperimentsRequest], - ~.MutateCampaignExperimentsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_experiments" not in self._stubs: - self._stubs[ - "mutate_campaign_experiments" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/MutateCampaignExperiments", - request_serializer=campaign_experiment_service.MutateCampaignExperimentsRequest.serialize, - response_deserializer=campaign_experiment_service.MutateCampaignExperimentsResponse.deserialize, - ) - return self._stubs["mutate_campaign_experiments"] - - @property - def graduate_campaign_experiment( - self, - ) -> Callable[ - [campaign_experiment_service.GraduateCampaignExperimentRequest], - campaign_experiment_service.GraduateCampaignExperimentResponse, - ]: - r"""Return a callable for the graduate campaign experiment method over gRPC. - - Graduates a campaign experiment to a full campaign. - The base and experiment campaigns will start running - independently with their own budgets. - - Returns: - Callable[[~.GraduateCampaignExperimentRequest], - ~.GraduateCampaignExperimentResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "graduate_campaign_experiment" not in self._stubs: - self._stubs[ - "graduate_campaign_experiment" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/GraduateCampaignExperiment", - request_serializer=campaign_experiment_service.GraduateCampaignExperimentRequest.serialize, - response_deserializer=campaign_experiment_service.GraduateCampaignExperimentResponse.deserialize, - ) - return self._stubs["graduate_campaign_experiment"] - - @property - def promote_campaign_experiment( - self, - ) -> Callable[ - [campaign_experiment_service.PromoteCampaignExperimentRequest], - operations.Operation, - ]: - r"""Return a callable for the promote campaign experiment method over gRPC. - - Promotes the changes in a experiment campaign back to - the base campaign. - The campaign experiment is updated immediately with - status PROMOTING. This method return a long running - operation that tracks the promoting of the experiment - campaign. If the promoting fails, a list of errors can - be retrieved using the ListCampaignExperimentAsyncErrors - method. - - Returns: - Callable[[~.PromoteCampaignExperimentRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "promote_campaign_experiment" not in self._stubs: - self._stubs[ - "promote_campaign_experiment" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/PromoteCampaignExperiment", - request_serializer=campaign_experiment_service.PromoteCampaignExperimentRequest.serialize, - response_deserializer=operations.Operation.FromString, - ) - return self._stubs["promote_campaign_experiment"] - - @property - def end_campaign_experiment( - self, - ) -> Callable[ - [campaign_experiment_service.EndCampaignExperimentRequest], empty.Empty - ]: - r"""Return a callable for the end campaign experiment method over gRPC. - - Immediately ends a campaign experiment, changing the - experiment's scheduled end date and without waiting for - end of day. End date is updated to be the time of the - request. - - Returns: - Callable[[~.EndCampaignExperimentRequest], - ~.Empty]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "end_campaign_experiment" not in self._stubs: - self._stubs[ - "end_campaign_experiment" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/EndCampaignExperiment", - request_serializer=campaign_experiment_service.EndCampaignExperimentRequest.serialize, - response_deserializer=empty.Empty.FromString, - ) - return self._stubs["end_campaign_experiment"] - - @property - def list_campaign_experiment_async_errors( - self, - ) -> Callable[ - [campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest], - campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse, - ]: - r"""Return a callable for the list campaign experiment async - errors method over gRPC. - - Returns all errors that occurred during - CampaignExperiment create or promote (whichever occurred - last). Supports standard list paging. - - Returns: - Callable[[~.ListCampaignExperimentAsyncErrorsRequest], - ~.ListCampaignExperimentAsyncErrorsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_campaign_experiment_async_errors" not in self._stubs: - self._stubs[ - "list_campaign_experiment_async_errors" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExperimentService/ListCampaignExperimentAsyncErrors", - request_serializer=campaign_experiment_service.ListCampaignExperimentAsyncErrorsRequest.serialize, - response_deserializer=campaign_experiment_service.ListCampaignExperimentAsyncErrorsResponse.deserialize, - ) - return self._stubs["list_campaign_experiment_async_errors"] - - -__all__ = ("CampaignExperimentServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_extension_setting_service/__init__.py deleted file mode 100644 index c09e9fa02..000000000 --- a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignExtensionSettingServiceClient - -__all__ = ("CampaignExtensionSettingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/__init__.py deleted file mode 100644 index e79c8e90f..000000000 --- a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignExtensionSettingServiceTransport -from .grpc import CampaignExtensionSettingServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignExtensionSettingServiceTransport]] -_transport_registry["grpc"] = CampaignExtensionSettingServiceGrpcTransport - - -__all__ = ( - "CampaignExtensionSettingServiceTransport", - "CampaignExtensionSettingServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/base.py deleted file mode 100644 index 76f7bab62..000000000 --- a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/base.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_extension_setting -from google.ads.googleads.v6.services.types import ( - campaign_extension_setting_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignExtensionSettingServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignExtensionSettingService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_extension_setting: gapic_v1.method.wrap_method( - self.get_campaign_extension_setting, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_extension_settings: gapic_v1.method.wrap_method( - self.mutate_campaign_extension_settings, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_extension_setting( - self, - ) -> typing.Callable[ - [campaign_extension_setting_service.GetCampaignExtensionSettingRequest], - campaign_extension_setting.CampaignExtensionSetting, - ]: - raise NotImplementedError - - @property - def mutate_campaign_extension_settings( - self, - ) -> typing.Callable[ - [ - campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest - ], - campaign_extension_setting_service.MutateCampaignExtensionSettingsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignExtensionSettingServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/grpc.py deleted file mode 100644 index 172e46592..000000000 --- a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/transports/grpc.py +++ /dev/null @@ -1,286 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_extension_setting -from google.ads.googleads.v6.services.types import ( - campaign_extension_setting_service, -) - -from .base import CampaignExtensionSettingServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignExtensionSettingServiceGrpcTransport( - CampaignExtensionSettingServiceTransport -): - """gRPC backend transport for CampaignExtensionSettingService. - - Service to manage campaign extension settings. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_extension_setting( - self, - ) -> Callable[ - [campaign_extension_setting_service.GetCampaignExtensionSettingRequest], - campaign_extension_setting.CampaignExtensionSetting, - ]: - r"""Return a callable for the get campaign extension setting method over gRPC. - - Returns the requested campaign extension setting in - full detail. - - Returns: - Callable[[~.GetCampaignExtensionSettingRequest], - ~.CampaignExtensionSetting]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_extension_setting" not in self._stubs: - self._stubs[ - "get_campaign_extension_setting" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExtensionSettingService/GetCampaignExtensionSetting", - request_serializer=campaign_extension_setting_service.GetCampaignExtensionSettingRequest.serialize, - response_deserializer=campaign_extension_setting.CampaignExtensionSetting.deserialize, - ) - return self._stubs["get_campaign_extension_setting"] - - @property - def mutate_campaign_extension_settings( - self, - ) -> Callable[ - [ - campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest - ], - campaign_extension_setting_service.MutateCampaignExtensionSettingsResponse, - ]: - r"""Return a callable for the mutate campaign extension - settings method over gRPC. - - Creates, updates, or removes campaign extension - settings. Operation statuses are returned. - - Returns: - Callable[[~.MutateCampaignExtensionSettingsRequest], - ~.MutateCampaignExtensionSettingsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_extension_settings" not in self._stubs: - self._stubs[ - "mutate_campaign_extension_settings" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignExtensionSettingService/MutateCampaignExtensionSettings", - request_serializer=campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest.serialize, - response_deserializer=campaign_extension_setting_service.MutateCampaignExtensionSettingsResponse.deserialize, - ) - return self._stubs["mutate_campaign_extension_settings"] - - -__all__ = ("CampaignExtensionSettingServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_feed_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_feed_service/__init__.py deleted file mode 100644 index 66d8d73cb..000000000 --- a/google/ads/googleads/v6/services/services/campaign_feed_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignFeedServiceClient - -__all__ = ("CampaignFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_feed_service/client.py b/google/ads/googleads/v6/services/services/campaign_feed_service/client.py deleted file mode 100644 index c377e98e1..000000000 --- a/google/ads/googleads/v6/services/services/campaign_feed_service/client.py +++ /dev/null @@ -1,563 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_feed -from google.ads.googleads.v6.services.types import campaign_feed_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignFeedServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignFeedServiceGrpcTransport - - -class CampaignFeedServiceClientMeta(type): - """Metaclass for the CampaignFeedService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignFeedServiceTransport]] - _transport_registry["grpc"] = CampaignFeedServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignFeedServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignFeedServiceClient(metaclass=CampaignFeedServiceClientMeta): - """Service to manage campaign feeds.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignFeedServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignFeedServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_feed_path( - customer_id: str, campaign_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified campaign_feed string.""" - return "customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}".format( - customer_id=customer_id, campaign_id=campaign_id, feed_id=feed_id, - ) - - @staticmethod - def parse_campaign_feed_path(path: str) -> Dict[str, str]: - """Parse a campaign_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignFeedServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign feed service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignFeedServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignFeedServiceTransport): - # transport is a CampaignFeedServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignFeedServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_feed( - self, - request: campaign_feed_service.GetCampaignFeedRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_feed.CampaignFeed: - r"""Returns the requested campaign feed in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignFeedRequest`): - The request object. Request message for - [CampaignFeedService.GetCampaignFeed][google.ads.googleads.v6.services.CampaignFeedService.GetCampaignFeed]. - resource_name (:class:`str`): - Required. The resource name of the - campaign feed to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignFeed: - A campaign feed. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_feed_service.GetCampaignFeedRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_feed_service.GetCampaignFeedRequest - ): - request = campaign_feed_service.GetCampaignFeedRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_feed - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_feeds( - self, - request: campaign_feed_service.MutateCampaignFeedsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_feed_service.CampaignFeedOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_feed_service.MutateCampaignFeedsResponse: - r"""Creates, updates, or removes campaign feeds. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignFeedsRequest`): - The request object. Request message for - [CampaignFeedService.MutateCampaignFeeds][google.ads.googleads.v6.services.CampaignFeedService.MutateCampaignFeeds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign feeds are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignFeedOperation]`): - Required. The list of operations to - perform on individual campaign feeds. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignFeedsResponse: - Response message for a campaign feed - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_feed_service.MutateCampaignFeedsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_feed_service.MutateCampaignFeedsRequest - ): - request = campaign_feed_service.MutateCampaignFeedsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_feeds - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_feed_service/transports/__init__.py deleted file mode 100644 index 4c8740e66..000000000 --- a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignFeedServiceTransport -from .grpc import CampaignFeedServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignFeedServiceTransport]] -_transport_registry["grpc"] = CampaignFeedServiceGrpcTransport - - -__all__ = ( - "CampaignFeedServiceTransport", - "CampaignFeedServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_feed_service/transports/base.py deleted file mode 100644 index 90f7a4652..000000000 --- a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_feed -from google.ads.googleads.v6.services.types import campaign_feed_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignFeedServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignFeedService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_feed: gapic_v1.method.wrap_method( - self.get_campaign_feed, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_feeds: gapic_v1.method.wrap_method( - self.mutate_campaign_feeds, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_feed( - self, - ) -> typing.Callable[ - [campaign_feed_service.GetCampaignFeedRequest], - campaign_feed.CampaignFeed, - ]: - raise NotImplementedError - - @property - def mutate_campaign_feeds( - self, - ) -> typing.Callable[ - [campaign_feed_service.MutateCampaignFeedsRequest], - campaign_feed_service.MutateCampaignFeedsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignFeedServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_feed_service/transports/grpc.py deleted file mode 100644 index eba995456..000000000 --- a/google/ads/googleads/v6/services/services/campaign_feed_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_feed -from google.ads.googleads.v6.services.types import campaign_feed_service - -from .base import CampaignFeedServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignFeedServiceGrpcTransport(CampaignFeedServiceTransport): - """gRPC backend transport for CampaignFeedService. - - Service to manage campaign feeds. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_feed( - self, - ) -> Callable[ - [campaign_feed_service.GetCampaignFeedRequest], - campaign_feed.CampaignFeed, - ]: - r"""Return a callable for the get campaign feed method over gRPC. - - Returns the requested campaign feed in full detail. - - Returns: - Callable[[~.GetCampaignFeedRequest], - ~.CampaignFeed]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_feed" not in self._stubs: - self._stubs["get_campaign_feed"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignFeedService/GetCampaignFeed", - request_serializer=campaign_feed_service.GetCampaignFeedRequest.serialize, - response_deserializer=campaign_feed.CampaignFeed.deserialize, - ) - return self._stubs["get_campaign_feed"] - - @property - def mutate_campaign_feeds( - self, - ) -> Callable[ - [campaign_feed_service.MutateCampaignFeedsRequest], - campaign_feed_service.MutateCampaignFeedsResponse, - ]: - r"""Return a callable for the mutate campaign feeds method over gRPC. - - Creates, updates, or removes campaign feeds. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCampaignFeedsRequest], - ~.MutateCampaignFeedsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_feeds" not in self._stubs: - self._stubs[ - "mutate_campaign_feeds" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignFeedService/MutateCampaignFeeds", - request_serializer=campaign_feed_service.MutateCampaignFeedsRequest.serialize, - response_deserializer=campaign_feed_service.MutateCampaignFeedsResponse.deserialize, - ) - return self._stubs["mutate_campaign_feeds"] - - -__all__ = ("CampaignFeedServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_label_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_label_service/__init__.py deleted file mode 100644 index a1be44e7b..000000000 --- a/google/ads/googleads/v6/services/services/campaign_label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignLabelServiceClient - -__all__ = ("CampaignLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_label_service/client.py b/google/ads/googleads/v6/services/services/campaign_label_service/client.py deleted file mode 100644 index f637fd8ec..000000000 --- a/google/ads/googleads/v6/services/services/campaign_label_service/client.py +++ /dev/null @@ -1,569 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_label -from google.ads.googleads.v6.services.types import campaign_label_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignLabelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignLabelServiceGrpcTransport - - -class CampaignLabelServiceClientMeta(type): - """Metaclass for the CampaignLabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignLabelServiceTransport]] - _transport_registry["grpc"] = CampaignLabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignLabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignLabelServiceClient(metaclass=CampaignLabelServiceClientMeta): - """Service to manage labels on campaigns.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignLabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignLabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_label_path( - customer_id: str, campaign_id: str, label_id: str, - ) -> str: - """Return a fully-qualified campaign_label string.""" - return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format( - customer_id=customer_id, campaign_id=campaign_id, label_id=label_id, - ) - - @staticmethod - def parse_campaign_label_path(path: str) -> Dict[str, str]: - """Parse a campaign_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignLabelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignLabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignLabelServiceTransport): - # transport is a CampaignLabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignLabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign_label( - self, - request: campaign_label_service.GetCampaignLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_label.CampaignLabel: - r"""Returns the requested campaign-label relationship in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignLabelRequest`): - The request object. Request message for - [CampaignLabelService.GetCampaignLabel][google.ads.googleads.v6.services.CampaignLabelService.GetCampaignLabel]. - resource_name (:class:`str`): - Required. The resource name of the - campaign-label relationship to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CampaignLabel: - Represents a relationship between a - campaign and a label. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_label_service.GetCampaignLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_label_service.GetCampaignLabelRequest - ): - request = campaign_label_service.GetCampaignLabelRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_label - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaign_labels( - self, - request: campaign_label_service.MutateCampaignLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - campaign_label_service.CampaignLabelOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_label_service.MutateCampaignLabelsResponse: - r"""Creates and removes campaign-label relationships. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignLabelsRequest`): - The request object. Request message for - [CampaignLabelService.MutateCampaignLabels][google.ads.googleads.v6.services.CampaignLabelService.MutateCampaignLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose - campaign-label relationships are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignLabelOperation]`): - Required. The list of operations to - perform on campaign-label relationships. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignLabelsResponse: - Response message for a campaign - labels mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_label_service.MutateCampaignLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, campaign_label_service.MutateCampaignLabelsRequest - ): - request = campaign_label_service.MutateCampaignLabelsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_labels - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_label_service/transports/__init__.py deleted file mode 100644 index 344d13013..000000000 --- a/google/ads/googleads/v6/services/services/campaign_label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignLabelServiceTransport -from .grpc import CampaignLabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignLabelServiceTransport]] -_transport_registry["grpc"] = CampaignLabelServiceGrpcTransport - - -__all__ = ( - "CampaignLabelServiceTransport", - "CampaignLabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_label_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_label_service/transports/base.py deleted file mode 100644 index 605342086..000000000 --- a/google/ads/googleads/v6/services/services/campaign_label_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_label -from google.ads.googleads.v6.services.types import campaign_label_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignLabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignLabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_label: gapic_v1.method.wrap_method( - self.get_campaign_label, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_labels: gapic_v1.method.wrap_method( - self.mutate_campaign_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_label( - self, - ) -> typing.Callable[ - [campaign_label_service.GetCampaignLabelRequest], - campaign_label.CampaignLabel, - ]: - raise NotImplementedError - - @property - def mutate_campaign_labels( - self, - ) -> typing.Callable[ - [campaign_label_service.MutateCampaignLabelsRequest], - campaign_label_service.MutateCampaignLabelsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignLabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_label_service/transports/grpc.py deleted file mode 100644 index 110d5b20d..000000000 --- a/google/ads/googleads/v6/services/services/campaign_label_service/transports/grpc.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_label -from google.ads.googleads.v6.services.types import campaign_label_service - -from .base import CampaignLabelServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignLabelServiceGrpcTransport(CampaignLabelServiceTransport): - """gRPC backend transport for CampaignLabelService. - - Service to manage labels on campaigns. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_label( - self, - ) -> Callable[ - [campaign_label_service.GetCampaignLabelRequest], - campaign_label.CampaignLabel, - ]: - r"""Return a callable for the get campaign label method over gRPC. - - Returns the requested campaign-label relationship in - full detail. - - Returns: - Callable[[~.GetCampaignLabelRequest], - ~.CampaignLabel]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_label" not in self._stubs: - self._stubs["get_campaign_label"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignLabelService/GetCampaignLabel", - request_serializer=campaign_label_service.GetCampaignLabelRequest.serialize, - response_deserializer=campaign_label.CampaignLabel.deserialize, - ) - return self._stubs["get_campaign_label"] - - @property - def mutate_campaign_labels( - self, - ) -> Callable[ - [campaign_label_service.MutateCampaignLabelsRequest], - campaign_label_service.MutateCampaignLabelsResponse, - ]: - r"""Return a callable for the mutate campaign labels method over gRPC. - - Creates and removes campaign-label relationships. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCampaignLabelsRequest], - ~.MutateCampaignLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_labels" not in self._stubs: - self._stubs[ - "mutate_campaign_labels" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignLabelService/MutateCampaignLabels", - request_serializer=campaign_label_service.MutateCampaignLabelsRequest.serialize, - response_deserializer=campaign_label_service.MutateCampaignLabelsResponse.deserialize, - ) - return self._stubs["mutate_campaign_labels"] - - -__all__ = ("CampaignLabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_service/__init__.py deleted file mode 100644 index 6e8840a70..000000000 --- a/google/ads/googleads/v6/services/services/campaign_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignServiceClient - -__all__ = ("CampaignServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_service/client.py b/google/ads/googleads/v6/services/services/campaign_service/client.py deleted file mode 100644 index ade67b66a..000000000 --- a/google/ads/googleads/v6/services/services/campaign_service/client.py +++ /dev/null @@ -1,603 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import campaign -from google.ads.googleads.v6.services.types import campaign_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CampaignServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CampaignServiceGrpcTransport - - -class CampaignServiceClientMeta(type): - """Metaclass for the CampaignService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CampaignServiceTransport]] - _transport_registry["grpc"] = CampaignServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CampaignServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CampaignServiceClient(metaclass=CampaignServiceClientMeta): - """Service to manage campaigns.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CampaignServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CampaignServiceTransport: - """Return the transport used by the client instance. - - Returns: - CampaignServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def bidding_strategy_path( - customer_id: str, bidding_strategy_id: str, - ) -> str: - """Return a fully-qualified bidding_strategy string.""" - return "customers/{customer_id}/biddingStrategies/{bidding_strategy_id}".format( - customer_id=customer_id, bidding_strategy_id=bidding_strategy_id, - ) - - @staticmethod - def parse_bidding_strategy_path(path: str) -> Dict[str, str]: - """Parse a bidding_strategy path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/biddingStrategies/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_budget_path(customer_id: str, campaign_budget_id: str,) -> str: - """Return a fully-qualified campaign_budget string.""" - return "customers/{customer_id}/campaignBudgets/{campaign_budget_id}".format( - customer_id=customer_id, campaign_budget_id=campaign_budget_id, - ) - - @staticmethod - def parse_campaign_budget_path(path: str) -> Dict[str, str]: - """Parse a campaign_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_label_path( - customer_id: str, campaign_id: str, label_id: str, - ) -> str: - """Return a fully-qualified campaign_label string.""" - return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format( - customer_id=customer_id, campaign_id=campaign_id, label_id=label_id, - ) - - @staticmethod - def parse_campaign_label_path(path: str) -> Dict[str, str]: - """Parse a campaign_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def conversion_action_path( - customer_id: str, conversion_action_id: str, - ) -> str: - """Return a fully-qualified conversion_action string.""" - return "customers/{customer_id}/conversionActions/{conversion_action_id}".format( - customer_id=customer_id, conversion_action_id=conversion_action_id, - ) - - @staticmethod - def parse_conversion_action_path(path: str) -> Dict[str, str]: - """Parse a conversion_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/conversionActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the campaign service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CampaignServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignServiceTransport): - # transport is a CampaignServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CampaignServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_campaign( - self, - request: campaign_service.GetCampaignRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign.Campaign: - r"""Returns the requested campaign in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignRequest`): - The request object. Request message for - [CampaignService.GetCampaign][google.ads.googleads.v6.services.CampaignService.GetCampaign]. - resource_name (:class:`str`): - Required. The resource name of the - campaign to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Campaign: - A campaign. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_service.GetCampaignRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, campaign_service.GetCampaignRequest): - request = campaign_service.GetCampaignRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_campaign] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_campaigns( - self, - request: campaign_service.MutateCampaignsRequest = None, - *, - customer_id: str = None, - operations: Sequence[campaign_service.CampaignOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_service.MutateCampaignsResponse: - r"""Creates, updates, or removes campaigns. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignsRequest`): - The request object. Request message for - [CampaignService.MutateCampaigns][google.ads.googleads.v6.services.CampaignService.MutateCampaigns]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaigns are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignOperation]`): - Required. The list of operations to - perform on individual campaigns. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCampaignsResponse: - Response message for campaign mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a campaign_service.MutateCampaignsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, campaign_service.MutateCampaignsRequest): - request = campaign_service.MutateCampaignsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_campaigns] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CampaignServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_service/transports/__init__.py deleted file mode 100644 index 4870a854b..000000000 --- a/google/ads/googleads/v6/services/services/campaign_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignServiceTransport -from .grpc import CampaignServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignServiceTransport]] -_transport_registry["grpc"] = CampaignServiceGrpcTransport - - -__all__ = ( - "CampaignServiceTransport", - "CampaignServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_service/transports/base.py deleted file mode 100644 index 2cb23e71f..000000000 --- a/google/ads/googleads/v6/services/services/campaign_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign -from google.ads.googleads.v6.services.types import campaign_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign: gapic_v1.method.wrap_method( - self.get_campaign, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaigns: gapic_v1.method.wrap_method( - self.mutate_campaigns, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign( - self, - ) -> typing.Callable[ - [campaign_service.GetCampaignRequest], campaign.Campaign - ]: - raise NotImplementedError - - @property - def mutate_campaigns( - self, - ) -> typing.Callable[ - [campaign_service.MutateCampaignsRequest], - campaign_service.MutateCampaignsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_service/transports/grpc.py deleted file mode 100644 index b613cfc5c..000000000 --- a/google/ads/googleads/v6/services/services/campaign_service/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign -from google.ads.googleads.v6.services.types import campaign_service - -from .base import CampaignServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignServiceGrpcTransport(CampaignServiceTransport): - """gRPC backend transport for CampaignService. - - Service to manage campaigns. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign( - self, - ) -> Callable[[campaign_service.GetCampaignRequest], campaign.Campaign]: - r"""Return a callable for the get campaign method over gRPC. - - Returns the requested campaign in full detail. - - Returns: - Callable[[~.GetCampaignRequest], - ~.Campaign]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign" not in self._stubs: - self._stubs["get_campaign"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignService/GetCampaign", - request_serializer=campaign_service.GetCampaignRequest.serialize, - response_deserializer=campaign.Campaign.deserialize, - ) - return self._stubs["get_campaign"] - - @property - def mutate_campaigns( - self, - ) -> Callable[ - [campaign_service.MutateCampaignsRequest], - campaign_service.MutateCampaignsResponse, - ]: - r"""Return a callable for the mutate campaigns method over gRPC. - - Creates, updates, or removes campaigns. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCampaignsRequest], - ~.MutateCampaignsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaigns" not in self._stubs: - self._stubs["mutate_campaigns"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignService/MutateCampaigns", - request_serializer=campaign_service.MutateCampaignsRequest.serialize, - response_deserializer=campaign_service.MutateCampaignsResponse.deserialize, - ) - return self._stubs["mutate_campaigns"] - - -__all__ = ("CampaignServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_shared_set_service/__init__.py b/google/ads/googleads/v6/services/services/campaign_shared_set_service/__init__.py deleted file mode 100644 index f4810d1cd..000000000 --- a/google/ads/googleads/v6/services/services/campaign_shared_set_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CampaignSharedSetServiceClient - -__all__ = ("CampaignSharedSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/__init__.py b/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/__init__.py deleted file mode 100644 index 0ef03c5b7..000000000 --- a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CampaignSharedSetServiceTransport -from .grpc import CampaignSharedSetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CampaignSharedSetServiceTransport]] -_transport_registry["grpc"] = CampaignSharedSetServiceGrpcTransport - - -__all__ = ( - "CampaignSharedSetServiceTransport", - "CampaignSharedSetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/base.py b/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/base.py deleted file mode 100644 index 419603b0d..000000000 --- a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_shared_set -from google.ads.googleads.v6.services.types import campaign_shared_set_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CampaignSharedSetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CampaignSharedSetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_campaign_shared_set: gapic_v1.method.wrap_method( - self.get_campaign_shared_set, - default_timeout=None, - client_info=client_info, - ), - self.mutate_campaign_shared_sets: gapic_v1.method.wrap_method( - self.mutate_campaign_shared_sets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_campaign_shared_set( - self, - ) -> typing.Callable[ - [campaign_shared_set_service.GetCampaignSharedSetRequest], - campaign_shared_set.CampaignSharedSet, - ]: - raise NotImplementedError - - @property - def mutate_campaign_shared_sets( - self, - ) -> typing.Callable[ - [campaign_shared_set_service.MutateCampaignSharedSetsRequest], - campaign_shared_set_service.MutateCampaignSharedSetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CampaignSharedSetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/grpc.py b/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/grpc.py deleted file mode 100644 index b62ed38e8..000000000 --- a/google/ads/googleads/v6/services/services/campaign_shared_set_service/transports/grpc.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import campaign_shared_set -from google.ads.googleads.v6.services.types import campaign_shared_set_service - -from .base import CampaignSharedSetServiceTransport, DEFAULT_CLIENT_INFO - - -class CampaignSharedSetServiceGrpcTransport(CampaignSharedSetServiceTransport): - """gRPC backend transport for CampaignSharedSetService. - - Service to manage campaign shared sets. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_campaign_shared_set( - self, - ) -> Callable[ - [campaign_shared_set_service.GetCampaignSharedSetRequest], - campaign_shared_set.CampaignSharedSet, - ]: - r"""Return a callable for the get campaign shared set method over gRPC. - - Returns the requested campaign shared set in full - detail. - - Returns: - Callable[[~.GetCampaignSharedSetRequest], - ~.CampaignSharedSet]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_campaign_shared_set" not in self._stubs: - self._stubs[ - "get_campaign_shared_set" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignSharedSetService/GetCampaignSharedSet", - request_serializer=campaign_shared_set_service.GetCampaignSharedSetRequest.serialize, - response_deserializer=campaign_shared_set.CampaignSharedSet.deserialize, - ) - return self._stubs["get_campaign_shared_set"] - - @property - def mutate_campaign_shared_sets( - self, - ) -> Callable[ - [campaign_shared_set_service.MutateCampaignSharedSetsRequest], - campaign_shared_set_service.MutateCampaignSharedSetsResponse, - ]: - r"""Return a callable for the mutate campaign shared sets method over gRPC. - - Creates or removes campaign shared sets. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCampaignSharedSetsRequest], - ~.MutateCampaignSharedSetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_campaign_shared_sets" not in self._stubs: - self._stubs[ - "mutate_campaign_shared_sets" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignSharedSetService/MutateCampaignSharedSets", - request_serializer=campaign_shared_set_service.MutateCampaignSharedSetsRequest.serialize, - response_deserializer=campaign_shared_set_service.MutateCampaignSharedSetsResponse.deserialize, - ) - return self._stubs["mutate_campaign_shared_sets"] - - -__all__ = ("CampaignSharedSetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/carrier_constant_service/__init__.py b/google/ads/googleads/v6/services/services/carrier_constant_service/__init__.py deleted file mode 100644 index b2369483b..000000000 --- a/google/ads/googleads/v6/services/services/carrier_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CarrierConstantServiceClient - -__all__ = ("CarrierConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/carrier_constant_service/client.py b/google/ads/googleads/v6/services/services/carrier_constant_service/client.py deleted file mode 100644 index 64f5147cf..000000000 --- a/google/ads/googleads/v6/services/services/carrier_constant_service/client.py +++ /dev/null @@ -1,440 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import carrier_constant -from google.ads.googleads.v6.services.types import carrier_constant_service - -from .transports.base import ( - CarrierConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CarrierConstantServiceGrpcTransport - - -class CarrierConstantServiceClientMeta(type): - """Metaclass for the CarrierConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CarrierConstantServiceTransport]] - _transport_registry["grpc"] = CarrierConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CarrierConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CarrierConstantServiceClient(metaclass=CarrierConstantServiceClientMeta): - """Service to fetch carrier constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CarrierConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CarrierConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CarrierConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - CarrierConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def carrier_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified carrier_constant string.""" - return "carrierConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_carrier_constant_path(path: str) -> Dict[str, str]: - """Parse a carrier_constant path into its component segments.""" - m = re.match(r"^carrierConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CarrierConstantServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the carrier constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CarrierConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CarrierConstantServiceTransport): - # transport is a CarrierConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CarrierConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_carrier_constant( - self, - request: carrier_constant_service.GetCarrierConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> carrier_constant.CarrierConstant: - r"""Returns the requested carrier constant in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCarrierConstantRequest`): - The request object. Request message for - [CarrierConstantService.GetCarrierConstant][google.ads.googleads.v6.services.CarrierConstantService.GetCarrierConstant]. - resource_name (:class:`str`): - Required. Resource name of the - carrier constant to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CarrierConstant: - A carrier criterion that can be used - in campaign targeting. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a carrier_constant_service.GetCarrierConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, carrier_constant_service.GetCarrierConstantRequest - ): - request = carrier_constant_service.GetCarrierConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_carrier_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CarrierConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/carrier_constant_service/transports/__init__.py deleted file mode 100644 index bd961880c..000000000 --- a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CarrierConstantServiceTransport -from .grpc import CarrierConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CarrierConstantServiceTransport]] -_transport_registry["grpc"] = CarrierConstantServiceGrpcTransport - - -__all__ = ( - "CarrierConstantServiceTransport", - "CarrierConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/carrier_constant_service/transports/base.py deleted file mode 100644 index 9ab586e18..000000000 --- a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import carrier_constant -from google.ads.googleads.v6.services.types import carrier_constant_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CarrierConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CarrierConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_carrier_constant: gapic_v1.method.wrap_method( - self.get_carrier_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_carrier_constant( - self, - ) -> typing.Callable[ - [carrier_constant_service.GetCarrierConstantRequest], - carrier_constant.CarrierConstant, - ]: - raise NotImplementedError - - -__all__ = ("CarrierConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/carrier_constant_service/transports/grpc.py deleted file mode 100644 index 22784adee..000000000 --- a/google/ads/googleads/v6/services/services/carrier_constant_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import carrier_constant -from google.ads.googleads.v6.services.types import carrier_constant_service - -from .base import CarrierConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class CarrierConstantServiceGrpcTransport(CarrierConstantServiceTransport): - """gRPC backend transport for CarrierConstantService. - - Service to fetch carrier constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_carrier_constant( - self, - ) -> Callable[ - [carrier_constant_service.GetCarrierConstantRequest], - carrier_constant.CarrierConstant, - ]: - r"""Return a callable for the get carrier constant method over gRPC. - - Returns the requested carrier constant in full - detail. - - Returns: - Callable[[~.GetCarrierConstantRequest], - ~.CarrierConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_carrier_constant" not in self._stubs: - self._stubs["get_carrier_constant"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CarrierConstantService/GetCarrierConstant", - request_serializer=carrier_constant_service.GetCarrierConstantRequest.serialize, - response_deserializer=carrier_constant.CarrierConstant.deserialize, - ) - return self._stubs["get_carrier_constant"] - - -__all__ = ("CarrierConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/change_status_service/__init__.py b/google/ads/googleads/v6/services/services/change_status_service/__init__.py deleted file mode 100644 index 63471627d..000000000 --- a/google/ads/googleads/v6/services/services/change_status_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ChangeStatusServiceClient - -__all__ = ("ChangeStatusServiceClient",) diff --git a/google/ads/googleads/v6/services/services/change_status_service/client.py b/google/ads/googleads/v6/services/services/change_status_service/client.py deleted file mode 100644 index 4530e283c..000000000 --- a/google/ads/googleads/v6/services/services/change_status_service/client.py +++ /dev/null @@ -1,617 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import change_status -from google.ads.googleads.v6.services.types import change_status_service - -from .transports.base import ChangeStatusServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ChangeStatusServiceGrpcTransport - - -class ChangeStatusServiceClientMeta(type): - """Metaclass for the ChangeStatusService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ChangeStatusServiceTransport]] - _transport_registry["grpc"] = ChangeStatusServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ChangeStatusServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ChangeStatusServiceClient(metaclass=ChangeStatusServiceClientMeta): - """Service to fetch change statuses.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ChangeStatusServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ChangeStatusServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ChangeStatusServiceTransport: - """Return the transport used by the client instance. - - Returns: - ChangeStatusServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_bid_modifier_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_bid_modifier string.""" - return "customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a ad_group_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_feed_path( - customer_id: str, ad_group_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified ad_group_feed string.""" - return "customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, feed_id=feed_id, - ) - - @staticmethod - def parse_ad_group_feed_path(path: str) -> Dict[str, str]: - """Parse a ad_group_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_criterion_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_criterion string.""" - return "customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_criterion_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_feed_path( - customer_id: str, campaign_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified campaign_feed string.""" - return "customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}".format( - customer_id=customer_id, campaign_id=campaign_id, feed_id=feed_id, - ) - - @staticmethod - def parse_campaign_feed_path(path: str) -> Dict[str, str]: - """Parse a campaign_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def change_status_path(customer_id: str, change_status_id: str,) -> str: - """Return a fully-qualified change_status string.""" - return "customers/{customer_id}/changeStatus/{change_status_id}".format( - customer_id=customer_id, change_status_id=change_status_id, - ) - - @staticmethod - def parse_change_status_path(path: str) -> Dict[str, str]: - """Parse a change_status path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/changeStatus/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ChangeStatusServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the change status service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ChangeStatusServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ChangeStatusServiceTransport): - # transport is a ChangeStatusServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ChangeStatusServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_change_status( - self, - request: change_status_service.GetChangeStatusRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> change_status.ChangeStatus: - r"""Returns the requested change status in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetChangeStatusRequest`): - The request object. Request message for - '[ChangeStatusService.GetChangeStatus][google.ads.googleads.v6.services.ChangeStatusService.GetChangeStatus]'. - resource_name (:class:`str`): - Required. The resource name of the - change status to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ChangeStatus: - Describes the status of returned - resource. ChangeStatus could have up to - 3 minutes delay to reflect a new change. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a change_status_service.GetChangeStatusRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, change_status_service.GetChangeStatusRequest - ): - request = change_status_service.GetChangeStatusRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_change_status - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ChangeStatusServiceClient",) diff --git a/google/ads/googleads/v6/services/services/change_status_service/transports/__init__.py b/google/ads/googleads/v6/services/services/change_status_service/transports/__init__.py deleted file mode 100644 index 303095125..000000000 --- a/google/ads/googleads/v6/services/services/change_status_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ChangeStatusServiceTransport -from .grpc import ChangeStatusServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ChangeStatusServiceTransport]] -_transport_registry["grpc"] = ChangeStatusServiceGrpcTransport - - -__all__ = ( - "ChangeStatusServiceTransport", - "ChangeStatusServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/change_status_service/transports/base.py b/google/ads/googleads/v6/services/services/change_status_service/transports/base.py deleted file mode 100644 index cf3933edf..000000000 --- a/google/ads/googleads/v6/services/services/change_status_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import change_status -from google.ads.googleads.v6.services.types import change_status_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ChangeStatusServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ChangeStatusService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_change_status: gapic_v1.method.wrap_method( - self.get_change_status, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_change_status( - self, - ) -> typing.Callable[ - [change_status_service.GetChangeStatusRequest], - change_status.ChangeStatus, - ]: - raise NotImplementedError - - -__all__ = ("ChangeStatusServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/change_status_service/transports/grpc.py b/google/ads/googleads/v6/services/services/change_status_service/transports/grpc.py deleted file mode 100644 index 74bedc085..000000000 --- a/google/ads/googleads/v6/services/services/change_status_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import change_status -from google.ads.googleads.v6.services.types import change_status_service - -from .base import ChangeStatusServiceTransport, DEFAULT_CLIENT_INFO - - -class ChangeStatusServiceGrpcTransport(ChangeStatusServiceTransport): - """gRPC backend transport for ChangeStatusService. - - Service to fetch change statuses. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_change_status( - self, - ) -> Callable[ - [change_status_service.GetChangeStatusRequest], - change_status.ChangeStatus, - ]: - r"""Return a callable for the get change status method over gRPC. - - Returns the requested change status in full detail. - - Returns: - Callable[[~.GetChangeStatusRequest], - ~.ChangeStatus]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_change_status" not in self._stubs: - self._stubs["get_change_status"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ChangeStatusService/GetChangeStatus", - request_serializer=change_status_service.GetChangeStatusRequest.serialize, - response_deserializer=change_status.ChangeStatus.deserialize, - ) - return self._stubs["get_change_status"] - - -__all__ = ("ChangeStatusServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/click_view_service/__init__.py b/google/ads/googleads/v6/services/services/click_view_service/__init__.py deleted file mode 100644 index 41ef51f8d..000000000 --- a/google/ads/googleads/v6/services/services/click_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ClickViewServiceClient - -__all__ = ("ClickViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/click_view_service/client.py b/google/ads/googleads/v6/services/services/click_view_service/client.py deleted file mode 100644 index 47df2bdce..000000000 --- a/google/ads/googleads/v6/services/services/click_view_service/client.py +++ /dev/null @@ -1,488 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import click_view -from google.ads.googleads.v6.services.types import click_view_service - -from .transports.base import ClickViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ClickViewServiceGrpcTransport - - -class ClickViewServiceClientMeta(type): - """Metaclass for the ClickViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ClickViewServiceTransport]] - _transport_registry["grpc"] = ClickViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ClickViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ClickViewServiceClient(metaclass=ClickViewServiceClientMeta): - """Service to fetch click views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ClickViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ClickViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ClickViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ClickViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def click_view_path(customer_id: str, date: str, gclid: str,) -> str: - """Return a fully-qualified click_view string.""" - return "customers/{customer_id}/clickViews/{date}~{gclid}".format( - customer_id=customer_id, date=date, gclid=gclid, - ) - - @staticmethod - def parse_click_view_path(path: str) -> Dict[str, str]: - """Parse a click_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/clickViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def user_list_path(customer_id: str, user_list_id: str,) -> str: - """Return a fully-qualified user_list string.""" - return "customers/{customer_id}/userLists/{user_list_id}".format( - customer_id=customer_id, user_list_id=user_list_id, - ) - - @staticmethod - def parse_user_list_path(path: str) -> Dict[str, str]: - """Parse a user_list path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLists/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ClickViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the click view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ClickViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ClickViewServiceTransport): - # transport is a ClickViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ClickViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_click_view( - self, - request: click_view_service.GetClickViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> click_view.ClickView: - r"""Returns the requested click view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetClickViewRequest`): - The request object. Request message for - [ClickViewService.GetClickView][google.ads.googleads.v6.services.ClickViewService.GetClickView]. - resource_name (:class:`str`): - Required. The resource name of the - click view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ClickView: - A click view with metrics aggregated - at each click level, including both - valid and invalid clicks. For non-Search - campaigns, metrics.clicks represents the - number of valid and invalid - interactions. Queries including - ClickView must have a filter limiting - the results to one day and can be - requested for dates back to 90 days - before the time of the request. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a click_view_service.GetClickViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, click_view_service.GetClickViewRequest): - request = click_view_service.GetClickViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_click_view] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ClickViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/click_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/click_view_service/transports/__init__.py deleted file mode 100644 index 71872c479..000000000 --- a/google/ads/googleads/v6/services/services/click_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ClickViewServiceTransport -from .grpc import ClickViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ClickViewServiceTransport]] -_transport_registry["grpc"] = ClickViewServiceGrpcTransport - - -__all__ = ( - "ClickViewServiceTransport", - "ClickViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/click_view_service/transports/base.py b/google/ads/googleads/v6/services/services/click_view_service/transports/base.py deleted file mode 100644 index 14a8d37e0..000000000 --- a/google/ads/googleads/v6/services/services/click_view_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import click_view -from google.ads.googleads.v6.services.types import click_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ClickViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ClickViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_click_view: gapic_v1.method.wrap_method( - self.get_click_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_click_view( - self, - ) -> typing.Callable[ - [click_view_service.GetClickViewRequest], click_view.ClickView - ]: - raise NotImplementedError - - -__all__ = ("ClickViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/click_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/click_view_service/transports/grpc.py deleted file mode 100644 index c0da69f30..000000000 --- a/google/ads/googleads/v6/services/services/click_view_service/transports/grpc.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import click_view -from google.ads.googleads.v6.services.types import click_view_service - -from .base import ClickViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ClickViewServiceGrpcTransport(ClickViewServiceTransport): - """gRPC backend transport for ClickViewService. - - Service to fetch click views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_click_view( - self, - ) -> Callable[ - [click_view_service.GetClickViewRequest], click_view.ClickView - ]: - r"""Return a callable for the get click view method over gRPC. - - Returns the requested click view in full detail. - - Returns: - Callable[[~.GetClickViewRequest], - ~.ClickView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_click_view" not in self._stubs: - self._stubs["get_click_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ClickViewService/GetClickView", - request_serializer=click_view_service.GetClickViewRequest.serialize, - response_deserializer=click_view.ClickView.deserialize, - ) - return self._stubs["get_click_view"] - - -__all__ = ("ClickViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/combined_audience_service/__init__.py b/google/ads/googleads/v6/services/services/combined_audience_service/__init__.py deleted file mode 100644 index db7b8da60..000000000 --- a/google/ads/googleads/v6/services/services/combined_audience_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CombinedAudienceServiceClient - -__all__ = ("CombinedAudienceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/combined_audience_service/client.py b/google/ads/googleads/v6/services/services/combined_audience_service/client.py deleted file mode 100644 index 90dadbe92..000000000 --- a/google/ads/googleads/v6/services/services/combined_audience_service/client.py +++ /dev/null @@ -1,452 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import combined_audience -from google.ads.googleads.v6.services.types import combined_audience_service - -from .transports.base import ( - CombinedAudienceServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CombinedAudienceServiceGrpcTransport - - -class CombinedAudienceServiceClientMeta(type): - """Metaclass for the CombinedAudienceService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CombinedAudienceServiceTransport]] - _transport_registry["grpc"] = CombinedAudienceServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CombinedAudienceServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CombinedAudienceServiceClient( - metaclass=CombinedAudienceServiceClientMeta -): - """Service to manage combined audiences. This service can be - used to list all your combined audiences with metadata, but - won't show the structure and components of the combined - audience. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CombinedAudienceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CombinedAudienceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CombinedAudienceServiceTransport: - """Return the transport used by the client instance. - - Returns: - CombinedAudienceServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def combined_audience_path( - customer_id: str, combined_audience_id: str, - ) -> str: - """Return a fully-qualified combined_audience string.""" - return "customers/{customer_id}/combinedAudiences/{combined_audience_id}".format( - customer_id=customer_id, combined_audience_id=combined_audience_id, - ) - - @staticmethod - def parse_combined_audience_path(path: str) -> Dict[str, str]: - """Parse a combined_audience path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/combinedAudiences/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CombinedAudienceServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the combined audience service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CombinedAudienceServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CombinedAudienceServiceTransport): - # transport is a CombinedAudienceServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CombinedAudienceServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_combined_audience( - self, - request: combined_audience_service.GetCombinedAudienceRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> combined_audience.CombinedAudience: - r"""Returns the requested combined audience in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCombinedAudienceRequest`): - The request object. Request message for - [CombinedAudienceService.GetCombinedAudience][google.ads.googleads.v6.services.CombinedAudienceService.GetCombinedAudience]. - resource_name (:class:`str`): - Required. The resource name of the - combined audience to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CombinedAudience: - Describe a resource for combined - audiences which includes different - audiences. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a combined_audience_service.GetCombinedAudienceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, combined_audience_service.GetCombinedAudienceRequest - ): - request = combined_audience_service.GetCombinedAudienceRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_combined_audience - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CombinedAudienceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/combined_audience_service/transports/__init__.py b/google/ads/googleads/v6/services/services/combined_audience_service/transports/__init__.py deleted file mode 100644 index 7cd3fa61b..000000000 --- a/google/ads/googleads/v6/services/services/combined_audience_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CombinedAudienceServiceTransport -from .grpc import CombinedAudienceServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CombinedAudienceServiceTransport]] -_transport_registry["grpc"] = CombinedAudienceServiceGrpcTransport - - -__all__ = ( - "CombinedAudienceServiceTransport", - "CombinedAudienceServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/combined_audience_service/transports/base.py b/google/ads/googleads/v6/services/services/combined_audience_service/transports/base.py deleted file mode 100644 index 5d5f3391e..000000000 --- a/google/ads/googleads/v6/services/services/combined_audience_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import combined_audience -from google.ads.googleads.v6.services.types import combined_audience_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CombinedAudienceServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CombinedAudienceService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_combined_audience: gapic_v1.method.wrap_method( - self.get_combined_audience, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_combined_audience( - self, - ) -> typing.Callable[ - [combined_audience_service.GetCombinedAudienceRequest], - combined_audience.CombinedAudience, - ]: - raise NotImplementedError - - -__all__ = ("CombinedAudienceServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/combined_audience_service/transports/grpc.py b/google/ads/googleads/v6/services/services/combined_audience_service/transports/grpc.py deleted file mode 100644 index 61edb03d4..000000000 --- a/google/ads/googleads/v6/services/services/combined_audience_service/transports/grpc.py +++ /dev/null @@ -1,250 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import combined_audience -from google.ads.googleads.v6.services.types import combined_audience_service - -from .base import CombinedAudienceServiceTransport, DEFAULT_CLIENT_INFO - - -class CombinedAudienceServiceGrpcTransport(CombinedAudienceServiceTransport): - """gRPC backend transport for CombinedAudienceService. - - Service to manage combined audiences. This service can be - used to list all your combined audiences with metadata, but - won't show the structure and components of the combined - audience. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_combined_audience( - self, - ) -> Callable[ - [combined_audience_service.GetCombinedAudienceRequest], - combined_audience.CombinedAudience, - ]: - r"""Return a callable for the get combined audience method over gRPC. - - Returns the requested combined audience in full - detail. - - Returns: - Callable[[~.GetCombinedAudienceRequest], - ~.CombinedAudience]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_combined_audience" not in self._stubs: - self._stubs[ - "get_combined_audience" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CombinedAudienceService/GetCombinedAudience", - request_serializer=combined_audience_service.GetCombinedAudienceRequest.serialize, - response_deserializer=combined_audience.CombinedAudience.deserialize, - ) - return self._stubs["get_combined_audience"] - - -__all__ = ("CombinedAudienceServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_action_service/__init__.py b/google/ads/googleads/v6/services/services/conversion_action_service/__init__.py deleted file mode 100644 index 4361ba7e2..000000000 --- a/google/ads/googleads/v6/services/services/conversion_action_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ConversionActionServiceClient - -__all__ = ("ConversionActionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_action_service/client.py b/google/ads/googleads/v6/services/services/conversion_action_service/client.py deleted file mode 100644 index d4d1fdc91..000000000 --- a/google/ads/googleads/v6/services/services/conversion_action_service/client.py +++ /dev/null @@ -1,554 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import conversion_action -from google.ads.googleads.v6.services.types import conversion_action_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - ConversionActionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ConversionActionServiceGrpcTransport - - -class ConversionActionServiceClientMeta(type): - """Metaclass for the ConversionActionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ConversionActionServiceTransport]] - _transport_registry["grpc"] = ConversionActionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ConversionActionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ConversionActionServiceClient( - metaclass=ConversionActionServiceClientMeta -): - """Service to manage conversion actions.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionActionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionActionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ConversionActionServiceTransport: - """Return the transport used by the client instance. - - Returns: - ConversionActionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def conversion_action_path( - customer_id: str, conversion_action_id: str, - ) -> str: - """Return a fully-qualified conversion_action string.""" - return "customers/{customer_id}/conversionActions/{conversion_action_id}".format( - customer_id=customer_id, conversion_action_id=conversion_action_id, - ) - - @staticmethod - def parse_conversion_action_path(path: str) -> Dict[str, str]: - """Parse a conversion_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/conversionActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ConversionActionServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the conversion action service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ConversionActionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ConversionActionServiceTransport): - # transport is a ConversionActionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ConversionActionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_conversion_action( - self, - request: conversion_action_service.GetConversionActionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> conversion_action.ConversionAction: - r"""Returns the requested conversion action. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetConversionActionRequest`): - The request object. Request message for - [ConversionActionService.GetConversionAction][google.ads.googleads.v6.services.ConversionActionService.GetConversionAction]. - resource_name (:class:`str`): - Required. The resource name of the - conversion action to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ConversionAction: - A conversion action. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a conversion_action_service.GetConversionActionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, conversion_action_service.GetConversionActionRequest - ): - request = conversion_action_service.GetConversionActionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_conversion_action - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_conversion_actions( - self, - request: conversion_action_service.MutateConversionActionsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - conversion_action_service.ConversionActionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> conversion_action_service.MutateConversionActionsResponse: - r"""Creates, updates or removes conversion actions. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateConversionActionsRequest`): - The request object. Request message for - [ConversionActionService.MutateConversionActions][google.ads.googleads.v6.services.ConversionActionService.MutateConversionActions]. - customer_id (:class:`str`): - Required. The ID of the customer - whose conversion actions are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.ConversionActionOperation]`): - Required. The list of operations to - perform on individual conversion - actions. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateConversionActionsResponse: - Response message for - [ConversionActionService.MutateConversionActions][google.ads.googleads.v6.services.ConversionActionService.MutateConversionActions]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a conversion_action_service.MutateConversionActionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, conversion_action_service.MutateConversionActionsRequest - ): - request = conversion_action_service.MutateConversionActionsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_conversion_actions - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ConversionActionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_action_service/transports/__init__.py b/google/ads/googleads/v6/services/services/conversion_action_service/transports/__init__.py deleted file mode 100644 index c02f1fab5..000000000 --- a/google/ads/googleads/v6/services/services/conversion_action_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ConversionActionServiceTransport -from .grpc import ConversionActionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ConversionActionServiceTransport]] -_transport_registry["grpc"] = ConversionActionServiceGrpcTransport - - -__all__ = ( - "ConversionActionServiceTransport", - "ConversionActionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/conversion_action_service/transports/base.py b/google/ads/googleads/v6/services/services/conversion_action_service/transports/base.py deleted file mode 100644 index 7583e6daa..000000000 --- a/google/ads/googleads/v6/services/services/conversion_action_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import conversion_action -from google.ads.googleads.v6.services.types import conversion_action_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ConversionActionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ConversionActionService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_conversion_action: gapic_v1.method.wrap_method( - self.get_conversion_action, - default_timeout=None, - client_info=client_info, - ), - self.mutate_conversion_actions: gapic_v1.method.wrap_method( - self.mutate_conversion_actions, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_conversion_action( - self, - ) -> typing.Callable[ - [conversion_action_service.GetConversionActionRequest], - conversion_action.ConversionAction, - ]: - raise NotImplementedError - - @property - def mutate_conversion_actions( - self, - ) -> typing.Callable[ - [conversion_action_service.MutateConversionActionsRequest], - conversion_action_service.MutateConversionActionsResponse, - ]: - raise NotImplementedError - - -__all__ = ("ConversionActionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_action_service/transports/grpc.py b/google/ads/googleads/v6/services/services/conversion_action_service/transports/grpc.py deleted file mode 100644 index 2d2b0eaf0..000000000 --- a/google/ads/googleads/v6/services/services/conversion_action_service/transports/grpc.py +++ /dev/null @@ -1,278 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import conversion_action -from google.ads.googleads.v6.services.types import conversion_action_service - -from .base import ConversionActionServiceTransport, DEFAULT_CLIENT_INFO - - -class ConversionActionServiceGrpcTransport(ConversionActionServiceTransport): - """gRPC backend transport for ConversionActionService. - - Service to manage conversion actions. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_conversion_action( - self, - ) -> Callable[ - [conversion_action_service.GetConversionActionRequest], - conversion_action.ConversionAction, - ]: - r"""Return a callable for the get conversion action method over gRPC. - - Returns the requested conversion action. - - Returns: - Callable[[~.GetConversionActionRequest], - ~.ConversionAction]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_conversion_action" not in self._stubs: - self._stubs[ - "get_conversion_action" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ConversionActionService/GetConversionAction", - request_serializer=conversion_action_service.GetConversionActionRequest.serialize, - response_deserializer=conversion_action.ConversionAction.deserialize, - ) - return self._stubs["get_conversion_action"] - - @property - def mutate_conversion_actions( - self, - ) -> Callable[ - [conversion_action_service.MutateConversionActionsRequest], - conversion_action_service.MutateConversionActionsResponse, - ]: - r"""Return a callable for the mutate conversion actions method over gRPC. - - Creates, updates or removes conversion actions. - Operation statuses are returned. - - Returns: - Callable[[~.MutateConversionActionsRequest], - ~.MutateConversionActionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_conversion_actions" not in self._stubs: - self._stubs[ - "mutate_conversion_actions" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ConversionActionService/MutateConversionActions", - request_serializer=conversion_action_service.MutateConversionActionsRequest.serialize, - response_deserializer=conversion_action_service.MutateConversionActionsResponse.deserialize, - ) - return self._stubs["mutate_conversion_actions"] - - -__all__ = ("ConversionActionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/__init__.py b/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/__init__.py deleted file mode 100644 index 673cd42f3..000000000 --- a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ConversionAdjustmentUploadServiceClient - -__all__ = ("ConversionAdjustmentUploadServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/client.py b/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/client.py deleted file mode 100644 index 337c2a056..000000000 --- a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/client.py +++ /dev/null @@ -1,467 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.types import ( - conversion_adjustment_upload_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - ConversionAdjustmentUploadServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ConversionAdjustmentUploadServiceGrpcTransport - - -class ConversionAdjustmentUploadServiceClientMeta(type): - """Metaclass for the ConversionAdjustmentUploadService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ConversionAdjustmentUploadServiceTransport]] - _transport_registry["grpc"] = ConversionAdjustmentUploadServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ConversionAdjustmentUploadServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ConversionAdjustmentUploadServiceClient( - metaclass=ConversionAdjustmentUploadServiceClientMeta -): - """Service to upload conversion adjustments.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionAdjustmentUploadServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionAdjustmentUploadServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ConversionAdjustmentUploadServiceTransport: - """Return the transport used by the client instance. - - Returns: - ConversionAdjustmentUploadServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ConversionAdjustmentUploadServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the conversion adjustment upload service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ConversionAdjustmentUploadServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ConversionAdjustmentUploadServiceTransport): - # transport is a ConversionAdjustmentUploadServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ConversionAdjustmentUploadServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def upload_conversion_adjustments( - self, - request: conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest = None, - *, - customer_id: str = None, - conversion_adjustments: Sequence[ - conversion_adjustment_upload_service.ConversionAdjustment - ] = None, - partial_failure: bool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> conversion_adjustment_upload_service.UploadConversionAdjustmentsResponse: - r"""Processes the given conversion adjustments. - - Args: - request (:class:`google.ads.googleads.v6.services.types.UploadConversionAdjustmentsRequest`): - The request object. Request message for - [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v6.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. - customer_id (:class:`str`): - Required. The ID of the customer - performing the upload. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - conversion_adjustments (:class:`Sequence[google.ads.googleads.v6.services.types.ConversionAdjustment]`): - Required. The conversion adjustments - that are being uploaded. - - This corresponds to the ``conversion_adjustments`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - partial_failure (:class:`bool`): - Required. If true, successful - operations will be carried out and - invalid operations will return errors. - If false, all operations will be carried - out in one transaction if and only if - they are all valid. This should always - be set to true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial- - failures for more information about - partial failure. - - This corresponds to the ``partial_failure`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.UploadConversionAdjustmentsResponse: - Response message for - [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v6.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, conversion_adjustments, partial_failure] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest, - ): - request = conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if conversion_adjustments is not None: - request.conversion_adjustments = conversion_adjustments - if partial_failure is not None: - request.partial_failure = partial_failure - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.upload_conversion_adjustments - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ConversionAdjustmentUploadServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/__init__.py b/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/__init__.py deleted file mode 100644 index db50ebfe8..000000000 --- a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ConversionAdjustmentUploadServiceTransport -from .grpc import ConversionAdjustmentUploadServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ConversionAdjustmentUploadServiceTransport]] -_transport_registry["grpc"] = ConversionAdjustmentUploadServiceGrpcTransport - - -__all__ = ( - "ConversionAdjustmentUploadServiceTransport", - "ConversionAdjustmentUploadServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/base.py b/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/base.py deleted file mode 100644 index a62cec5d5..000000000 --- a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/base.py +++ /dev/null @@ -1,105 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import ( - conversion_adjustment_upload_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ConversionAdjustmentUploadServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ConversionAdjustmentUploadService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.upload_conversion_adjustments: gapic_v1.method.wrap_method( - self.upload_conversion_adjustments, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def upload_conversion_adjustments( - self, - ) -> typing.Callable[ - [ - conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest - ], - conversion_adjustment_upload_service.UploadConversionAdjustmentsResponse, - ]: - raise NotImplementedError - - -__all__ = ("ConversionAdjustmentUploadServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/grpc.py b/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/grpc.py deleted file mode 100644 index 8ed3a500a..000000000 --- a/google/ads/googleads/v6/services/services/conversion_adjustment_upload_service/transports/grpc.py +++ /dev/null @@ -1,254 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import ( - conversion_adjustment_upload_service, -) - -from .base import ( - ConversionAdjustmentUploadServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class ConversionAdjustmentUploadServiceGrpcTransport( - ConversionAdjustmentUploadServiceTransport -): - """gRPC backend transport for ConversionAdjustmentUploadService. - - Service to upload conversion adjustments. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def upload_conversion_adjustments( - self, - ) -> Callable[ - [ - conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest - ], - conversion_adjustment_upload_service.UploadConversionAdjustmentsResponse, - ]: - r"""Return a callable for the upload conversion adjustments method over gRPC. - - Processes the given conversion adjustments. - - Returns: - Callable[[~.UploadConversionAdjustmentsRequest], - ~.UploadConversionAdjustmentsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "upload_conversion_adjustments" not in self._stubs: - self._stubs[ - "upload_conversion_adjustments" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ConversionAdjustmentUploadService/UploadConversionAdjustments", - request_serializer=conversion_adjustment_upload_service.UploadConversionAdjustmentsRequest.serialize, - response_deserializer=conversion_adjustment_upload_service.UploadConversionAdjustmentsResponse.deserialize, - ) - return self._stubs["upload_conversion_adjustments"] - - -__all__ = ("ConversionAdjustmentUploadServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_upload_service/__init__.py b/google/ads/googleads/v6/services/services/conversion_upload_service/__init__.py deleted file mode 100644 index 8e60be9c3..000000000 --- a/google/ads/googleads/v6/services/services/conversion_upload_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ConversionUploadServiceClient - -__all__ = ("ConversionUploadServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_upload_service/client.py b/google/ads/googleads/v6/services/services/conversion_upload_service/client.py deleted file mode 100644 index bf9cd8812..000000000 --- a/google/ads/googleads/v6/services/services/conversion_upload_service/client.py +++ /dev/null @@ -1,575 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.types import conversion_upload_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - ConversionUploadServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ConversionUploadServiceGrpcTransport - - -class ConversionUploadServiceClientMeta(type): - """Metaclass for the ConversionUploadService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ConversionUploadServiceTransport]] - _transport_registry["grpc"] = ConversionUploadServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ConversionUploadServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ConversionUploadServiceClient( - metaclass=ConversionUploadServiceClientMeta -): - """Service to upload conversions.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionUploadServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ConversionUploadServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ConversionUploadServiceTransport: - """Return the transport used by the client instance. - - Returns: - ConversionUploadServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ConversionUploadServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the conversion upload service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ConversionUploadServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ConversionUploadServiceTransport): - # transport is a ConversionUploadServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ConversionUploadServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def upload_click_conversions( - self, - request: conversion_upload_service.UploadClickConversionsRequest = None, - *, - customer_id: str = None, - conversions: Sequence[conversion_upload_service.ClickConversion] = None, - partial_failure: bool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> conversion_upload_service.UploadClickConversionsResponse: - r"""Processes the given click conversions. - - Args: - request (:class:`google.ads.googleads.v6.services.types.UploadClickConversionsRequest`): - The request object. Request message for - [ConversionUploadService.UploadClickConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadClickConversions]. - customer_id (:class:`str`): - Required. The ID of the customer - performing the upload. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - conversions (:class:`Sequence[google.ads.googleads.v6.services.types.ClickConversion]`): - Required. The conversions that are - being uploaded. - - This corresponds to the ``conversions`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - partial_failure (:class:`bool`): - Required. If true, successful - operations will be carried out and - invalid operations will return errors. - If false, all operations will be carried - out in one transaction if and only if - they are all valid. This should always - be set to true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial- - failures for more information about - partial failure. - - This corresponds to the ``partial_failure`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.UploadClickConversionsResponse: - Response message for - [ConversionUploadService.UploadClickConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadClickConversions]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, conversions, partial_failure] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a conversion_upload_service.UploadClickConversionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, conversion_upload_service.UploadClickConversionsRequest - ): - request = conversion_upload_service.UploadClickConversionsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if conversions is not None: - request.conversions = conversions - if partial_failure is not None: - request.partial_failure = partial_failure - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.upload_click_conversions - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def upload_call_conversions( - self, - request: conversion_upload_service.UploadCallConversionsRequest = None, - *, - customer_id: str = None, - conversions: Sequence[conversion_upload_service.CallConversion] = None, - partial_failure: bool = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> conversion_upload_service.UploadCallConversionsResponse: - r"""Processes the given call conversions. - - Args: - request (:class:`google.ads.googleads.v6.services.types.UploadCallConversionsRequest`): - The request object. Request message for - [ConversionUploadService.UploadCallConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadCallConversions]. - customer_id (:class:`str`): - Required. The ID of the customer - performing the upload. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - conversions (:class:`Sequence[google.ads.googleads.v6.services.types.CallConversion]`): - Required. The conversions that are - being uploaded. - - This corresponds to the ``conversions`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - partial_failure (:class:`bool`): - Required. If true, successful - operations will be carried out and - invalid operations will return errors. - If false, all operations will be carried - out in one transaction if and only if - they are all valid. This should always - be set to true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial- - failures for more information about - partial failure. - - This corresponds to the ``partial_failure`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.UploadCallConversionsResponse: - Response message for - [ConversionUploadService.UploadCallConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadCallConversions]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, conversions, partial_failure] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a conversion_upload_service.UploadCallConversionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, conversion_upload_service.UploadCallConversionsRequest - ): - request = conversion_upload_service.UploadCallConversionsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if conversions is not None: - request.conversions = conversions - if partial_failure is not None: - request.partial_failure = partial_failure - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.upload_call_conversions - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ConversionUploadServiceClient",) diff --git a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/__init__.py b/google/ads/googleads/v6/services/services/conversion_upload_service/transports/__init__.py deleted file mode 100644 index b17c76870..000000000 --- a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ConversionUploadServiceTransport -from .grpc import ConversionUploadServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ConversionUploadServiceTransport]] -_transport_registry["grpc"] = ConversionUploadServiceGrpcTransport - - -__all__ = ( - "ConversionUploadServiceTransport", - "ConversionUploadServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/base.py b/google/ads/googleads/v6/services/services/conversion_upload_service/transports/base.py deleted file mode 100644 index b0289f4ec..000000000 --- a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import conversion_upload_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ConversionUploadServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ConversionUploadService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.upload_click_conversions: gapic_v1.method.wrap_method( - self.upload_click_conversions, - default_timeout=None, - client_info=client_info, - ), - self.upload_call_conversions: gapic_v1.method.wrap_method( - self.upload_call_conversions, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def upload_click_conversions( - self, - ) -> typing.Callable[ - [conversion_upload_service.UploadClickConversionsRequest], - conversion_upload_service.UploadClickConversionsResponse, - ]: - raise NotImplementedError - - @property - def upload_call_conversions( - self, - ) -> typing.Callable[ - [conversion_upload_service.UploadCallConversionsRequest], - conversion_upload_service.UploadCallConversionsResponse, - ]: - raise NotImplementedError - - -__all__ = ("ConversionUploadServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/grpc.py b/google/ads/googleads/v6/services/services/conversion_upload_service/transports/grpc.py deleted file mode 100644 index cf8819036..000000000 --- a/google/ads/googleads/v6/services/services/conversion_upload_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import conversion_upload_service - -from .base import ConversionUploadServiceTransport, DEFAULT_CLIENT_INFO - - -class ConversionUploadServiceGrpcTransport(ConversionUploadServiceTransport): - """gRPC backend transport for ConversionUploadService. - - Service to upload conversions. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def upload_click_conversions( - self, - ) -> Callable[ - [conversion_upload_service.UploadClickConversionsRequest], - conversion_upload_service.UploadClickConversionsResponse, - ]: - r"""Return a callable for the upload click conversions method over gRPC. - - Processes the given click conversions. - - Returns: - Callable[[~.UploadClickConversionsRequest], - ~.UploadClickConversionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "upload_click_conversions" not in self._stubs: - self._stubs[ - "upload_click_conversions" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ConversionUploadService/UploadClickConversions", - request_serializer=conversion_upload_service.UploadClickConversionsRequest.serialize, - response_deserializer=conversion_upload_service.UploadClickConversionsResponse.deserialize, - ) - return self._stubs["upload_click_conversions"] - - @property - def upload_call_conversions( - self, - ) -> Callable[ - [conversion_upload_service.UploadCallConversionsRequest], - conversion_upload_service.UploadCallConversionsResponse, - ]: - r"""Return a callable for the upload call conversions method over gRPC. - - Processes the given call conversions. - - Returns: - Callable[[~.UploadCallConversionsRequest], - ~.UploadCallConversionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "upload_call_conversions" not in self._stubs: - self._stubs[ - "upload_call_conversions" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ConversionUploadService/UploadCallConversions", - request_serializer=conversion_upload_service.UploadCallConversionsRequest.serialize, - response_deserializer=conversion_upload_service.UploadCallConversionsResponse.deserialize, - ) - return self._stubs["upload_call_conversions"] - - -__all__ = ("ConversionUploadServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/currency_constant_service/__init__.py b/google/ads/googleads/v6/services/services/currency_constant_service/__init__.py deleted file mode 100644 index fd42110f6..000000000 --- a/google/ads/googleads/v6/services/services/currency_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CurrencyConstantServiceClient - -__all__ = ("CurrencyConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/currency_constant_service/client.py b/google/ads/googleads/v6/services/services/currency_constant_service/client.py deleted file mode 100644 index c51c8b771..000000000 --- a/google/ads/googleads/v6/services/services/currency_constant_service/client.py +++ /dev/null @@ -1,437 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import currency_constant -from google.ads.googleads.v6.services.types import currency_constant_service - -from .transports.base import ( - CurrencyConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CurrencyConstantServiceGrpcTransport - - -class CurrencyConstantServiceClientMeta(type): - """Metaclass for the CurrencyConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CurrencyConstantServiceTransport]] - _transport_registry["grpc"] = CurrencyConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CurrencyConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CurrencyConstantServiceClient( - metaclass=CurrencyConstantServiceClientMeta -): - """Service to fetch currency constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CurrencyConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CurrencyConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CurrencyConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - CurrencyConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def currency_constant_path(code: str,) -> str: - """Return a fully-qualified currency_constant string.""" - return "currencyConstants/{code}".format(code=code,) - - @staticmethod - def parse_currency_constant_path(path: str) -> Dict[str, str]: - """Parse a currency_constant path into its component segments.""" - m = re.match(r"^currencyConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CurrencyConstantServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the currency constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CurrencyConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CurrencyConstantServiceTransport): - # transport is a CurrencyConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CurrencyConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_currency_constant( - self, - request: currency_constant_service.GetCurrencyConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> currency_constant.CurrencyConstant: - r"""Returns the requested currency constant. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCurrencyConstantRequest`): - The request object. Request message for - [CurrencyConstantService.GetCurrencyConstant][google.ads.googleads.v6.services.CurrencyConstantService.GetCurrencyConstant]. - resource_name (:class:`str`): - Required. Resource name of the - currency constant to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CurrencyConstant: - A currency constant. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a currency_constant_service.GetCurrencyConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, currency_constant_service.GetCurrencyConstantRequest - ): - request = currency_constant_service.GetCurrencyConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_currency_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CurrencyConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/currency_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/currency_constant_service/transports/__init__.py deleted file mode 100644 index c17463ee3..000000000 --- a/google/ads/googleads/v6/services/services/currency_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CurrencyConstantServiceTransport -from .grpc import CurrencyConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CurrencyConstantServiceTransport]] -_transport_registry["grpc"] = CurrencyConstantServiceGrpcTransport - - -__all__ = ( - "CurrencyConstantServiceTransport", - "CurrencyConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/currency_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/currency_constant_service/transports/base.py deleted file mode 100644 index 6ac0c9372..000000000 --- a/google/ads/googleads/v6/services/services/currency_constant_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import currency_constant -from google.ads.googleads.v6.services.types import currency_constant_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CurrencyConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CurrencyConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_currency_constant: gapic_v1.method.wrap_method( - self.get_currency_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_currency_constant( - self, - ) -> typing.Callable[ - [currency_constant_service.GetCurrencyConstantRequest], - currency_constant.CurrencyConstant, - ]: - raise NotImplementedError - - -__all__ = ("CurrencyConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/currency_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/currency_constant_service/transports/grpc.py deleted file mode 100644 index 69173ac77..000000000 --- a/google/ads/googleads/v6/services/services/currency_constant_service/transports/grpc.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import currency_constant -from google.ads.googleads.v6.services.types import currency_constant_service - -from .base import CurrencyConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class CurrencyConstantServiceGrpcTransport(CurrencyConstantServiceTransport): - """gRPC backend transport for CurrencyConstantService. - - Service to fetch currency constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_currency_constant( - self, - ) -> Callable[ - [currency_constant_service.GetCurrencyConstantRequest], - currency_constant.CurrencyConstant, - ]: - r"""Return a callable for the get currency constant method over gRPC. - - Returns the requested currency constant. - - Returns: - Callable[[~.GetCurrencyConstantRequest], - ~.CurrencyConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_currency_constant" not in self._stubs: - self._stubs[ - "get_currency_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CurrencyConstantService/GetCurrencyConstant", - request_serializer=currency_constant_service.GetCurrencyConstantRequest.serialize, - response_deserializer=currency_constant.CurrencyConstant.deserialize, - ) - return self._stubs["get_currency_constant"] - - -__all__ = ("CurrencyConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/custom_audience_service/__init__.py b/google/ads/googleads/v6/services/services/custom_audience_service/__init__.py deleted file mode 100644 index 8dc775cc2..000000000 --- a/google/ads/googleads/v6/services/services/custom_audience_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomAudienceServiceClient - -__all__ = ("CustomAudienceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/custom_audience_service/client.py b/google/ads/googleads/v6/services/services/custom_audience_service/client.py deleted file mode 100644 index b6d8b8a20..000000000 --- a/google/ads/googleads/v6/services/services/custom_audience_service/client.py +++ /dev/null @@ -1,534 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import custom_audience -from google.ads.googleads.v6.services.types import custom_audience_service - -from .transports.base import CustomAudienceServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomAudienceServiceGrpcTransport - - -class CustomAudienceServiceClientMeta(type): - """Metaclass for the CustomAudienceService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomAudienceServiceTransport]] - _transport_registry["grpc"] = CustomAudienceServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomAudienceServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomAudienceServiceClient(metaclass=CustomAudienceServiceClientMeta): - """Service to manage custom audiences.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomAudienceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomAudienceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomAudienceServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomAudienceServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def custom_audience_path(customer_id: str, custom_audience_id: str,) -> str: - """Return a fully-qualified custom_audience string.""" - return "customers/{customer_id}/customAudiences/{custom_audience_id}".format( - customer_id=customer_id, custom_audience_id=custom_audience_id, - ) - - @staticmethod - def parse_custom_audience_path(path: str) -> Dict[str, str]: - """Parse a custom_audience path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customAudiences/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomAudienceServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the custom audience service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomAudienceServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomAudienceServiceTransport): - # transport is a CustomAudienceServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomAudienceServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_custom_audience( - self, - request: custom_audience_service.GetCustomAudienceRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> custom_audience.CustomAudience: - r"""Returns the requested custom audience in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomAudienceRequest`): - The request object. Request message for - [CustomAudienceService.GetCustomAudience][google.ads.googleads.v6.services.CustomAudienceService.GetCustomAudience]. - resource_name (:class:`str`): - Required. The resource name of the - custom audience to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomAudience: - A custom audience. This is a list of - users by interest. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a custom_audience_service.GetCustomAudienceRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, custom_audience_service.GetCustomAudienceRequest - ): - request = custom_audience_service.GetCustomAudienceRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_custom_audience - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_custom_audiences( - self, - request: custom_audience_service.MutateCustomAudiencesRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - custom_audience_service.CustomAudienceOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> custom_audience_service.MutateCustomAudiencesResponse: - r"""Creates or updates custom audiences. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomAudiencesRequest`): - The request object. Request message for - [CustomAudienceService.MutateCustomAudiences][google.ads.googleads.v6.services.CustomAudienceService.MutateCustomAudiences]. - customer_id (:class:`str`): - Required. The ID of the customer - whose custom audiences are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomAudienceOperation]`): - Required. The list of operations to - perform on individual custom audiences. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomAudiencesResponse: - Response message for custom audience - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a custom_audience_service.MutateCustomAudiencesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, custom_audience_service.MutateCustomAudiencesRequest - ): - request = custom_audience_service.MutateCustomAudiencesRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_custom_audiences - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomAudienceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/custom_audience_service/transports/__init__.py b/google/ads/googleads/v6/services/services/custom_audience_service/transports/__init__.py deleted file mode 100644 index f329f4cfe..000000000 --- a/google/ads/googleads/v6/services/services/custom_audience_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomAudienceServiceTransport -from .grpc import CustomAudienceServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomAudienceServiceTransport]] -_transport_registry["grpc"] = CustomAudienceServiceGrpcTransport - - -__all__ = ( - "CustomAudienceServiceTransport", - "CustomAudienceServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/custom_audience_service/transports/base.py b/google/ads/googleads/v6/services/services/custom_audience_service/transports/base.py deleted file mode 100644 index 3807f249f..000000000 --- a/google/ads/googleads/v6/services/services/custom_audience_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import custom_audience -from google.ads.googleads.v6.services.types import custom_audience_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomAudienceServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomAudienceService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_custom_audience: gapic_v1.method.wrap_method( - self.get_custom_audience, - default_timeout=None, - client_info=client_info, - ), - self.mutate_custom_audiences: gapic_v1.method.wrap_method( - self.mutate_custom_audiences, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_custom_audience( - self, - ) -> typing.Callable[ - [custom_audience_service.GetCustomAudienceRequest], - custom_audience.CustomAudience, - ]: - raise NotImplementedError - - @property - def mutate_custom_audiences( - self, - ) -> typing.Callable[ - [custom_audience_service.MutateCustomAudiencesRequest], - custom_audience_service.MutateCustomAudiencesResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomAudienceServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/custom_audience_service/transports/grpc.py b/google/ads/googleads/v6/services/services/custom_audience_service/transports/grpc.py deleted file mode 100644 index 864b52639..000000000 --- a/google/ads/googleads/v6/services/services/custom_audience_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import custom_audience -from google.ads.googleads.v6.services.types import custom_audience_service - -from .base import CustomAudienceServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomAudienceServiceGrpcTransport(CustomAudienceServiceTransport): - """gRPC backend transport for CustomAudienceService. - - Service to manage custom audiences. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_custom_audience( - self, - ) -> Callable[ - [custom_audience_service.GetCustomAudienceRequest], - custom_audience.CustomAudience, - ]: - r"""Return a callable for the get custom audience method over gRPC. - - Returns the requested custom audience in full detail. - - Returns: - Callable[[~.GetCustomAudienceRequest], - ~.CustomAudience]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_custom_audience" not in self._stubs: - self._stubs["get_custom_audience"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomAudienceService/GetCustomAudience", - request_serializer=custom_audience_service.GetCustomAudienceRequest.serialize, - response_deserializer=custom_audience.CustomAudience.deserialize, - ) - return self._stubs["get_custom_audience"] - - @property - def mutate_custom_audiences( - self, - ) -> Callable[ - [custom_audience_service.MutateCustomAudiencesRequest], - custom_audience_service.MutateCustomAudiencesResponse, - ]: - r"""Return a callable for the mutate custom audiences method over gRPC. - - Creates or updates custom audiences. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCustomAudiencesRequest], - ~.MutateCustomAudiencesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_custom_audiences" not in self._stubs: - self._stubs[ - "mutate_custom_audiences" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomAudienceService/MutateCustomAudiences", - request_serializer=custom_audience_service.MutateCustomAudiencesRequest.serialize, - response_deserializer=custom_audience_service.MutateCustomAudiencesResponse.deserialize, - ) - return self._stubs["mutate_custom_audiences"] - - -__all__ = ("CustomAudienceServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/custom_interest_service/__init__.py b/google/ads/googleads/v6/services/services/custom_interest_service/__init__.py deleted file mode 100644 index 184ba6896..000000000 --- a/google/ads/googleads/v6/services/services/custom_interest_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomInterestServiceClient - -__all__ = ("CustomInterestServiceClient",) diff --git a/google/ads/googleads/v6/services/services/custom_interest_service/client.py b/google/ads/googleads/v6/services/services/custom_interest_service/client.py deleted file mode 100644 index 83ce0b3b9..000000000 --- a/google/ads/googleads/v6/services/services/custom_interest_service/client.py +++ /dev/null @@ -1,534 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import custom_interest -from google.ads.googleads.v6.services.types import custom_interest_service - -from .transports.base import CustomInterestServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomInterestServiceGrpcTransport - - -class CustomInterestServiceClientMeta(type): - """Metaclass for the CustomInterestService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomInterestServiceTransport]] - _transport_registry["grpc"] = CustomInterestServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomInterestServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomInterestServiceClient(metaclass=CustomInterestServiceClientMeta): - """Service to manage custom interests.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomInterestServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomInterestServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomInterestServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomInterestServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def custom_interest_path(customer_id: str, custom_interest_id: str,) -> str: - """Return a fully-qualified custom_interest string.""" - return "customers/{customer_id}/customInterests/{custom_interest_id}".format( - customer_id=customer_id, custom_interest_id=custom_interest_id, - ) - - @staticmethod - def parse_custom_interest_path(path: str) -> Dict[str, str]: - """Parse a custom_interest path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customInterests/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomInterestServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the custom interest service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomInterestServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomInterestServiceTransport): - # transport is a CustomInterestServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomInterestServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_custom_interest( - self, - request: custom_interest_service.GetCustomInterestRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> custom_interest.CustomInterest: - r"""Returns the requested custom interest in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomInterestRequest`): - The request object. Request message for - [CustomInterestService.GetCustomInterest][google.ads.googleads.v6.services.CustomInterestService.GetCustomInterest]. - resource_name (:class:`str`): - Required. The resource name of the - custom interest to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomInterest: - A custom interest. This is a list of - users by interest. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a custom_interest_service.GetCustomInterestRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, custom_interest_service.GetCustomInterestRequest - ): - request = custom_interest_service.GetCustomInterestRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_custom_interest - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_custom_interests( - self, - request: custom_interest_service.MutateCustomInterestsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - custom_interest_service.CustomInterestOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> custom_interest_service.MutateCustomInterestsResponse: - r"""Creates or updates custom interests. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomInterestsRequest`): - The request object. Request message for - [CustomInterestService.MutateCustomInterests][google.ads.googleads.v6.services.CustomInterestService.MutateCustomInterests]. - customer_id (:class:`str`): - Required. The ID of the customer - whose custom interests are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomInterestOperation]`): - Required. The list of operations to - perform on individual custom interests. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomInterestsResponse: - Response message for custom interest - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a custom_interest_service.MutateCustomInterestsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, custom_interest_service.MutateCustomInterestsRequest - ): - request = custom_interest_service.MutateCustomInterestsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_custom_interests - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomInterestServiceClient",) diff --git a/google/ads/googleads/v6/services/services/custom_interest_service/transports/__init__.py b/google/ads/googleads/v6/services/services/custom_interest_service/transports/__init__.py deleted file mode 100644 index 0d69eabad..000000000 --- a/google/ads/googleads/v6/services/services/custom_interest_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomInterestServiceTransport -from .grpc import CustomInterestServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomInterestServiceTransport]] -_transport_registry["grpc"] = CustomInterestServiceGrpcTransport - - -__all__ = ( - "CustomInterestServiceTransport", - "CustomInterestServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/custom_interest_service/transports/base.py b/google/ads/googleads/v6/services/services/custom_interest_service/transports/base.py deleted file mode 100644 index d42812494..000000000 --- a/google/ads/googleads/v6/services/services/custom_interest_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import custom_interest -from google.ads.googleads.v6.services.types import custom_interest_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomInterestServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomInterestService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_custom_interest: gapic_v1.method.wrap_method( - self.get_custom_interest, - default_timeout=None, - client_info=client_info, - ), - self.mutate_custom_interests: gapic_v1.method.wrap_method( - self.mutate_custom_interests, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_custom_interest( - self, - ) -> typing.Callable[ - [custom_interest_service.GetCustomInterestRequest], - custom_interest.CustomInterest, - ]: - raise NotImplementedError - - @property - def mutate_custom_interests( - self, - ) -> typing.Callable[ - [custom_interest_service.MutateCustomInterestsRequest], - custom_interest_service.MutateCustomInterestsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomInterestServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/custom_interest_service/transports/grpc.py b/google/ads/googleads/v6/services/services/custom_interest_service/transports/grpc.py deleted file mode 100644 index 9ecd4503c..000000000 --- a/google/ads/googleads/v6/services/services/custom_interest_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import custom_interest -from google.ads.googleads.v6.services.types import custom_interest_service - -from .base import CustomInterestServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomInterestServiceGrpcTransport(CustomInterestServiceTransport): - """gRPC backend transport for CustomInterestService. - - Service to manage custom interests. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_custom_interest( - self, - ) -> Callable[ - [custom_interest_service.GetCustomInterestRequest], - custom_interest.CustomInterest, - ]: - r"""Return a callable for the get custom interest method over gRPC. - - Returns the requested custom interest in full detail. - - Returns: - Callable[[~.GetCustomInterestRequest], - ~.CustomInterest]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_custom_interest" not in self._stubs: - self._stubs["get_custom_interest"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomInterestService/GetCustomInterest", - request_serializer=custom_interest_service.GetCustomInterestRequest.serialize, - response_deserializer=custom_interest.CustomInterest.deserialize, - ) - return self._stubs["get_custom_interest"] - - @property - def mutate_custom_interests( - self, - ) -> Callable[ - [custom_interest_service.MutateCustomInterestsRequest], - custom_interest_service.MutateCustomInterestsResponse, - ]: - r"""Return a callable for the mutate custom interests method over gRPC. - - Creates or updates custom interests. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCustomInterestsRequest], - ~.MutateCustomInterestsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_custom_interests" not in self._stubs: - self._stubs[ - "mutate_custom_interests" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomInterestService/MutateCustomInterests", - request_serializer=custom_interest_service.MutateCustomInterestsRequest.serialize, - response_deserializer=custom_interest_service.MutateCustomInterestsResponse.deserialize, - ) - return self._stubs["mutate_custom_interests"] - - -__all__ = ("CustomInterestServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_client_link_service/__init__.py b/google/ads/googleads/v6/services/services/customer_client_link_service/__init__.py deleted file mode 100644 index 632f75854..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerClientLinkServiceClient - -__all__ = ("CustomerClientLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_client_link_service/client.py b/google/ads/googleads/v6/services/services/customer_client_link_service/client.py deleted file mode 100644 index ca618bac2..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_link_service/client.py +++ /dev/null @@ -1,555 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client_link -from google.ads.googleads.v6.services.types import customer_client_link_service - -from .transports.base import ( - CustomerClientLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerClientLinkServiceGrpcTransport - - -class CustomerClientLinkServiceClientMeta(type): - """Metaclass for the CustomerClientLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerClientLinkServiceTransport]] - _transport_registry["grpc"] = CustomerClientLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerClientLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerClientLinkServiceClient( - metaclass=CustomerClientLinkServiceClientMeta -): - """Service to manage customer client links.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerClientLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerClientLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerClientLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerClientLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_client_link_path( - customer_id: str, client_customer_id: str, manager_link_id: str, - ) -> str: - """Return a fully-qualified customer_client_link string.""" - return "customers/{customer_id}/customerClientLinks/{client_customer_id}~{manager_link_id}".format( - customer_id=customer_id, - client_customer_id=client_customer_id, - manager_link_id=manager_link_id, - ) - - @staticmethod - def parse_customer_client_link_path(path: str) -> Dict[str, str]: - """Parse a customer_client_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerClientLinks/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerClientLinkServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer client link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerClientLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerClientLinkServiceTransport): - # transport is a CustomerClientLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerClientLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_client_link( - self, - request: customer_client_link_service.GetCustomerClientLinkRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_client_link.CustomerClientLink: - r"""Returns the requested CustomerClientLink in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerClientLinkRequest`): - The request object. Request message for - [CustomerClientLinkService.GetCustomerClientLink][google.ads.googleads.v6.services.CustomerClientLinkService.GetCustomerClientLink]. - resource_name (:class:`str`): - Required. The resource name of the - customer client link to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerClientLink: - Represents customer client link - relationship. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_client_link_service.GetCustomerClientLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_client_link_service.GetCustomerClientLinkRequest - ): - request = customer_client_link_service.GetCustomerClientLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_client_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_client_link( - self, - request: customer_client_link_service.MutateCustomerClientLinkRequest = None, - *, - customer_id: str = None, - operation: customer_client_link_service.CustomerClientLinkOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_client_link_service.MutateCustomerClientLinkResponse: - r"""Creates or updates a customer client link. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerClientLinkRequest`): - The request object. Request message for - [CustomerClientLinkService.MutateCustomerClientLink][google.ads.googleads.v6.services.CustomerClientLinkService.MutateCustomerClientLink]. - customer_id (:class:`str`): - Required. The ID of the customer - whose customer link are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.CustomerClientLinkOperation`): - Required. The operation to perform on - the individual CustomerClientLink. - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerClientLinkResponse: - Response message for a - CustomerClientLink mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_client_link_service.MutateCustomerClientLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_client_link_service.MutateCustomerClientLinkRequest, - ): - request = customer_client_link_service.MutateCustomerClientLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_client_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerClientLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_client_link_service/transports/__init__.py deleted file mode 100644 index 99453f8c5..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerClientLinkServiceTransport -from .grpc import CustomerClientLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerClientLinkServiceTransport]] -_transport_registry["grpc"] = CustomerClientLinkServiceGrpcTransport - - -__all__ = ( - "CustomerClientLinkServiceTransport", - "CustomerClientLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_client_link_service/transports/base.py deleted file mode 100644 index d83482cde..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client_link -from google.ads.googleads.v6.services.types import customer_client_link_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerClientLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerClientLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_client_link: gapic_v1.method.wrap_method( - self.get_customer_client_link, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_client_link: gapic_v1.method.wrap_method( - self.mutate_customer_client_link, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_client_link( - self, - ) -> typing.Callable[ - [customer_client_link_service.GetCustomerClientLinkRequest], - customer_client_link.CustomerClientLink, - ]: - raise NotImplementedError - - @property - def mutate_customer_client_link( - self, - ) -> typing.Callable[ - [customer_client_link_service.MutateCustomerClientLinkRequest], - customer_client_link_service.MutateCustomerClientLinkResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerClientLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_client_link_service/transports/grpc.py deleted file mode 100644 index 64988e6d1..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_link_service/transports/grpc.py +++ /dev/null @@ -1,281 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client_link -from google.ads.googleads.v6.services.types import customer_client_link_service - -from .base import CustomerClientLinkServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerClientLinkServiceGrpcTransport( - CustomerClientLinkServiceTransport -): - """gRPC backend transport for CustomerClientLinkService. - - Service to manage customer client links. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_client_link( - self, - ) -> Callable[ - [customer_client_link_service.GetCustomerClientLinkRequest], - customer_client_link.CustomerClientLink, - ]: - r"""Return a callable for the get customer client link method over gRPC. - - Returns the requested CustomerClientLink in full - detail. - - Returns: - Callable[[~.GetCustomerClientLinkRequest], - ~.CustomerClientLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_client_link" not in self._stubs: - self._stubs[ - "get_customer_client_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerClientLinkService/GetCustomerClientLink", - request_serializer=customer_client_link_service.GetCustomerClientLinkRequest.serialize, - response_deserializer=customer_client_link.CustomerClientLink.deserialize, - ) - return self._stubs["get_customer_client_link"] - - @property - def mutate_customer_client_link( - self, - ) -> Callable[ - [customer_client_link_service.MutateCustomerClientLinkRequest], - customer_client_link_service.MutateCustomerClientLinkResponse, - ]: - r"""Return a callable for the mutate customer client link method over gRPC. - - Creates or updates a customer client link. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCustomerClientLinkRequest], - ~.MutateCustomerClientLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_client_link" not in self._stubs: - self._stubs[ - "mutate_customer_client_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerClientLinkService/MutateCustomerClientLink", - request_serializer=customer_client_link_service.MutateCustomerClientLinkRequest.serialize, - response_deserializer=customer_client_link_service.MutateCustomerClientLinkResponse.deserialize, - ) - return self._stubs["mutate_customer_client_link"] - - -__all__ = ("CustomerClientLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_client_service/__init__.py b/google/ads/googleads/v6/services/services/customer_client_service/__init__.py deleted file mode 100644 index 13caa483a..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerClientServiceClient - -__all__ = ("CustomerClientServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_client_service/client.py b/google/ads/googleads/v6/services/services/customer_client_service/client.py deleted file mode 100644 index e3bf909e4..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_service/client.py +++ /dev/null @@ -1,451 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client -from google.ads.googleads.v6.services.types import customer_client_service - -from .transports.base import CustomerClientServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomerClientServiceGrpcTransport - - -class CustomerClientServiceClientMeta(type): - """Metaclass for the CustomerClientService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerClientServiceTransport]] - _transport_registry["grpc"] = CustomerClientServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerClientServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerClientServiceClient(metaclass=CustomerClientServiceClientMeta): - """Service to get clients in a customer's hierarchy.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerClientServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerClientServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerClientServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerClientServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_client_path(customer_id: str, client_customer_id: str,) -> str: - """Return a fully-qualified customer_client string.""" - return "customers/{customer_id}/customerClients/{client_customer_id}".format( - customer_id=customer_id, client_customer_id=client_customer_id, - ) - - @staticmethod - def parse_customer_client_path(path: str) -> Dict[str, str]: - """Parse a customer_client path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerClients/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerClientServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer client service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerClientServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerClientServiceTransport): - # transport is a CustomerClientServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerClientServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_client( - self, - request: customer_client_service.GetCustomerClientRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_client.CustomerClient: - r"""Returns the requested client in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerClientRequest`): - The request object. Request message for - [CustomerClientService.GetCustomerClient][google.ads.googleads.v6.services.CustomerClientService.GetCustomerClient]. - resource_name (:class:`str`): - Required. The resource name of the - client to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerClient: - A link between the given customer and - a client customer. CustomerClients only - exist for manager customers. All direct - and indirect client customers are - included, as well as the manager itself. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_client_service.GetCustomerClientRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_client_service.GetCustomerClientRequest - ): - request = customer_client_service.GetCustomerClientRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_client - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerClientServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_client_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_client_service/transports/__init__.py deleted file mode 100644 index 0c3bd6d9c..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerClientServiceTransport -from .grpc import CustomerClientServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerClientServiceTransport]] -_transport_registry["grpc"] = CustomerClientServiceGrpcTransport - - -__all__ = ( - "CustomerClientServiceTransport", - "CustomerClientServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_client_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_client_service/transports/base.py deleted file mode 100644 index d10539d05..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client -from google.ads.googleads.v6.services.types import customer_client_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerClientServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerClientService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_client: gapic_v1.method.wrap_method( - self.get_customer_client, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_client( - self, - ) -> typing.Callable[ - [customer_client_service.GetCustomerClientRequest], - customer_client.CustomerClient, - ]: - raise NotImplementedError - - -__all__ = ("CustomerClientServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_client_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_client_service/transports/grpc.py deleted file mode 100644 index 761d80bd3..000000000 --- a/google/ads/googleads/v6/services/services/customer_client_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_client -from google.ads.googleads.v6.services.types import customer_client_service - -from .base import CustomerClientServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerClientServiceGrpcTransport(CustomerClientServiceTransport): - """gRPC backend transport for CustomerClientService. - - Service to get clients in a customer's hierarchy. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_client( - self, - ) -> Callable[ - [customer_client_service.GetCustomerClientRequest], - customer_client.CustomerClient, - ]: - r"""Return a callable for the get customer client method over gRPC. - - Returns the requested client in full detail. - - Returns: - Callable[[~.GetCustomerClientRequest], - ~.CustomerClient]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_client" not in self._stubs: - self._stubs["get_customer_client"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerClientService/GetCustomerClient", - request_serializer=customer_client_service.GetCustomerClientRequest.serialize, - response_deserializer=customer_client.CustomerClient.deserialize, - ) - return self._stubs["get_customer_client"] - - -__all__ = ("CustomerClientServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_extension_setting_service/__init__.py b/google/ads/googleads/v6/services/services/customer_extension_setting_service/__init__.py deleted file mode 100644 index af901a5f1..000000000 --- a/google/ads/googleads/v6/services/services/customer_extension_setting_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerExtensionSettingServiceClient - -__all__ = ("CustomerExtensionSettingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_extension_setting_service/client.py b/google/ads/googleads/v6/services/services/customer_extension_setting_service/client.py deleted file mode 100644 index 41f504e28..000000000 --- a/google/ads/googleads/v6/services/services/customer_extension_setting_service/client.py +++ /dev/null @@ -1,566 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_extension_setting -from google.ads.googleads.v6.services.types import ( - customer_extension_setting_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - CustomerExtensionSettingServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerExtensionSettingServiceGrpcTransport - - -class CustomerExtensionSettingServiceClientMeta(type): - """Metaclass for the CustomerExtensionSettingService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerExtensionSettingServiceTransport]] - _transport_registry["grpc"] = CustomerExtensionSettingServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerExtensionSettingServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerExtensionSettingServiceClient( - metaclass=CustomerExtensionSettingServiceClientMeta -): - """Service to manage customer extension settings.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerExtensionSettingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerExtensionSettingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerExtensionSettingServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerExtensionSettingServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_extension_setting_path( - customer_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified customer_extension_setting string.""" - return "customers/{customer_id}/customerExtensionSettings/{extension_type}".format( - customer_id=customer_id, extension_type=extension_type, - ) - - @staticmethod - def parse_customer_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a customer_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerExtensionSettings/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, CustomerExtensionSettingServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer extension setting service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerExtensionSettingServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerExtensionSettingServiceTransport): - # transport is a CustomerExtensionSettingServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerExtensionSettingServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_extension_setting( - self, - request: customer_extension_setting_service.GetCustomerExtensionSettingRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_extension_setting.CustomerExtensionSetting: - r"""Returns the requested customer extension setting in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerExtensionSettingRequest`): - The request object. Request message for - [CustomerExtensionSettingService.GetCustomerExtensionSetting][google.ads.googleads.v6.services.CustomerExtensionSettingService.GetCustomerExtensionSetting]. - resource_name (:class:`str`): - Required. The resource name of the - customer extension setting to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerExtensionSetting: - A customer extension setting. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_extension_setting_service.GetCustomerExtensionSettingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_extension_setting_service.GetCustomerExtensionSettingRequest, - ): - request = customer_extension_setting_service.GetCustomerExtensionSettingRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_extension_setting - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_extension_settings( - self, - request: customer_extension_setting_service.MutateCustomerExtensionSettingsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - customer_extension_setting_service.CustomerExtensionSettingOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_extension_setting_service.MutateCustomerExtensionSettingsResponse: - r"""Creates, updates, or removes customer extension - settings. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerExtensionSettingsRequest`): - The request object. Request message for - [CustomerExtensionSettingService.MutateCustomerExtensionSettings][google.ads.googleads.v6.services.CustomerExtensionSettingService.MutateCustomerExtensionSettings]. - customer_id (:class:`str`): - Required. The ID of the customer - whose customer extension settings are - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomerExtensionSettingOperation]`): - Required. The list of operations to - perform on individual customer extension - settings. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerExtensionSettingsResponse: - Response message for a customer - extension setting mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_extension_setting_service.MutateCustomerExtensionSettingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_extension_setting_service.MutateCustomerExtensionSettingsRequest, - ): - request = customer_extension_setting_service.MutateCustomerExtensionSettingsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_extension_settings - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerExtensionSettingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/__init__.py deleted file mode 100644 index af63bfbe9..000000000 --- a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerExtensionSettingServiceTransport -from .grpc import CustomerExtensionSettingServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerExtensionSettingServiceTransport]] -_transport_registry["grpc"] = CustomerExtensionSettingServiceGrpcTransport - - -__all__ = ( - "CustomerExtensionSettingServiceTransport", - "CustomerExtensionSettingServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/base.py deleted file mode 100644 index 5f104f6c1..000000000 --- a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/base.py +++ /dev/null @@ -1,120 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_extension_setting -from google.ads.googleads.v6.services.types import ( - customer_extension_setting_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerExtensionSettingServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerExtensionSettingService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_extension_setting: gapic_v1.method.wrap_method( - self.get_customer_extension_setting, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_extension_settings: gapic_v1.method.wrap_method( - self.mutate_customer_extension_settings, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_extension_setting( - self, - ) -> typing.Callable[ - [customer_extension_setting_service.GetCustomerExtensionSettingRequest], - customer_extension_setting.CustomerExtensionSetting, - ]: - raise NotImplementedError - - @property - def mutate_customer_extension_settings( - self, - ) -> typing.Callable[ - [ - customer_extension_setting_service.MutateCustomerExtensionSettingsRequest - ], - customer_extension_setting_service.MutateCustomerExtensionSettingsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerExtensionSettingServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/grpc.py deleted file mode 100644 index 70551e853..000000000 --- a/google/ads/googleads/v6/services/services/customer_extension_setting_service/transports/grpc.py +++ /dev/null @@ -1,286 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_extension_setting -from google.ads.googleads.v6.services.types import ( - customer_extension_setting_service, -) - -from .base import CustomerExtensionSettingServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerExtensionSettingServiceGrpcTransport( - CustomerExtensionSettingServiceTransport -): - """gRPC backend transport for CustomerExtensionSettingService. - - Service to manage customer extension settings. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_extension_setting( - self, - ) -> Callable[ - [customer_extension_setting_service.GetCustomerExtensionSettingRequest], - customer_extension_setting.CustomerExtensionSetting, - ]: - r"""Return a callable for the get customer extension setting method over gRPC. - - Returns the requested customer extension setting in - full detail. - - Returns: - Callable[[~.GetCustomerExtensionSettingRequest], - ~.CustomerExtensionSetting]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_extension_setting" not in self._stubs: - self._stubs[ - "get_customer_extension_setting" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerExtensionSettingService/GetCustomerExtensionSetting", - request_serializer=customer_extension_setting_service.GetCustomerExtensionSettingRequest.serialize, - response_deserializer=customer_extension_setting.CustomerExtensionSetting.deserialize, - ) - return self._stubs["get_customer_extension_setting"] - - @property - def mutate_customer_extension_settings( - self, - ) -> Callable[ - [ - customer_extension_setting_service.MutateCustomerExtensionSettingsRequest - ], - customer_extension_setting_service.MutateCustomerExtensionSettingsResponse, - ]: - r"""Return a callable for the mutate customer extension - settings method over gRPC. - - Creates, updates, or removes customer extension - settings. Operation statuses are returned. - - Returns: - Callable[[~.MutateCustomerExtensionSettingsRequest], - ~.MutateCustomerExtensionSettingsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_extension_settings" not in self._stubs: - self._stubs[ - "mutate_customer_extension_settings" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerExtensionSettingService/MutateCustomerExtensionSettings", - request_serializer=customer_extension_setting_service.MutateCustomerExtensionSettingsRequest.serialize, - response_deserializer=customer_extension_setting_service.MutateCustomerExtensionSettingsResponse.deserialize, - ) - return self._stubs["mutate_customer_extension_settings"] - - -__all__ = ("CustomerExtensionSettingServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_feed_service/__init__.py b/google/ads/googleads/v6/services/services/customer_feed_service/__init__.py deleted file mode 100644 index 354b1dcba..000000000 --- a/google/ads/googleads/v6/services/services/customer_feed_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerFeedServiceClient - -__all__ = ("CustomerFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_feed_service/client.py b/google/ads/googleads/v6/services/services/customer_feed_service/client.py deleted file mode 100644 index 0e5656838..000000000 --- a/google/ads/googleads/v6/services/services/customer_feed_service/client.py +++ /dev/null @@ -1,545 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_feed -from google.ads.googleads.v6.services.types import customer_feed_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CustomerFeedServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomerFeedServiceGrpcTransport - - -class CustomerFeedServiceClientMeta(type): - """Metaclass for the CustomerFeedService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerFeedServiceTransport]] - _transport_registry["grpc"] = CustomerFeedServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerFeedServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerFeedServiceClient(metaclass=CustomerFeedServiceClientMeta): - """Service to manage customer feeds.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerFeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerFeedServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerFeedServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified customer_feed string.""" - return "customers/{customer_id}/customerFeeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_customer_feed_path(path: str) -> Dict[str, str]: - """Parse a customer_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerFeeds/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerFeedServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer feed service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerFeedServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerFeedServiceTransport): - # transport is a CustomerFeedServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerFeedServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_feed( - self, - request: customer_feed_service.GetCustomerFeedRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_feed.CustomerFeed: - r"""Returns the requested customer feed in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerFeedRequest`): - The request object. Request message for - [CustomerFeedService.GetCustomerFeed][google.ads.googleads.v6.services.CustomerFeedService.GetCustomerFeed]. - resource_name (:class:`str`): - Required. The resource name of the - customer feed to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerFeed: - A customer feed. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_feed_service.GetCustomerFeedRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_feed_service.GetCustomerFeedRequest - ): - request = customer_feed_service.GetCustomerFeedRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_feed - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_feeds( - self, - request: customer_feed_service.MutateCustomerFeedsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - customer_feed_service.CustomerFeedOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_feed_service.MutateCustomerFeedsResponse: - r"""Creates, updates, or removes customer feeds. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerFeedsRequest`): - The request object. Request message for - [CustomerFeedService.MutateCustomerFeeds][google.ads.googleads.v6.services.CustomerFeedService.MutateCustomerFeeds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose customer feeds are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomerFeedOperation]`): - Required. The list of operations to - perform on individual customer feeds. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerFeedsResponse: - Response message for a customer feed - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_feed_service.MutateCustomerFeedsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_feed_service.MutateCustomerFeedsRequest - ): - request = customer_feed_service.MutateCustomerFeedsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_feeds - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerFeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_feed_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_feed_service/transports/__init__.py deleted file mode 100644 index 661ce87b9..000000000 --- a/google/ads/googleads/v6/services/services/customer_feed_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerFeedServiceTransport -from .grpc import CustomerFeedServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerFeedServiceTransport]] -_transport_registry["grpc"] = CustomerFeedServiceGrpcTransport - - -__all__ = ( - "CustomerFeedServiceTransport", - "CustomerFeedServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_feed_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_feed_service/transports/base.py deleted file mode 100644 index b1ce77209..000000000 --- a/google/ads/googleads/v6/services/services/customer_feed_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_feed -from google.ads.googleads.v6.services.types import customer_feed_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerFeedServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerFeedService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_feed: gapic_v1.method.wrap_method( - self.get_customer_feed, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_feeds: gapic_v1.method.wrap_method( - self.mutate_customer_feeds, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_feed( - self, - ) -> typing.Callable[ - [customer_feed_service.GetCustomerFeedRequest], - customer_feed.CustomerFeed, - ]: - raise NotImplementedError - - @property - def mutate_customer_feeds( - self, - ) -> typing.Callable[ - [customer_feed_service.MutateCustomerFeedsRequest], - customer_feed_service.MutateCustomerFeedsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerFeedServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_feed_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_feed_service/transports/grpc.py deleted file mode 100644 index 62b411f5c..000000000 --- a/google/ads/googleads/v6/services/services/customer_feed_service/transports/grpc.py +++ /dev/null @@ -1,276 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_feed -from google.ads.googleads.v6.services.types import customer_feed_service - -from .base import CustomerFeedServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerFeedServiceGrpcTransport(CustomerFeedServiceTransport): - """gRPC backend transport for CustomerFeedService. - - Service to manage customer feeds. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_feed( - self, - ) -> Callable[ - [customer_feed_service.GetCustomerFeedRequest], - customer_feed.CustomerFeed, - ]: - r"""Return a callable for the get customer feed method over gRPC. - - Returns the requested customer feed in full detail. - - Returns: - Callable[[~.GetCustomerFeedRequest], - ~.CustomerFeed]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_feed" not in self._stubs: - self._stubs["get_customer_feed"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerFeedService/GetCustomerFeed", - request_serializer=customer_feed_service.GetCustomerFeedRequest.serialize, - response_deserializer=customer_feed.CustomerFeed.deserialize, - ) - return self._stubs["get_customer_feed"] - - @property - def mutate_customer_feeds( - self, - ) -> Callable[ - [customer_feed_service.MutateCustomerFeedsRequest], - customer_feed_service.MutateCustomerFeedsResponse, - ]: - r"""Return a callable for the mutate customer feeds method over gRPC. - - Creates, updates, or removes customer feeds. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCustomerFeedsRequest], - ~.MutateCustomerFeedsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_feeds" not in self._stubs: - self._stubs[ - "mutate_customer_feeds" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerFeedService/MutateCustomerFeeds", - request_serializer=customer_feed_service.MutateCustomerFeedsRequest.serialize, - response_deserializer=customer_feed_service.MutateCustomerFeedsResponse.deserialize, - ) - return self._stubs["mutate_customer_feeds"] - - -__all__ = ("CustomerFeedServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_label_service/__init__.py b/google/ads/googleads/v6/services/services/customer_label_service/__init__.py deleted file mode 100644 index bee450fe5..000000000 --- a/google/ads/googleads/v6/services/services/customer_label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerLabelServiceClient - -__all__ = ("CustomerLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_label_service/client.py b/google/ads/googleads/v6/services/services/customer_label_service/client.py deleted file mode 100644 index 4c1fe07f6..000000000 --- a/google/ads/googleads/v6/services/services/customer_label_service/client.py +++ /dev/null @@ -1,567 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_label -from google.ads.googleads.v6.services.types import customer_label_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import CustomerLabelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomerLabelServiceGrpcTransport - - -class CustomerLabelServiceClientMeta(type): - """Metaclass for the CustomerLabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerLabelServiceTransport]] - _transport_registry["grpc"] = CustomerLabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerLabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerLabelServiceClient(metaclass=CustomerLabelServiceClientMeta): - """Service to manage labels on customers.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerLabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerLabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerLabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified customer_label string.""" - return "customers/{customer_id}/customerLabels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_customer_label_path(path: str) -> Dict[str, str]: - """Parse a customer_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerLabels/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerLabelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerLabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerLabelServiceTransport): - # transport is a CustomerLabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerLabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_label( - self, - request: customer_label_service.GetCustomerLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_label.CustomerLabel: - r"""Returns the requested customer-label relationship in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerLabelRequest`): - The request object. Request message for - [CustomerLabelService.GetCustomerLabel][google.ads.googleads.v6.services.CustomerLabelService.GetCustomerLabel]. - resource_name (:class:`str`): - Required. The resource name of the - customer-label relationship to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerLabel: - Represents a relationship between a - customer and a label. This customer may - not have access to all the labels - attached to it. Additional - CustomerLabels may be returned by - increasing permissions with login- - customer-id. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_label_service.GetCustomerLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_label_service.GetCustomerLabelRequest - ): - request = customer_label_service.GetCustomerLabelRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_label - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_labels( - self, - request: customer_label_service.MutateCustomerLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - customer_label_service.CustomerLabelOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_label_service.MutateCustomerLabelsResponse: - r"""Creates and removes customer-label relationships. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerLabelsRequest`): - The request object. Request message for - [CustomerLabelService.MutateCustomerLabels][google.ads.googleads.v6.services.CustomerLabelService.MutateCustomerLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose - customer-label relationships are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomerLabelOperation]`): - Required. The list of operations to - perform on customer-label relationships. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerLabelsResponse: - Response message for a customer - labels mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_label_service.MutateCustomerLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_label_service.MutateCustomerLabelsRequest - ): - request = customer_label_service.MutateCustomerLabelsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_labels - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerLabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_label_service/transports/__init__.py deleted file mode 100644 index 4ad768e3a..000000000 --- a/google/ads/googleads/v6/services/services/customer_label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerLabelServiceTransport -from .grpc import CustomerLabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerLabelServiceTransport]] -_transport_registry["grpc"] = CustomerLabelServiceGrpcTransport - - -__all__ = ( - "CustomerLabelServiceTransport", - "CustomerLabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_label_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_label_service/transports/base.py deleted file mode 100644 index bc55b2379..000000000 --- a/google/ads/googleads/v6/services/services/customer_label_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_label -from google.ads.googleads.v6.services.types import customer_label_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerLabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerLabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_label: gapic_v1.method.wrap_method( - self.get_customer_label, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_labels: gapic_v1.method.wrap_method( - self.mutate_customer_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_label( - self, - ) -> typing.Callable[ - [customer_label_service.GetCustomerLabelRequest], - customer_label.CustomerLabel, - ]: - raise NotImplementedError - - @property - def mutate_customer_labels( - self, - ) -> typing.Callable[ - [customer_label_service.MutateCustomerLabelsRequest], - customer_label_service.MutateCustomerLabelsResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerLabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_label_service/transports/grpc.py deleted file mode 100644 index 08e1e47ba..000000000 --- a/google/ads/googleads/v6/services/services/customer_label_service/transports/grpc.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_label -from google.ads.googleads.v6.services.types import customer_label_service - -from .base import CustomerLabelServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerLabelServiceGrpcTransport(CustomerLabelServiceTransport): - """gRPC backend transport for CustomerLabelService. - - Service to manage labels on customers. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_label( - self, - ) -> Callable[ - [customer_label_service.GetCustomerLabelRequest], - customer_label.CustomerLabel, - ]: - r"""Return a callable for the get customer label method over gRPC. - - Returns the requested customer-label relationship in - full detail. - - Returns: - Callable[[~.GetCustomerLabelRequest], - ~.CustomerLabel]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_label" not in self._stubs: - self._stubs["get_customer_label"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerLabelService/GetCustomerLabel", - request_serializer=customer_label_service.GetCustomerLabelRequest.serialize, - response_deserializer=customer_label.CustomerLabel.deserialize, - ) - return self._stubs["get_customer_label"] - - @property - def mutate_customer_labels( - self, - ) -> Callable[ - [customer_label_service.MutateCustomerLabelsRequest], - customer_label_service.MutateCustomerLabelsResponse, - ]: - r"""Return a callable for the mutate customer labels method over gRPC. - - Creates and removes customer-label relationships. - Operation statuses are returned. - - Returns: - Callable[[~.MutateCustomerLabelsRequest], - ~.MutateCustomerLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_labels" not in self._stubs: - self._stubs[ - "mutate_customer_labels" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerLabelService/MutateCustomerLabels", - request_serializer=customer_label_service.MutateCustomerLabelsRequest.serialize, - response_deserializer=customer_label_service.MutateCustomerLabelsResponse.deserialize, - ) - return self._stubs["mutate_customer_labels"] - - -__all__ = ("CustomerLabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_manager_link_service/__init__.py b/google/ads/googleads/v6/services/services/customer_manager_link_service/__init__.py deleted file mode 100644 index 365ccbf8b..000000000 --- a/google/ads/googleads/v6/services/services/customer_manager_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerManagerLinkServiceClient - -__all__ = ("CustomerManagerLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_manager_link_service/client.py b/google/ads/googleads/v6/services/services/customer_manager_link_service/client.py deleted file mode 100644 index 7bd4cc16a..000000000 --- a/google/ads/googleads/v6/services/services/customer_manager_link_service/client.py +++ /dev/null @@ -1,674 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_manager_link -from google.ads.googleads.v6.services.types import customer_manager_link_service - -from .transports.base import ( - CustomerManagerLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerManagerLinkServiceGrpcTransport - - -class CustomerManagerLinkServiceClientMeta(type): - """Metaclass for the CustomerManagerLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerManagerLinkServiceTransport]] - _transport_registry["grpc"] = CustomerManagerLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerManagerLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerManagerLinkServiceClient( - metaclass=CustomerManagerLinkServiceClientMeta -): - """Service to manage customer-manager links.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerManagerLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerManagerLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerManagerLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerManagerLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_manager_link_path( - customer_id: str, manager_customer_id: str, manager_link_id: str, - ) -> str: - """Return a fully-qualified customer_manager_link string.""" - return "customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}".format( - customer_id=customer_id, - manager_customer_id=manager_customer_id, - manager_link_id=manager_link_id, - ) - - @staticmethod - def parse_customer_manager_link_path(path: str) -> Dict[str, str]: - """Parse a customer_manager_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerManagerLinks/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerManagerLinkServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer manager link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerManagerLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerManagerLinkServiceTransport): - # transport is a CustomerManagerLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerManagerLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_manager_link( - self, - request: customer_manager_link_service.GetCustomerManagerLinkRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_manager_link.CustomerManagerLink: - r"""Returns the requested CustomerManagerLink in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerManagerLinkRequest`): - The request object. Request message for - [CustomerManagerLinkService.GetCustomerManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.GetCustomerManagerLink]. - resource_name (:class:`str`): - Required. The resource name of the - CustomerManagerLink to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerManagerLink: - Represents customer-manager link - relationship. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_manager_link_service.GetCustomerManagerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_manager_link_service.GetCustomerManagerLinkRequest - ): - request = customer_manager_link_service.GetCustomerManagerLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_manager_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_manager_link( - self, - request: customer_manager_link_service.MutateCustomerManagerLinkRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - customer_manager_link_service.CustomerManagerLinkOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_manager_link_service.MutateCustomerManagerLinkResponse: - r"""Creates or updates customer manager links. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerManagerLinkRequest`): - The request object. Request message for - [CustomerManagerLinkService.MutateCustomerManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.MutateCustomerManagerLink]. - customer_id (:class:`str`): - Required. The ID of the customer - whose customer manager links are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomerManagerLinkOperation]`): - Required. The list of operations to - perform on individual customer manager - links. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerManagerLinkResponse: - Response message for a - CustomerManagerLink mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_manager_link_service.MutateCustomerManagerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_manager_link_service.MutateCustomerManagerLinkRequest, - ): - request = customer_manager_link_service.MutateCustomerManagerLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_manager_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def move_manager_link( - self, - request: customer_manager_link_service.MoveManagerLinkRequest = None, - *, - customer_id: str = None, - previous_customer_manager_link: str = None, - new_manager: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_manager_link_service.MoveManagerLinkResponse: - r"""Moves a client customer to a new manager customer. - This simplifies the complex request that requires two - operations to move a client customer to a new manager. - i.e: - 1. Update operation with Status INACTIVE (previous - manager) and, 2. Update operation with Status ACTIVE - (new manager). - - Args: - request (:class:`google.ads.googleads.v6.services.types.MoveManagerLinkRequest`): - The request object. Request message for - [CustomerManagerLinkService.MoveManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.MoveManagerLink]. - customer_id (:class:`str`): - Required. The ID of the client - customer that is being moved. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - previous_customer_manager_link (:class:`str`): - Required. The resource name of the previous - CustomerManagerLink. The resource name has the form: - ``customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}`` - - This corresponds to the ``previous_customer_manager_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - new_manager (:class:`str`): - Required. The resource name of the new manager customer - that the client wants to move to. Customer resource - names have the format: "customers/{customer_id}" - - This corresponds to the ``new_manager`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MoveManagerLinkResponse: - Response message for a - CustomerManagerLink moveManagerLink. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, previous_customer_manager_link, new_manager] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_manager_link_service.MoveManagerLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_manager_link_service.MoveManagerLinkRequest - ): - request = customer_manager_link_service.MoveManagerLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if previous_customer_manager_link is not None: - request.previous_customer_manager_link = ( - previous_customer_manager_link - ) - if new_manager is not None: - request.new_manager = new_manager - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.move_manager_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerManagerLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/__init__.py deleted file mode 100644 index 87fdb8555..000000000 --- a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerManagerLinkServiceTransport -from .grpc import CustomerManagerLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerManagerLinkServiceTransport]] -_transport_registry["grpc"] = CustomerManagerLinkServiceGrpcTransport - - -__all__ = ( - "CustomerManagerLinkServiceTransport", - "CustomerManagerLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/base.py deleted file mode 100644 index fd382e584..000000000 --- a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/base.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_manager_link -from google.ads.googleads.v6.services.types import customer_manager_link_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerManagerLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerManagerLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_manager_link: gapic_v1.method.wrap_method( - self.get_customer_manager_link, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_manager_link: gapic_v1.method.wrap_method( - self.mutate_customer_manager_link, - default_timeout=None, - client_info=client_info, - ), - self.move_manager_link: gapic_v1.method.wrap_method( - self.move_manager_link, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_manager_link( - self, - ) -> typing.Callable[ - [customer_manager_link_service.GetCustomerManagerLinkRequest], - customer_manager_link.CustomerManagerLink, - ]: - raise NotImplementedError - - @property - def mutate_customer_manager_link( - self, - ) -> typing.Callable[ - [customer_manager_link_service.MutateCustomerManagerLinkRequest], - customer_manager_link_service.MutateCustomerManagerLinkResponse, - ]: - raise NotImplementedError - - @property - def move_manager_link( - self, - ) -> typing.Callable[ - [customer_manager_link_service.MoveManagerLinkRequest], - customer_manager_link_service.MoveManagerLinkResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerManagerLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/grpc.py deleted file mode 100644 index 148f49be8..000000000 --- a/google/ads/googleads/v6/services/services/customer_manager_link_service/transports/grpc.py +++ /dev/null @@ -1,316 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_manager_link -from google.ads.googleads.v6.services.types import customer_manager_link_service - -from .base import CustomerManagerLinkServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerManagerLinkServiceGrpcTransport( - CustomerManagerLinkServiceTransport -): - """gRPC backend transport for CustomerManagerLinkService. - - Service to manage customer-manager links. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_manager_link( - self, - ) -> Callable[ - [customer_manager_link_service.GetCustomerManagerLinkRequest], - customer_manager_link.CustomerManagerLink, - ]: - r"""Return a callable for the get customer manager link method over gRPC. - - Returns the requested CustomerManagerLink in full - detail. - - Returns: - Callable[[~.GetCustomerManagerLinkRequest], - ~.CustomerManagerLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_manager_link" not in self._stubs: - self._stubs[ - "get_customer_manager_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerManagerLinkService/GetCustomerManagerLink", - request_serializer=customer_manager_link_service.GetCustomerManagerLinkRequest.serialize, - response_deserializer=customer_manager_link.CustomerManagerLink.deserialize, - ) - return self._stubs["get_customer_manager_link"] - - @property - def mutate_customer_manager_link( - self, - ) -> Callable[ - [customer_manager_link_service.MutateCustomerManagerLinkRequest], - customer_manager_link_service.MutateCustomerManagerLinkResponse, - ]: - r"""Return a callable for the mutate customer manager link method over gRPC. - - Creates or updates customer manager links. Operation - statuses are returned. - - Returns: - Callable[[~.MutateCustomerManagerLinkRequest], - ~.MutateCustomerManagerLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_manager_link" not in self._stubs: - self._stubs[ - "mutate_customer_manager_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerManagerLinkService/MutateCustomerManagerLink", - request_serializer=customer_manager_link_service.MutateCustomerManagerLinkRequest.serialize, - response_deserializer=customer_manager_link_service.MutateCustomerManagerLinkResponse.deserialize, - ) - return self._stubs["mutate_customer_manager_link"] - - @property - def move_manager_link( - self, - ) -> Callable[ - [customer_manager_link_service.MoveManagerLinkRequest], - customer_manager_link_service.MoveManagerLinkResponse, - ]: - r"""Return a callable for the move manager link method over gRPC. - - Moves a client customer to a new manager customer. - This simplifies the complex request that requires two - operations to move a client customer to a new manager. - i.e: - 1. Update operation with Status INACTIVE (previous - manager) and, 2. Update operation with Status ACTIVE - (new manager). - - Returns: - Callable[[~.MoveManagerLinkRequest], - ~.MoveManagerLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "move_manager_link" not in self._stubs: - self._stubs["move_manager_link"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerManagerLinkService/MoveManagerLink", - request_serializer=customer_manager_link_service.MoveManagerLinkRequest.serialize, - response_deserializer=customer_manager_link_service.MoveManagerLinkResponse.deserialize, - ) - return self._stubs["move_manager_link"] - - -__all__ = ("CustomerManagerLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/__init__.py b/google/ads/googleads/v6/services/services/customer_negative_criterion_service/__init__.py deleted file mode 100644 index 90cb864d0..000000000 --- a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerNegativeCriterionServiceClient - -__all__ = ("CustomerNegativeCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/client.py b/google/ads/googleads/v6/services/services/customer_negative_criterion_service/client.py deleted file mode 100644 index 17f88fedc..000000000 --- a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/client.py +++ /dev/null @@ -1,549 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_negative_criterion -from google.ads.googleads.v6.services.types import ( - customer_negative_criterion_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - CustomerNegativeCriterionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerNegativeCriterionServiceGrpcTransport - - -class CustomerNegativeCriterionServiceClientMeta(type): - """Metaclass for the CustomerNegativeCriterionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerNegativeCriterionServiceTransport]] - _transport_registry["grpc"] = CustomerNegativeCriterionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerNegativeCriterionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerNegativeCriterionServiceClient( - metaclass=CustomerNegativeCriterionServiceClientMeta -): - """Service to manage customer negative criteria.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerNegativeCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerNegativeCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerNegativeCriterionServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerNegativeCriterionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_negative_criterion_path( - customer_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified customer_negative_criterion string.""" - return "customers/{customer_id}/customerNegativeCriteria/{criterion_id}".format( - customer_id=customer_id, criterion_id=criterion_id, - ) - - @staticmethod - def parse_customer_negative_criterion_path(path: str) -> Dict[str, str]: - """Parse a customer_negative_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerNegativeCriteria/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, CustomerNegativeCriterionServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer negative criterion service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerNegativeCriterionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerNegativeCriterionServiceTransport): - # transport is a CustomerNegativeCriterionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerNegativeCriterionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_negative_criterion( - self, - request: customer_negative_criterion_service.GetCustomerNegativeCriterionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_negative_criterion.CustomerNegativeCriterion: - r"""Returns the requested criterion in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerNegativeCriterionRequest`): - The request object. Request message for - [CustomerNegativeCriterionService.GetCustomerNegativeCriterion][google.ads.googleads.v6.services.CustomerNegativeCriterionService.GetCustomerNegativeCriterion]. - resource_name (:class:`str`): - Required. The resource name of the - criterion to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerNegativeCriterion: - A negative criterion for exclusions - at the customer level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_negative_criterion_service.GetCustomerNegativeCriterionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_negative_criterion_service.GetCustomerNegativeCriterionRequest, - ): - request = customer_negative_criterion_service.GetCustomerNegativeCriterionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_negative_criterion - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_negative_criteria( - self, - request: customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - customer_negative_criterion_service.CustomerNegativeCriterionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_negative_criterion_service.MutateCustomerNegativeCriteriaResponse: - r"""Creates or removes criteria. Operation statuses are - returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerNegativeCriteriaRequest`): - The request object. Request message for - [CustomerNegativeCriterionService.MutateCustomerNegativeCriteria][google.ads.googleads.v6.services.CustomerNegativeCriterionService.MutateCustomerNegativeCriteria]. - customer_id (:class:`str`): - Required. The ID of the customer - whose criteria are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CustomerNegativeCriterionOperation]`): - Required. The list of operations to - perform on individual criteria. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerNegativeCriteriaResponse: - Response message for customer - negative criterion mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest, - ): - request = customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_negative_criteria - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerNegativeCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/__init__.py deleted file mode 100644 index 01b30324d..000000000 --- a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerNegativeCriterionServiceTransport -from .grpc import CustomerNegativeCriterionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerNegativeCriterionServiceTransport]] -_transport_registry["grpc"] = CustomerNegativeCriterionServiceGrpcTransport - - -__all__ = ( - "CustomerNegativeCriterionServiceTransport", - "CustomerNegativeCriterionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/grpc.py deleted file mode 100644 index 5a39ba458..000000000 --- a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/grpc.py +++ /dev/null @@ -1,288 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_negative_criterion -from google.ads.googleads.v6.services.types import ( - customer_negative_criterion_service, -) - -from .base import CustomerNegativeCriterionServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerNegativeCriterionServiceGrpcTransport( - CustomerNegativeCriterionServiceTransport -): - """gRPC backend transport for CustomerNegativeCriterionService. - - Service to manage customer negative criteria. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_negative_criterion( - self, - ) -> Callable[ - [ - customer_negative_criterion_service.GetCustomerNegativeCriterionRequest - ], - customer_negative_criterion.CustomerNegativeCriterion, - ]: - r"""Return a callable for the get customer negative - criterion method over gRPC. - - Returns the requested criterion in full detail. - - Returns: - Callable[[~.GetCustomerNegativeCriterionRequest], - ~.CustomerNegativeCriterion]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_negative_criterion" not in self._stubs: - self._stubs[ - "get_customer_negative_criterion" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerNegativeCriterionService/GetCustomerNegativeCriterion", - request_serializer=customer_negative_criterion_service.GetCustomerNegativeCriterionRequest.serialize, - response_deserializer=customer_negative_criterion.CustomerNegativeCriterion.deserialize, - ) - return self._stubs["get_customer_negative_criterion"] - - @property - def mutate_customer_negative_criteria( - self, - ) -> Callable[ - [ - customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest - ], - customer_negative_criterion_service.MutateCustomerNegativeCriteriaResponse, - ]: - r"""Return a callable for the mutate customer negative - criteria method over gRPC. - - Creates or removes criteria. Operation statuses are - returned. - - Returns: - Callable[[~.MutateCustomerNegativeCriteriaRequest], - ~.MutateCustomerNegativeCriteriaResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_negative_criteria" not in self._stubs: - self._stubs[ - "mutate_customer_negative_criteria" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerNegativeCriterionService/MutateCustomerNegativeCriteria", - request_serializer=customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest.serialize, - response_deserializer=customer_negative_criterion_service.MutateCustomerNegativeCriteriaResponse.deserialize, - ) - return self._stubs["mutate_customer_negative_criteria"] - - -__all__ = ("CustomerNegativeCriterionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_service/__init__.py b/google/ads/googleads/v6/services/services/customer_service/__init__.py deleted file mode 100644 index 0b1b450fa..000000000 --- a/google/ads/googleads/v6/services/services/customer_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerServiceClient - -__all__ = ("CustomerServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_service/client.py b/google/ads/googleads/v6/services/services/customer_service/client.py deleted file mode 100644 index c260adfad..000000000 --- a/google/ads/googleads/v6/services/services/customer_service/client.py +++ /dev/null @@ -1,675 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer -from google.ads.googleads.v6.services.types import customer_service - -from .transports.base import CustomerServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import CustomerServiceGrpcTransport - - -class CustomerServiceClientMeta(type): - """Metaclass for the CustomerService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerServiceTransport]] - _transport_registry["grpc"] = CustomerServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerServiceClient(metaclass=CustomerServiceClientMeta): - """Service to manage customers.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def conversion_action_path( - customer_id: str, conversion_action_id: str, - ) -> str: - """Return a fully-qualified conversion_action string.""" - return "customers/{customer_id}/conversionActions/{conversion_action_id}".format( - customer_id=customer_id, conversion_action_id=conversion_action_id, - ) - - @staticmethod - def parse_conversion_action_path(path: str) -> Dict[str, str]: - """Parse a conversion_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/conversionActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerServiceTransport): - # transport is a CustomerServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer( - self, - request: customer_service.GetCustomerRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer.Customer: - r"""Returns the requested customer in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerRequest`): - The request object. Request message for - [CustomerService.GetCustomer][google.ads.googleads.v6.services.CustomerService.GetCustomer]. - resource_name (:class:`str`): - Required. The resource name of the - customer to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Customer: - A customer. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_service.GetCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, customer_service.GetCustomerRequest): - request = customer_service.GetCustomerRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer( - self, - request: customer_service.MutateCustomerRequest = None, - *, - customer_id: str = None, - operation: customer_service.CustomerOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_service.MutateCustomerResponse: - r"""Updates a customer. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerRequest`): - The request object. Request message for - [CustomerService.MutateCustomer][google.ads.googleads.v6.services.CustomerService.MutateCustomer]. - customer_id (:class:`str`): - Required. The ID of the customer - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.CustomerOperation`): - Required. The operation to perform on - the customer - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerResponse: - Response message for customer mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_service.MutateCustomerRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, customer_service.MutateCustomerRequest): - request = customer_service.MutateCustomerRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_customer] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def list_accessible_customers( - self, - request: customer_service.ListAccessibleCustomersRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_service.ListAccessibleCustomersResponse: - r"""Returns resource names of customers directly - accessible by the user authenticating the call. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListAccessibleCustomersRequest`): - The request object. Request message for - [CustomerService.ListAccessibleCustomers][google.ads.googleads.v6.services.CustomerService.ListAccessibleCustomers]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListAccessibleCustomersResponse: - Response message for - [CustomerService.ListAccessibleCustomers][google.ads.googleads.v6.services.CustomerService.ListAccessibleCustomers]. - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a customer_service.ListAccessibleCustomersRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_service.ListAccessibleCustomersRequest - ): - request = customer_service.ListAccessibleCustomersRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_accessible_customers - ] - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def create_customer_client( - self, - request: customer_service.CreateCustomerClientRequest = None, - *, - customer_id: str = None, - customer_client: customer.Customer = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_service.CreateCustomerClientResponse: - r"""Creates a new client under manager. The new client - customer is returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.CreateCustomerClientRequest`): - The request object. Request message for - [CustomerService.CreateCustomerClient][google.ads.googleads.v6.services.CustomerService.CreateCustomerClient]. - customer_id (:class:`str`): - Required. The ID of the Manager under - whom client customer is being created. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - customer_client (:class:`google.ads.googleads.v6.resources.types.Customer`): - Required. The new client customer to - create. The resource name on this - customer will be ignored. - - This corresponds to the ``customer_client`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.CreateCustomerClientResponse: - Response message for - CreateCustomerClient mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, customer_client]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_service.CreateCustomerClientRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_service.CreateCustomerClientRequest - ): - request = customer_service.CreateCustomerClientRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if customer_client is not None: - request.customer_client = customer_client - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_customer_client - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_service/transports/__init__.py deleted file mode 100644 index 3ab191aa7..000000000 --- a/google/ads/googleads/v6/services/services/customer_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerServiceTransport -from .grpc import CustomerServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerServiceTransport]] -_transport_registry["grpc"] = CustomerServiceGrpcTransport - - -__all__ = ( - "CustomerServiceTransport", - "CustomerServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_service/transports/base.py deleted file mode 100644 index d326e45e4..000000000 --- a/google/ads/googleads/v6/services/services/customer_service/transports/base.py +++ /dev/null @@ -1,143 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer -from google.ads.googleads.v6.services.types import customer_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer: gapic_v1.method.wrap_method( - self.get_customer, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer: gapic_v1.method.wrap_method( - self.mutate_customer, - default_timeout=None, - client_info=client_info, - ), - self.list_accessible_customers: gapic_v1.method.wrap_method( - self.list_accessible_customers, - default_timeout=None, - client_info=client_info, - ), - self.create_customer_client: gapic_v1.method.wrap_method( - self.create_customer_client, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer( - self, - ) -> typing.Callable[ - [customer_service.GetCustomerRequest], customer.Customer - ]: - raise NotImplementedError - - @property - def mutate_customer( - self, - ) -> typing.Callable[ - [customer_service.MutateCustomerRequest], - customer_service.MutateCustomerResponse, - ]: - raise NotImplementedError - - @property - def list_accessible_customers( - self, - ) -> typing.Callable[ - [customer_service.ListAccessibleCustomersRequest], - customer_service.ListAccessibleCustomersResponse, - ]: - raise NotImplementedError - - @property - def create_customer_client( - self, - ) -> typing.Callable[ - [customer_service.CreateCustomerClientRequest], - customer_service.CreateCustomerClientResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_service/transports/grpc.py deleted file mode 100644 index 596bc7d2d..000000000 --- a/google/ads/googleads/v6/services/services/customer_service/transports/grpc.py +++ /dev/null @@ -1,334 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer -from google.ads.googleads.v6.services.types import customer_service - -from .base import CustomerServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerServiceGrpcTransport(CustomerServiceTransport): - """gRPC backend transport for CustomerService. - - Service to manage customers. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer( - self, - ) -> Callable[[customer_service.GetCustomerRequest], customer.Customer]: - r"""Return a callable for the get customer method over gRPC. - - Returns the requested customer in full detail. - - Returns: - Callable[[~.GetCustomerRequest], - ~.Customer]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer" not in self._stubs: - self._stubs["get_customer"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerService/GetCustomer", - request_serializer=customer_service.GetCustomerRequest.serialize, - response_deserializer=customer.Customer.deserialize, - ) - return self._stubs["get_customer"] - - @property - def mutate_customer( - self, - ) -> Callable[ - [customer_service.MutateCustomerRequest], - customer_service.MutateCustomerResponse, - ]: - r"""Return a callable for the mutate customer method over gRPC. - - Updates a customer. Operation statuses are returned. - - Returns: - Callable[[~.MutateCustomerRequest], - ~.MutateCustomerResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer" not in self._stubs: - self._stubs["mutate_customer"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerService/MutateCustomer", - request_serializer=customer_service.MutateCustomerRequest.serialize, - response_deserializer=customer_service.MutateCustomerResponse.deserialize, - ) - return self._stubs["mutate_customer"] - - @property - def list_accessible_customers( - self, - ) -> Callable[ - [customer_service.ListAccessibleCustomersRequest], - customer_service.ListAccessibleCustomersResponse, - ]: - r"""Return a callable for the list accessible customers method over gRPC. - - Returns resource names of customers directly - accessible by the user authenticating the call. - - Returns: - Callable[[~.ListAccessibleCustomersRequest], - ~.ListAccessibleCustomersResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_accessible_customers" not in self._stubs: - self._stubs[ - "list_accessible_customers" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerService/ListAccessibleCustomers", - request_serializer=customer_service.ListAccessibleCustomersRequest.serialize, - response_deserializer=customer_service.ListAccessibleCustomersResponse.deserialize, - ) - return self._stubs["list_accessible_customers"] - - @property - def create_customer_client( - self, - ) -> Callable[ - [customer_service.CreateCustomerClientRequest], - customer_service.CreateCustomerClientResponse, - ]: - r"""Return a callable for the create customer client method over gRPC. - - Creates a new client under manager. The new client - customer is returned. - - Returns: - Callable[[~.CreateCustomerClientRequest], - ~.CreateCustomerClientResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_customer_client" not in self._stubs: - self._stubs[ - "create_customer_client" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerService/CreateCustomerClient", - request_serializer=customer_service.CreateCustomerClientRequest.serialize, - response_deserializer=customer_service.CreateCustomerClientResponse.deserialize, - ) - return self._stubs["create_customer_client"] - - -__all__ = ("CustomerServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/__init__.py b/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/__init__.py deleted file mode 100644 index 0924e5525..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerUserAccessInvitationServiceClient - -__all__ = ("CustomerUserAccessInvitationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/client.py b/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/client.py deleted file mode 100644 index bb08feaf9..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/client.py +++ /dev/null @@ -1,553 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - customer_user_access_invitation, -) -from google.ads.googleads.v6.services.types import ( - customer_user_access_invitation_service, -) - -from .transports.base import ( - CustomerUserAccessInvitationServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerUserAccessInvitationServiceGrpcTransport - - -class CustomerUserAccessInvitationServiceClientMeta(type): - """Metaclass for the CustomerUserAccessInvitationService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerUserAccessInvitationServiceTransport]] - _transport_registry[ - "grpc" - ] = CustomerUserAccessInvitationServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerUserAccessInvitationServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerUserAccessInvitationServiceClient( - metaclass=CustomerUserAccessInvitationServiceClientMeta -): - """This service manages the access invitation extended to users - for a given customer. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerUserAccessInvitationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerUserAccessInvitationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerUserAccessInvitationServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerUserAccessInvitationServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_user_access_invitation_path( - customer_id: str, invitation_id: str, - ) -> str: - """Return a fully-qualified customer_user_access_invitation string.""" - return "customers/{customer_id}/customerUserAccessInvitations/{invitation_id}".format( - customer_id=customer_id, invitation_id=invitation_id, - ) - - @staticmethod - def parse_customer_user_access_invitation_path(path: str) -> Dict[str, str]: - """Parse a customer_user_access_invitation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerUserAccessInvitations/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, CustomerUserAccessInvitationServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer user access invitation service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerUserAccessInvitationServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerUserAccessInvitationServiceTransport): - # transport is a CustomerUserAccessInvitationServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerUserAccessInvitationServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_user_access_invitation( - self, - request: customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_user_access_invitation.CustomerUserAccessInvitation: - r"""Returns the requested access invitation in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerUserAccessInvitationRequest`): - The request object. Request message for - [CustomerUserAccessInvitation.GetCustomerUserAccessInvitation][] - resource_name (:class:`str`): - Required. Resource name of the access - invitation. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerUserAccessInvitation: - Represent an invitation to a new user - on this customer account. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest, - ): - request = customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_user_access_invitation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_user_access_invitation( - self, - request: customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest = None, - *, - customer_id: str = None, - operation: customer_user_access_invitation_service.CustomerUserAccessInvitationOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_user_access_invitation_service.MutateCustomerUserAccessInvitationResponse: - r"""Creates or removes an access invitation. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerUserAccessInvitationRequest`): - The request object. Request message for - [CustomerUserAccessInvitation.MutateCustomerUserAccessInvitation][] - customer_id (:class:`str`): - Required. The ID of the customer - whose access invitation is being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.CustomerUserAccessInvitationOperation`): - Required. The operation to perform on - the access invitation - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerUserAccessInvitationResponse: - Response message for access - invitation mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest, - ): - request = customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_user_access_invitation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerUserAccessInvitationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_service/__init__.py b/google/ads/googleads/v6/services/services/customer_user_access_service/__init__.py deleted file mode 100644 index ec935689e..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import CustomerUserAccessServiceClient - -__all__ = ("CustomerUserAccessServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_service/client.py b/google/ads/googleads/v6/services/services/customer_user_access_service/client.py deleted file mode 100644 index 4f11e9137..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_service/client.py +++ /dev/null @@ -1,541 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import customer_user_access -from google.ads.googleads.v6.services.types import customer_user_access_service - -from .transports.base import ( - CustomerUserAccessServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import CustomerUserAccessServiceGrpcTransport - - -class CustomerUserAccessServiceClientMeta(type): - """Metaclass for the CustomerUserAccessService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[CustomerUserAccessServiceTransport]] - _transport_registry["grpc"] = CustomerUserAccessServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[CustomerUserAccessServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class CustomerUserAccessServiceClient( - metaclass=CustomerUserAccessServiceClientMeta -): - """This service manages the permissions of a user on a given - customer. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerUserAccessServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - CustomerUserAccessServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> CustomerUserAccessServiceTransport: - """Return the transport used by the client instance. - - Returns: - CustomerUserAccessServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_user_access_path(customer_id: str, user_id: str,) -> str: - """Return a fully-qualified customer_user_access string.""" - return "customers/{customer_id}/customerUserAccesses/{user_id}".format( - customer_id=customer_id, user_id=user_id, - ) - - @staticmethod - def parse_customer_user_access_path(path: str) -> Dict[str, str]: - """Parse a customer_user_access path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerUserAccesses/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CustomerUserAccessServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the customer user access service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.CustomerUserAccessServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, CustomerUserAccessServiceTransport): - # transport is a CustomerUserAccessServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = CustomerUserAccessServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_customer_user_access( - self, - request: customer_user_access_service.GetCustomerUserAccessRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_user_access.CustomerUserAccess: - r"""Returns the CustomerUserAccess in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetCustomerUserAccessRequest`): - The request object. Request message for - [CustomerUserAccessService.GetCustomerUserAccess][google.ads.googleads.v6.services.CustomerUserAccessService.GetCustomerUserAccess]. - resource_name (:class:`str`): - Required. Resource name of the - customer user access. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.CustomerUserAccess: - Represents the permission of a single - user onto a single customer. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_user_access_service.GetCustomerUserAccessRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, customer_user_access_service.GetCustomerUserAccessRequest - ): - request = customer_user_access_service.GetCustomerUserAccessRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_customer_user_access - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_customer_user_access( - self, - request: customer_user_access_service.MutateCustomerUserAccessRequest = None, - *, - customer_id: str = None, - operation: customer_user_access_service.CustomerUserAccessOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> customer_user_access_service.MutateCustomerUserAccessResponse: - r"""Updates, removes permission of a user on a given - customer. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCustomerUserAccessRequest`): - The request object. Mutate Request for - [CustomerUserAccessService.MutateCustomerUserAccess][google.ads.googleads.v6.services.CustomerUserAccessService.MutateCustomerUserAccess]. - customer_id (:class:`str`): - Required. The ID of the customer - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.CustomerUserAccessOperation`): - Required. The operation to perform on - the customer - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateCustomerUserAccessResponse: - Response message for customer user - access mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a customer_user_access_service.MutateCustomerUserAccessRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - customer_user_access_service.MutateCustomerUserAccessRequest, - ): - request = customer_user_access_service.MutateCustomerUserAccessRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_customer_user_access - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("CustomerUserAccessServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/__init__.py b/google/ads/googleads/v6/services/services/customer_user_access_service/transports/__init__.py deleted file mode 100644 index 0fe5947a8..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import CustomerUserAccessServiceTransport -from .grpc import CustomerUserAccessServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[CustomerUserAccessServiceTransport]] -_transport_registry["grpc"] = CustomerUserAccessServiceGrpcTransport - - -__all__ = ( - "CustomerUserAccessServiceTransport", - "CustomerUserAccessServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/base.py b/google/ads/googleads/v6/services/services/customer_user_access_service/transports/base.py deleted file mode 100644 index d85a7350f..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import customer_user_access -from google.ads.googleads.v6.services.types import customer_user_access_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class CustomerUserAccessServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerUserAccessService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_customer_user_access: gapic_v1.method.wrap_method( - self.get_customer_user_access, - default_timeout=None, - client_info=client_info, - ), - self.mutate_customer_user_access: gapic_v1.method.wrap_method( - self.mutate_customer_user_access, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_customer_user_access( - self, - ) -> typing.Callable[ - [customer_user_access_service.GetCustomerUserAccessRequest], - customer_user_access.CustomerUserAccess, - ]: - raise NotImplementedError - - @property - def mutate_customer_user_access( - self, - ) -> typing.Callable[ - [customer_user_access_service.MutateCustomerUserAccessRequest], - customer_user_access_service.MutateCustomerUserAccessResponse, - ]: - raise NotImplementedError - - -__all__ = ("CustomerUserAccessServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/grpc.py b/google/ads/googleads/v6/services/services/customer_user_access_service/transports/grpc.py deleted file mode 100644 index 8a71b4dff..000000000 --- a/google/ads/googleads/v6/services/services/customer_user_access_service/transports/grpc.py +++ /dev/null @@ -1,281 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import customer_user_access -from google.ads.googleads.v6.services.types import customer_user_access_service - -from .base import CustomerUserAccessServiceTransport, DEFAULT_CLIENT_INFO - - -class CustomerUserAccessServiceGrpcTransport( - CustomerUserAccessServiceTransport -): - """gRPC backend transport for CustomerUserAccessService. - - This service manages the permissions of a user on a given - customer. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_customer_user_access( - self, - ) -> Callable[ - [customer_user_access_service.GetCustomerUserAccessRequest], - customer_user_access.CustomerUserAccess, - ]: - r"""Return a callable for the get customer user access method over gRPC. - - Returns the CustomerUserAccess in full detail. - - Returns: - Callable[[~.GetCustomerUserAccessRequest], - ~.CustomerUserAccess]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_customer_user_access" not in self._stubs: - self._stubs[ - "get_customer_user_access" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerUserAccessService/GetCustomerUserAccess", - request_serializer=customer_user_access_service.GetCustomerUserAccessRequest.serialize, - response_deserializer=customer_user_access.CustomerUserAccess.deserialize, - ) - return self._stubs["get_customer_user_access"] - - @property - def mutate_customer_user_access( - self, - ) -> Callable[ - [customer_user_access_service.MutateCustomerUserAccessRequest], - customer_user_access_service.MutateCustomerUserAccessResponse, - ]: - r"""Return a callable for the mutate customer user access method over gRPC. - - Updates, removes permission of a user on a given - customer. Operation statuses are returned. - - Returns: - Callable[[~.MutateCustomerUserAccessRequest], - ~.MutateCustomerUserAccessResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_customer_user_access" not in self._stubs: - self._stubs[ - "mutate_customer_user_access" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerUserAccessService/MutateCustomerUserAccess", - request_serializer=customer_user_access_service.MutateCustomerUserAccessRequest.serialize, - response_deserializer=customer_user_access_service.MutateCustomerUserAccessResponse.deserialize, - ) - return self._stubs["mutate_customer_user_access"] - - -__all__ = ("CustomerUserAccessServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/detail_placement_view_service/__init__.py b/google/ads/googleads/v6/services/services/detail_placement_view_service/__init__.py deleted file mode 100644 index 5093c0608..000000000 --- a/google/ads/googleads/v6/services/services/detail_placement_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import DetailPlacementViewServiceClient - -__all__ = ("DetailPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/detail_placement_view_service/client.py b/google/ads/googleads/v6/services/services/detail_placement_view_service/client.py deleted file mode 100644 index dce5cb0f2..000000000 --- a/google/ads/googleads/v6/services/services/detail_placement_view_service/client.py +++ /dev/null @@ -1,449 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import detail_placement_view -from google.ads.googleads.v6.services.types import detail_placement_view_service - -from .transports.base import ( - DetailPlacementViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import DetailPlacementViewServiceGrpcTransport - - -class DetailPlacementViewServiceClientMeta(type): - """Metaclass for the DetailPlacementViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DetailPlacementViewServiceTransport]] - _transport_registry["grpc"] = DetailPlacementViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[DetailPlacementViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DetailPlacementViewServiceClient( - metaclass=DetailPlacementViewServiceClientMeta -): - """Service to fetch Detail Placement views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DetailPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DetailPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DetailPlacementViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - DetailPlacementViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def detail_placement_view_path( - customer_id: str, ad_group_id: str, base64_placement: str, - ) -> str: - """Return a fully-qualified detail_placement_view string.""" - return "customers/{customer_id}/detailPlacementViews/{ad_group_id}~{base64_placement}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - base64_placement=base64_placement, - ) - - @staticmethod - def parse_detail_placement_view_path(path: str) -> Dict[str, str]: - """Parse a detail_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/detailPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, DetailPlacementViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the detail placement view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DetailPlacementViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DetailPlacementViewServiceTransport): - # transport is a DetailPlacementViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = DetailPlacementViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_detail_placement_view( - self, - request: detail_placement_view_service.GetDetailPlacementViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> detail_placement_view.DetailPlacementView: - r"""Returns the requested Detail Placement view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetDetailPlacementViewRequest`): - The request object. Request message for - [DetailPlacementViewService.GetDetailPlacementView][google.ads.googleads.v6.services.DetailPlacementViewService.GetDetailPlacementView]. - resource_name (:class:`str`): - Required. The resource name of the - Detail Placement view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.DetailPlacementView: - A view with metrics aggregated by ad - group and URL or YouTube video. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a detail_placement_view_service.GetDetailPlacementViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, detail_placement_view_service.GetDetailPlacementViewRequest - ): - request = detail_placement_view_service.GetDetailPlacementViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_detail_placement_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("DetailPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/__init__.py deleted file mode 100644 index 56a9fbba4..000000000 --- a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import DetailPlacementViewServiceTransport -from .grpc import DetailPlacementViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[DetailPlacementViewServiceTransport]] -_transport_registry["grpc"] = DetailPlacementViewServiceGrpcTransport - - -__all__ = ( - "DetailPlacementViewServiceTransport", - "DetailPlacementViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/base.py b/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/base.py deleted file mode 100644 index 15e2860f6..000000000 --- a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import detail_placement_view -from google.ads.googleads.v6.services.types import detail_placement_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class DetailPlacementViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for DetailPlacementViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_detail_placement_view: gapic_v1.method.wrap_method( - self.get_detail_placement_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_detail_placement_view( - self, - ) -> typing.Callable[ - [detail_placement_view_service.GetDetailPlacementViewRequest], - detail_placement_view.DetailPlacementView, - ]: - raise NotImplementedError - - -__all__ = ("DetailPlacementViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/grpc.py deleted file mode 100644 index 9ee8fbe2f..000000000 --- a/google/ads/googleads/v6/services/services/detail_placement_view_service/transports/grpc.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import detail_placement_view -from google.ads.googleads.v6.services.types import detail_placement_view_service - -from .base import DetailPlacementViewServiceTransport, DEFAULT_CLIENT_INFO - - -class DetailPlacementViewServiceGrpcTransport( - DetailPlacementViewServiceTransport -): - """gRPC backend transport for DetailPlacementViewService. - - Service to fetch Detail Placement views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_detail_placement_view( - self, - ) -> Callable[ - [detail_placement_view_service.GetDetailPlacementViewRequest], - detail_placement_view.DetailPlacementView, - ]: - r"""Return a callable for the get detail placement view method over gRPC. - - Returns the requested Detail Placement view in full - detail. - - Returns: - Callable[[~.GetDetailPlacementViewRequest], - ~.DetailPlacementView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_detail_placement_view" not in self._stubs: - self._stubs[ - "get_detail_placement_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.DetailPlacementViewService/GetDetailPlacementView", - request_serializer=detail_placement_view_service.GetDetailPlacementViewRequest.serialize, - response_deserializer=detail_placement_view.DetailPlacementView.deserialize, - ) - return self._stubs["get_detail_placement_view"] - - -__all__ = ("DetailPlacementViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/display_keyword_view_service/__init__.py b/google/ads/googleads/v6/services/services/display_keyword_view_service/__init__.py deleted file mode 100644 index 503d51e89..000000000 --- a/google/ads/googleads/v6/services/services/display_keyword_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import DisplayKeywordViewServiceClient - -__all__ = ("DisplayKeywordViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/display_keyword_view_service/client.py b/google/ads/googleads/v6/services/services/display_keyword_view_service/client.py deleted file mode 100644 index 2b6840a1a..000000000 --- a/google/ads/googleads/v6/services/services/display_keyword_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import display_keyword_view -from google.ads.googleads.v6.services.types import display_keyword_view_service - -from .transports.base import ( - DisplayKeywordViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import DisplayKeywordViewServiceGrpcTransport - - -class DisplayKeywordViewServiceClientMeta(type): - """Metaclass for the DisplayKeywordViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DisplayKeywordViewServiceTransport]] - _transport_registry["grpc"] = DisplayKeywordViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[DisplayKeywordViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DisplayKeywordViewServiceClient( - metaclass=DisplayKeywordViewServiceClientMeta -): - """Service to manage display keyword views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DisplayKeywordViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DisplayKeywordViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DisplayKeywordViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - DisplayKeywordViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def display_keyword_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified display_keyword_view string.""" - return "customers/{customer_id}/displayKeywordViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_display_keyword_view_path(path: str) -> Dict[str, str]: - """Parse a display_keyword_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/displayKeywordViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, DisplayKeywordViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the display keyword view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DisplayKeywordViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DisplayKeywordViewServiceTransport): - # transport is a DisplayKeywordViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = DisplayKeywordViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_display_keyword_view( - self, - request: display_keyword_view_service.GetDisplayKeywordViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> display_keyword_view.DisplayKeywordView: - r"""Returns the requested display keyword view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetDisplayKeywordViewRequest`): - The request object. Request message for - [DisplayKeywordViewService.GetDisplayKeywordView][google.ads.googleads.v6.services.DisplayKeywordViewService.GetDisplayKeywordView]. - resource_name (:class:`str`): - Required. The resource name of the - display keyword view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.DisplayKeywordView: - A display keyword view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a display_keyword_view_service.GetDisplayKeywordViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, display_keyword_view_service.GetDisplayKeywordViewRequest - ): - request = display_keyword_view_service.GetDisplayKeywordViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_display_keyword_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("DisplayKeywordViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/__init__.py deleted file mode 100644 index bf69d2a03..000000000 --- a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import DisplayKeywordViewServiceTransport -from .grpc import DisplayKeywordViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[DisplayKeywordViewServiceTransport]] -_transport_registry["grpc"] = DisplayKeywordViewServiceGrpcTransport - - -__all__ = ( - "DisplayKeywordViewServiceTransport", - "DisplayKeywordViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/base.py b/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/base.py deleted file mode 100644 index 1d86e4a13..000000000 --- a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import display_keyword_view -from google.ads.googleads.v6.services.types import display_keyword_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class DisplayKeywordViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for DisplayKeywordViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_display_keyword_view: gapic_v1.method.wrap_method( - self.get_display_keyword_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_display_keyword_view( - self, - ) -> typing.Callable[ - [display_keyword_view_service.GetDisplayKeywordViewRequest], - display_keyword_view.DisplayKeywordView, - ]: - raise NotImplementedError - - -__all__ = ("DisplayKeywordViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/grpc.py deleted file mode 100644 index 2bc93fad0..000000000 --- a/google/ads/googleads/v6/services/services/display_keyword_view_service/transports/grpc.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import display_keyword_view -from google.ads.googleads.v6.services.types import display_keyword_view_service - -from .base import DisplayKeywordViewServiceTransport, DEFAULT_CLIENT_INFO - - -class DisplayKeywordViewServiceGrpcTransport( - DisplayKeywordViewServiceTransport -): - """gRPC backend transport for DisplayKeywordViewService. - - Service to manage display keyword views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_display_keyword_view( - self, - ) -> Callable[ - [display_keyword_view_service.GetDisplayKeywordViewRequest], - display_keyword_view.DisplayKeywordView, - ]: - r"""Return a callable for the get display keyword view method over gRPC. - - Returns the requested display keyword view in full - detail. - - Returns: - Callable[[~.GetDisplayKeywordViewRequest], - ~.DisplayKeywordView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_display_keyword_view" not in self._stubs: - self._stubs[ - "get_display_keyword_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.DisplayKeywordViewService/GetDisplayKeywordView", - request_serializer=display_keyword_view_service.GetDisplayKeywordViewRequest.serialize, - response_deserializer=display_keyword_view.DisplayKeywordView.deserialize, - ) - return self._stubs["get_display_keyword_view"] - - -__all__ = ("DisplayKeywordViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/distance_view_service/__init__.py b/google/ads/googleads/v6/services/services/distance_view_service/__init__.py deleted file mode 100644 index 42bff91e5..000000000 --- a/google/ads/googleads/v6/services/services/distance_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import DistanceViewServiceClient - -__all__ = ("DistanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/distance_view_service/client.py b/google/ads/googleads/v6/services/services/distance_view_service/client.py deleted file mode 100644 index 5407b48cf..000000000 --- a/google/ads/googleads/v6/services/services/distance_view_service/client.py +++ /dev/null @@ -1,449 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import distance_view -from google.ads.googleads.v6.services.types import distance_view_service - -from .transports.base import DistanceViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import DistanceViewServiceGrpcTransport - - -class DistanceViewServiceClientMeta(type): - """Metaclass for the DistanceViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DistanceViewServiceTransport]] - _transport_registry["grpc"] = DistanceViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[DistanceViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DistanceViewServiceClient(metaclass=DistanceViewServiceClientMeta): - """Service to fetch distance views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DistanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DistanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DistanceViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - DistanceViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def distance_view_path( - customer_id: str, placeholder_chain_id: str, distance_bucket: str, - ) -> str: - """Return a fully-qualified distance_view string.""" - return "customers/{customer_id}/distanceViews/{placeholder_chain_id}~{distance_bucket}".format( - customer_id=customer_id, - placeholder_chain_id=placeholder_chain_id, - distance_bucket=distance_bucket, - ) - - @staticmethod - def parse_distance_view_path(path: str) -> Dict[str, str]: - """Parse a distance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/distanceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, DistanceViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the distance view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DistanceViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DistanceViewServiceTransport): - # transport is a DistanceViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = DistanceViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_distance_view( - self, - request: distance_view_service.GetDistanceViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> distance_view.DistanceView: - r"""Returns the attributes of the requested distance - view. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetDistanceViewRequest`): - The request object. Request message for - [DistanceViewService.GetDistanceView][google.ads.googleads.v6.services.DistanceViewService.GetDistanceView]. - resource_name (:class:`str`): - Required. The resource name of the - distance view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.DistanceView: - A distance view with metrics - aggregated by the user's distance from - an advertiser's location extensions. - Each DistanceBucket includes all - impressions that fall within its - distance and a single impression will - contribute to the metrics for all - DistanceBuckets that include the user's - distance. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a distance_view_service.GetDistanceViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, distance_view_service.GetDistanceViewRequest - ): - request = distance_view_service.GetDistanceViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_distance_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("DistanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/distance_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/distance_view_service/transports/__init__.py deleted file mode 100644 index 748a12018..000000000 --- a/google/ads/googleads/v6/services/services/distance_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import DistanceViewServiceTransport -from .grpc import DistanceViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[DistanceViewServiceTransport]] -_transport_registry["grpc"] = DistanceViewServiceGrpcTransport - - -__all__ = ( - "DistanceViewServiceTransport", - "DistanceViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/distance_view_service/transports/base.py b/google/ads/googleads/v6/services/services/distance_view_service/transports/base.py deleted file mode 100644 index bfcdd35e7..000000000 --- a/google/ads/googleads/v6/services/services/distance_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import distance_view -from google.ads.googleads.v6.services.types import distance_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class DistanceViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for DistanceViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_distance_view: gapic_v1.method.wrap_method( - self.get_distance_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_distance_view( - self, - ) -> typing.Callable[ - [distance_view_service.GetDistanceViewRequest], - distance_view.DistanceView, - ]: - raise NotImplementedError - - -__all__ = ("DistanceViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/distance_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/distance_view_service/transports/grpc.py deleted file mode 100644 index 5624dce03..000000000 --- a/google/ads/googleads/v6/services/services/distance_view_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import distance_view -from google.ads.googleads.v6.services.types import distance_view_service - -from .base import DistanceViewServiceTransport, DEFAULT_CLIENT_INFO - - -class DistanceViewServiceGrpcTransport(DistanceViewServiceTransport): - """gRPC backend transport for DistanceViewService. - - Service to fetch distance views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_distance_view( - self, - ) -> Callable[ - [distance_view_service.GetDistanceViewRequest], - distance_view.DistanceView, - ]: - r"""Return a callable for the get distance view method over gRPC. - - Returns the attributes of the requested distance - view. - - Returns: - Callable[[~.GetDistanceViewRequest], - ~.DistanceView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_distance_view" not in self._stubs: - self._stubs["get_distance_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.DistanceViewService/GetDistanceView", - request_serializer=distance_view_service.GetDistanceViewRequest.serialize, - response_deserializer=distance_view.DistanceView.deserialize, - ) - return self._stubs["get_distance_view"] - - -__all__ = ("DistanceViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/domain_category_service/__init__.py b/google/ads/googleads/v6/services/services/domain_category_service/__init__.py deleted file mode 100644 index e76f5146a..000000000 --- a/google/ads/googleads/v6/services/services/domain_category_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import DomainCategoryServiceClient - -__all__ = ("DomainCategoryServiceClient",) diff --git a/google/ads/googleads/v6/services/services/domain_category_service/client.py b/google/ads/googleads/v6/services/services/domain_category_service/client.py deleted file mode 100644 index dd3ebece5..000000000 --- a/google/ads/googleads/v6/services/services/domain_category_service/client.py +++ /dev/null @@ -1,467 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import domain_category -from google.ads.googleads.v6.services.types import domain_category_service - -from .transports.base import DomainCategoryServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import DomainCategoryServiceGrpcTransport - - -class DomainCategoryServiceClientMeta(type): - """Metaclass for the DomainCategoryService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DomainCategoryServiceTransport]] - _transport_registry["grpc"] = DomainCategoryServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[DomainCategoryServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DomainCategoryServiceClient(metaclass=DomainCategoryServiceClientMeta): - """Service to fetch domain categories.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DomainCategoryServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DomainCategoryServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DomainCategoryServiceTransport: - """Return the transport used by the client instance. - - Returns: - DomainCategoryServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def domain_category_path( - customer_id: str, - campaign_id: str, - base64_category: str, - language_code: str, - ) -> str: - """Return a fully-qualified domain_category string.""" - return "customers/{customer_id}/domainCategories/{campaign_id}~{base64_category}~{language_code}".format( - customer_id=customer_id, - campaign_id=campaign_id, - base64_category=base64_category, - language_code=language_code, - ) - - @staticmethod - def parse_domain_category_path(path: str) -> Dict[str, str]: - """Parse a domain_category path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/domainCategories/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, DomainCategoryServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the domain category service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DomainCategoryServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, DomainCategoryServiceTransport): - # transport is a DomainCategoryServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = DomainCategoryServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_domain_category( - self, - request: domain_category_service.GetDomainCategoryRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> domain_category.DomainCategory: - r"""Returns the requested domain category. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetDomainCategoryRequest`): - The request object. Request message for - [DomainCategoryService.GetDomainCategory][google.ads.googleads.v6.services.DomainCategoryService.GetDomainCategory]. - resource_name (:class:`str`): - Required. Resource name of the domain - category to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.DomainCategory: - A category generated automatically by - crawling a domain. If a campaign uses - the DynamicSearchAdsSetting, then domain - categories will be generated for the - domain. The categories can be targeted - using WebpageConditionInfo. See: - https://support.google.com/google- - ads/answer/2471185 - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a domain_category_service.GetDomainCategoryRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, domain_category_service.GetDomainCategoryRequest - ): - request = domain_category_service.GetDomainCategoryRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_domain_category - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("DomainCategoryServiceClient",) diff --git a/google/ads/googleads/v6/services/services/domain_category_service/transports/__init__.py b/google/ads/googleads/v6/services/services/domain_category_service/transports/__init__.py deleted file mode 100644 index f2e49b091..000000000 --- a/google/ads/googleads/v6/services/services/domain_category_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import DomainCategoryServiceTransport -from .grpc import DomainCategoryServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[DomainCategoryServiceTransport]] -_transport_registry["grpc"] = DomainCategoryServiceGrpcTransport - - -__all__ = ( - "DomainCategoryServiceTransport", - "DomainCategoryServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/domain_category_service/transports/base.py b/google/ads/googleads/v6/services/services/domain_category_service/transports/base.py deleted file mode 100644 index b48098df3..000000000 --- a/google/ads/googleads/v6/services/services/domain_category_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import domain_category -from google.ads.googleads.v6.services.types import domain_category_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class DomainCategoryServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for DomainCategoryService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_domain_category: gapic_v1.method.wrap_method( - self.get_domain_category, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_domain_category( - self, - ) -> typing.Callable[ - [domain_category_service.GetDomainCategoryRequest], - domain_category.DomainCategory, - ]: - raise NotImplementedError - - -__all__ = ("DomainCategoryServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/domain_category_service/transports/grpc.py b/google/ads/googleads/v6/services/services/domain_category_service/transports/grpc.py deleted file mode 100644 index b0503c8e4..000000000 --- a/google/ads/googleads/v6/services/services/domain_category_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import domain_category -from google.ads.googleads.v6.services.types import domain_category_service - -from .base import DomainCategoryServiceTransport, DEFAULT_CLIENT_INFO - - -class DomainCategoryServiceGrpcTransport(DomainCategoryServiceTransport): - """gRPC backend transport for DomainCategoryService. - - Service to fetch domain categories. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_domain_category( - self, - ) -> Callable[ - [domain_category_service.GetDomainCategoryRequest], - domain_category.DomainCategory, - ]: - r"""Return a callable for the get domain category method over gRPC. - - Returns the requested domain category. - - Returns: - Callable[[~.GetDomainCategoryRequest], - ~.DomainCategory]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_domain_category" not in self._stubs: - self._stubs["get_domain_category"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.DomainCategoryService/GetDomainCategory", - request_serializer=domain_category_service.GetDomainCategoryRequest.serialize, - response_deserializer=domain_category.DomainCategory.deserialize, - ) - return self._stubs["get_domain_category"] - - -__all__ = ("DomainCategoryServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/__init__.py b/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/__init__.py deleted file mode 100644 index 885b3b806..000000000 --- a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import DynamicSearchAdsSearchTermViewServiceClient - -__all__ = ("DynamicSearchAdsSearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/client.py b/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/client.py deleted file mode 100644 index d197bc69f..000000000 --- a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/client.py +++ /dev/null @@ -1,471 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - dynamic_search_ads_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - dynamic_search_ads_search_term_view_service, -) - -from .transports.base import ( - DynamicSearchAdsSearchTermViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import DynamicSearchAdsSearchTermViewServiceGrpcTransport - - -class DynamicSearchAdsSearchTermViewServiceClientMeta(type): - """Metaclass for the DynamicSearchAdsSearchTermViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[DynamicSearchAdsSearchTermViewServiceTransport]] - _transport_registry[ - "grpc" - ] = DynamicSearchAdsSearchTermViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[DynamicSearchAdsSearchTermViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class DynamicSearchAdsSearchTermViewServiceClient( - metaclass=DynamicSearchAdsSearchTermViewServiceClientMeta -): - """Service to fetch dynamic search ads views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DynamicSearchAdsSearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - DynamicSearchAdsSearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> DynamicSearchAdsSearchTermViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - DynamicSearchAdsSearchTermViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def dynamic_search_ads_search_term_view_path( - customer_id: str, - ad_group_id: str, - search_term_fingerprint: str, - headline_fingerprint: str, - landing_page_fingerprint: str, - page_url_fingerprint: str, - ) -> str: - """Return a fully-qualified dynamic_search_ads_search_term_view string.""" - return "customers/{customer_id}/dynamicSearchAdsSearchTermViews/{ad_group_id}~{search_term_fingerprint}~{headline_fingerprint}~{landing_page_fingerprint}~{page_url_fingerprint}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - search_term_fingerprint=search_term_fingerprint, - headline_fingerprint=headline_fingerprint, - landing_page_fingerprint=landing_page_fingerprint, - page_url_fingerprint=page_url_fingerprint, - ) - - @staticmethod - def parse_dynamic_search_ads_search_term_view_path( - path: str, - ) -> Dict[str, str]: - """Parse a dynamic_search_ads_search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/dynamicSearchAdsSearchTermViews/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, DynamicSearchAdsSearchTermViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the dynamic search ads search term view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.DynamicSearchAdsSearchTermViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance( - transport, DynamicSearchAdsSearchTermViewServiceTransport - ): - # transport is a DynamicSearchAdsSearchTermViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = DynamicSearchAdsSearchTermViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_dynamic_search_ads_search_term_view( - self, - request: dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> dynamic_search_ads_search_term_view.DynamicSearchAdsSearchTermView: - r"""Returns the requested dynamic search ads search term - view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetDynamicSearchAdsSearchTermViewRequest`): - The request object. Request message for - [DynamicSearchAdsSearchTermViewService.GetDynamicSearchAdsSearchTermView][google.ads.googleads.v6.services.DynamicSearchAdsSearchTermViewService.GetDynamicSearchAdsSearchTermView]. - resource_name (:class:`str`): - Required. The resource name of the - dynamic search ads search term view to - fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.DynamicSearchAdsSearchTermView: - A dynamic search ads search term - view. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest, - ): - request = dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_dynamic_search_ads_search_term_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("DynamicSearchAdsSearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/__init__.py deleted file mode 100644 index 87c361020..000000000 --- a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import DynamicSearchAdsSearchTermViewServiceTransport -from .grpc import DynamicSearchAdsSearchTermViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[DynamicSearchAdsSearchTermViewServiceTransport]] -_transport_registry["grpc"] = DynamicSearchAdsSearchTermViewServiceGrpcTransport - - -__all__ = ( - "DynamicSearchAdsSearchTermViewServiceTransport", - "DynamicSearchAdsSearchTermViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/base.py b/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/base.py deleted file mode 100644 index be4354a7f..000000000 --- a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - dynamic_search_ads_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - dynamic_search_ads_search_term_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class DynamicSearchAdsSearchTermViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for DynamicSearchAdsSearchTermViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_dynamic_search_ads_search_term_view: gapic_v1.method.wrap_method( - self.get_dynamic_search_ads_search_term_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_dynamic_search_ads_search_term_view( - self, - ) -> typing.Callable[ - [ - dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest - ], - dynamic_search_ads_search_term_view.DynamicSearchAdsSearchTermView, - ]: - raise NotImplementedError - - -__all__ = ("DynamicSearchAdsSearchTermViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/grpc.py deleted file mode 100644 index 8e35468b4..000000000 --- a/google/ads/googleads/v6/services/services/dynamic_search_ads_search_term_view_service/transports/grpc.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - dynamic_search_ads_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - dynamic_search_ads_search_term_view_service, -) - -from .base import ( - DynamicSearchAdsSearchTermViewServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class DynamicSearchAdsSearchTermViewServiceGrpcTransport( - DynamicSearchAdsSearchTermViewServiceTransport -): - """gRPC backend transport for DynamicSearchAdsSearchTermViewService. - - Service to fetch dynamic search ads views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_dynamic_search_ads_search_term_view( - self, - ) -> Callable[ - [ - dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest - ], - dynamic_search_ads_search_term_view.DynamicSearchAdsSearchTermView, - ]: - r"""Return a callable for the get dynamic search ads search - term view method over gRPC. - - Returns the requested dynamic search ads search term - view in full detail. - - Returns: - Callable[[~.GetDynamicSearchAdsSearchTermViewRequest], - ~.DynamicSearchAdsSearchTermView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_dynamic_search_ads_search_term_view" not in self._stubs: - self._stubs[ - "get_dynamic_search_ads_search_term_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.DynamicSearchAdsSearchTermViewService/GetDynamicSearchAdsSearchTermView", - request_serializer=dynamic_search_ads_search_term_view_service.GetDynamicSearchAdsSearchTermViewRequest.serialize, - response_deserializer=dynamic_search_ads_search_term_view.DynamicSearchAdsSearchTermView.deserialize, - ) - return self._stubs["get_dynamic_search_ads_search_term_view"] - - -__all__ = ("DynamicSearchAdsSearchTermViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/__init__.py b/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/__init__.py deleted file mode 100644 index 6d9a27bf3..000000000 --- a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ExpandedLandingPageViewServiceClient - -__all__ = ("ExpandedLandingPageViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/client.py b/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/client.py deleted file mode 100644 index f63d934ea..000000000 --- a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/client.py +++ /dev/null @@ -1,454 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import expanded_landing_page_view -from google.ads.googleads.v6.services.types import ( - expanded_landing_page_view_service, -) - -from .transports.base import ( - ExpandedLandingPageViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ExpandedLandingPageViewServiceGrpcTransport - - -class ExpandedLandingPageViewServiceClientMeta(type): - """Metaclass for the ExpandedLandingPageViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ExpandedLandingPageViewServiceTransport]] - _transport_registry["grpc"] = ExpandedLandingPageViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ExpandedLandingPageViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ExpandedLandingPageViewServiceClient( - metaclass=ExpandedLandingPageViewServiceClientMeta -): - """Service to fetch expanded landing page views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ExpandedLandingPageViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ExpandedLandingPageViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ExpandedLandingPageViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ExpandedLandingPageViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def expanded_landing_page_view_path( - customer_id: str, expanded_final_url_fingerprint: str, - ) -> str: - """Return a fully-qualified expanded_landing_page_view string.""" - return "customers/{customer_id}/expandedLandingPageViews/{expanded_final_url_fingerprint}".format( - customer_id=customer_id, - expanded_final_url_fingerprint=expanded_final_url_fingerprint, - ) - - @staticmethod - def parse_expanded_landing_page_view_path(path: str) -> Dict[str, str]: - """Parse a expanded_landing_page_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/expandedLandingPageViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ExpandedLandingPageViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the expanded landing page view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ExpandedLandingPageViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ExpandedLandingPageViewServiceTransport): - # transport is a ExpandedLandingPageViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ExpandedLandingPageViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_expanded_landing_page_view( - self, - request: expanded_landing_page_view_service.GetExpandedLandingPageViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> expanded_landing_page_view.ExpandedLandingPageView: - r"""Returns the requested expanded landing page view in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetExpandedLandingPageViewRequest`): - The request object. Request message for - [ExpandedLandingPageViewService.GetExpandedLandingPageView][google.ads.googleads.v6.services.ExpandedLandingPageViewService.GetExpandedLandingPageView]. - resource_name (:class:`str`): - Required. The resource name of the - expanded landing page view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ExpandedLandingPageView: - A landing page view with metrics - aggregated at the expanded final URL - level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a expanded_landing_page_view_service.GetExpandedLandingPageViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - expanded_landing_page_view_service.GetExpandedLandingPageViewRequest, - ): - request = expanded_landing_page_view_service.GetExpandedLandingPageViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_expanded_landing_page_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ExpandedLandingPageViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/__init__.py deleted file mode 100644 index 52d44a7af..000000000 --- a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ExpandedLandingPageViewServiceTransport -from .grpc import ExpandedLandingPageViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ExpandedLandingPageViewServiceTransport]] -_transport_registry["grpc"] = ExpandedLandingPageViewServiceGrpcTransport - - -__all__ = ( - "ExpandedLandingPageViewServiceTransport", - "ExpandedLandingPageViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/base.py b/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/base.py deleted file mode 100644 index 6501e1117..000000000 --- a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import expanded_landing_page_view -from google.ads.googleads.v6.services.types import ( - expanded_landing_page_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ExpandedLandingPageViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ExpandedLandingPageViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_expanded_landing_page_view: gapic_v1.method.wrap_method( - self.get_expanded_landing_page_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_expanded_landing_page_view( - self, - ) -> typing.Callable[ - [expanded_landing_page_view_service.GetExpandedLandingPageViewRequest], - expanded_landing_page_view.ExpandedLandingPageView, - ]: - raise NotImplementedError - - -__all__ = ("ExpandedLandingPageViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/grpc.py deleted file mode 100644 index 327755c5a..000000000 --- a/google/ads/googleads/v6/services/services/expanded_landing_page_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import expanded_landing_page_view -from google.ads.googleads.v6.services.types import ( - expanded_landing_page_view_service, -) - -from .base import ExpandedLandingPageViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ExpandedLandingPageViewServiceGrpcTransport( - ExpandedLandingPageViewServiceTransport -): - """gRPC backend transport for ExpandedLandingPageViewService. - - Service to fetch expanded landing page views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_expanded_landing_page_view( - self, - ) -> Callable[ - [expanded_landing_page_view_service.GetExpandedLandingPageViewRequest], - expanded_landing_page_view.ExpandedLandingPageView, - ]: - r"""Return a callable for the get expanded landing page view method over gRPC. - - Returns the requested expanded landing page view in - full detail. - - Returns: - Callable[[~.GetExpandedLandingPageViewRequest], - ~.ExpandedLandingPageView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_expanded_landing_page_view" not in self._stubs: - self._stubs[ - "get_expanded_landing_page_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ExpandedLandingPageViewService/GetExpandedLandingPageView", - request_serializer=expanded_landing_page_view_service.GetExpandedLandingPageViewRequest.serialize, - response_deserializer=expanded_landing_page_view.ExpandedLandingPageView.deserialize, - ) - return self._stubs["get_expanded_landing_page_view"] - - -__all__ = ("ExpandedLandingPageViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/extension_feed_item_service/__init__.py b/google/ads/googleads/v6/services/services/extension_feed_item_service/__init__.py deleted file mode 100644 index 510b04be6..000000000 --- a/google/ads/googleads/v6/services/services/extension_feed_item_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ExtensionFeedItemServiceClient - -__all__ = ("ExtensionFeedItemServiceClient",) diff --git a/google/ads/googleads/v6/services/services/extension_feed_item_service/client.py b/google/ads/googleads/v6/services/services/extension_feed_item_service/client.py deleted file mode 100644 index aa7e9243d..000000000 --- a/google/ads/googleads/v6/services/services/extension_feed_item_service/client.py +++ /dev/null @@ -1,602 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import extension_feed_item -from google.ads.googleads.v6.services.types import extension_feed_item_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - ExtensionFeedItemServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ExtensionFeedItemServiceGrpcTransport - - -class ExtensionFeedItemServiceClientMeta(type): - """Metaclass for the ExtensionFeedItemService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ExtensionFeedItemServiceTransport]] - _transport_registry["grpc"] = ExtensionFeedItemServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ExtensionFeedItemServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ExtensionFeedItemServiceClient( - metaclass=ExtensionFeedItemServiceClientMeta -): - """Service to manage extension feed items.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ExtensionFeedItemServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ExtensionFeedItemServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ExtensionFeedItemServiceTransport: - """Return the transport used by the client instance. - - Returns: - ExtensionFeedItemServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ExtensionFeedItemServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the extension feed item service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ExtensionFeedItemServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ExtensionFeedItemServiceTransport): - # transport is a ExtensionFeedItemServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ExtensionFeedItemServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_extension_feed_item( - self, - request: extension_feed_item_service.GetExtensionFeedItemRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> extension_feed_item.ExtensionFeedItem: - r"""Returns the requested extension feed item in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetExtensionFeedItemRequest`): - The request object. Request message for - [ExtensionFeedItemService.GetExtensionFeedItem][google.ads.googleads.v6.services.ExtensionFeedItemService.GetExtensionFeedItem]. - resource_name (:class:`str`): - Required. The resource name of the - extension feed item to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ExtensionFeedItem: - An extension feed item. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a extension_feed_item_service.GetExtensionFeedItemRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, extension_feed_item_service.GetExtensionFeedItemRequest - ): - request = extension_feed_item_service.GetExtensionFeedItemRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_extension_feed_item - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_extension_feed_items( - self, - request: extension_feed_item_service.MutateExtensionFeedItemsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - extension_feed_item_service.ExtensionFeedItemOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> extension_feed_item_service.MutateExtensionFeedItemsResponse: - r"""Creates, updates, or removes extension feed items. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateExtensionFeedItemsRequest`): - The request object. Request message for - [ExtensionFeedItemService.MutateExtensionFeedItems][google.ads.googleads.v6.services.ExtensionFeedItemService.MutateExtensionFeedItems]. - customer_id (:class:`str`): - Required. The ID of the customer - whose extension feed items are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.ExtensionFeedItemOperation]`): - Required. The list of operations to - perform on individual extension feed - items. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateExtensionFeedItemsResponse: - Response message for an extension - feed item mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a extension_feed_item_service.MutateExtensionFeedItemsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, extension_feed_item_service.MutateExtensionFeedItemsRequest - ): - request = extension_feed_item_service.MutateExtensionFeedItemsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_extension_feed_items - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ExtensionFeedItemServiceClient",) diff --git a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/__init__.py b/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/__init__.py deleted file mode 100644 index 665825f8b..000000000 --- a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ExtensionFeedItemServiceTransport -from .grpc import ExtensionFeedItemServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ExtensionFeedItemServiceTransport]] -_transport_registry["grpc"] = ExtensionFeedItemServiceGrpcTransport - - -__all__ = ( - "ExtensionFeedItemServiceTransport", - "ExtensionFeedItemServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/base.py b/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/base.py deleted file mode 100644 index 36ef24421..000000000 --- a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import extension_feed_item -from google.ads.googleads.v6.services.types import extension_feed_item_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ExtensionFeedItemServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ExtensionFeedItemService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_extension_feed_item: gapic_v1.method.wrap_method( - self.get_extension_feed_item, - default_timeout=None, - client_info=client_info, - ), - self.mutate_extension_feed_items: gapic_v1.method.wrap_method( - self.mutate_extension_feed_items, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_extension_feed_item( - self, - ) -> typing.Callable[ - [extension_feed_item_service.GetExtensionFeedItemRequest], - extension_feed_item.ExtensionFeedItem, - ]: - raise NotImplementedError - - @property - def mutate_extension_feed_items( - self, - ) -> typing.Callable[ - [extension_feed_item_service.MutateExtensionFeedItemsRequest], - extension_feed_item_service.MutateExtensionFeedItemsResponse, - ]: - raise NotImplementedError - - -__all__ = ("ExtensionFeedItemServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/grpc.py b/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/grpc.py deleted file mode 100644 index a1b8fabef..000000000 --- a/google/ads/googleads/v6/services/services/extension_feed_item_service/transports/grpc.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import extension_feed_item -from google.ads.googleads.v6.services.types import extension_feed_item_service - -from .base import ExtensionFeedItemServiceTransport, DEFAULT_CLIENT_INFO - - -class ExtensionFeedItemServiceGrpcTransport(ExtensionFeedItemServiceTransport): - """gRPC backend transport for ExtensionFeedItemService. - - Service to manage extension feed items. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_extension_feed_item( - self, - ) -> Callable[ - [extension_feed_item_service.GetExtensionFeedItemRequest], - extension_feed_item.ExtensionFeedItem, - ]: - r"""Return a callable for the get extension feed item method over gRPC. - - Returns the requested extension feed item in full - detail. - - Returns: - Callable[[~.GetExtensionFeedItemRequest], - ~.ExtensionFeedItem]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_extension_feed_item" not in self._stubs: - self._stubs[ - "get_extension_feed_item" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ExtensionFeedItemService/GetExtensionFeedItem", - request_serializer=extension_feed_item_service.GetExtensionFeedItemRequest.serialize, - response_deserializer=extension_feed_item.ExtensionFeedItem.deserialize, - ) - return self._stubs["get_extension_feed_item"] - - @property - def mutate_extension_feed_items( - self, - ) -> Callable[ - [extension_feed_item_service.MutateExtensionFeedItemsRequest], - extension_feed_item_service.MutateExtensionFeedItemsResponse, - ]: - r"""Return a callable for the mutate extension feed items method over gRPC. - - Creates, updates, or removes extension feed items. - Operation statuses are returned. - - Returns: - Callable[[~.MutateExtensionFeedItemsRequest], - ~.MutateExtensionFeedItemsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_extension_feed_items" not in self._stubs: - self._stubs[ - "mutate_extension_feed_items" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ExtensionFeedItemService/MutateExtensionFeedItems", - request_serializer=extension_feed_item_service.MutateExtensionFeedItemsRequest.serialize, - response_deserializer=extension_feed_item_service.MutateExtensionFeedItemsResponse.deserialize, - ) - return self._stubs["mutate_extension_feed_items"] - - -__all__ = ("ExtensionFeedItemServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_service/__init__.py b/google/ads/googleads/v6/services/services/feed_item_service/__init__.py deleted file mode 100644 index 941cb3e32..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedItemServiceClient - -__all__ = ("FeedItemServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_service/client.py b/google/ads/googleads/v6/services/services/feed_item_service/client.py deleted file mode 100644 index 114e8d2a4..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_service/client.py +++ /dev/null @@ -1,539 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item -from google.ads.googleads.v6.services.types import feed_item_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import FeedItemServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import FeedItemServiceGrpcTransport - - -class FeedItemServiceClientMeta(type): - """Metaclass for the FeedItemService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedItemServiceTransport]] - _transport_registry["grpc"] = FeedItemServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedItemServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedItemServiceClient(metaclass=FeedItemServiceClientMeta): - """Service to manage feed items.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedItemServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedItemServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedItemServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed item service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedItemServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedItemServiceTransport): - # transport is a FeedItemServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedItemServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_item( - self, - request: feed_item_service.GetFeedItemRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item.FeedItem: - r"""Returns the requested feed item in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedItemRequest`): - The request object. Request message for - [FeedItemService.GetFeedItem][google.ads.googleads.v6.services.FeedItemService.GetFeedItem]. - resource_name (:class:`str`): - Required. The resource name of the - feed item to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedItem: - A feed item. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_service.GetFeedItemRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_item_service.GetFeedItemRequest): - request = feed_item_service.GetFeedItemRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_feed_item] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feed_items( - self, - request: feed_item_service.MutateFeedItemsRequest = None, - *, - customer_id: str = None, - operations: Sequence[feed_item_service.FeedItemOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_service.MutateFeedItemsResponse: - r"""Creates, updates, or removes feed items. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedItemsRequest`): - The request object. Request message for - [FeedItemService.MutateFeedItems][google.ads.googleads.v6.services.FeedItemService.MutateFeedItems]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feed items are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedItemOperation]`): - Required. The list of operations to - perform on individual feed items. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedItemsResponse: - Response message for an feed item - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_service.MutateFeedItemsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_item_service.MutateFeedItemsRequest): - request = feed_item_service.MutateFeedItemsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_feed_items - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedItemServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_item_service/transports/__init__.py deleted file mode 100644 index c3d195015..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedItemServiceTransport -from .grpc import FeedItemServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedItemServiceTransport]] -_transport_registry["grpc"] = FeedItemServiceGrpcTransport - - -__all__ = ( - "FeedItemServiceTransport", - "FeedItemServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_item_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_item_service/transports/base.py deleted file mode 100644 index 684ef6d66..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item -from google.ads.googleads.v6.services.types import feed_item_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedItemServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedItemService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_item: gapic_v1.method.wrap_method( - self.get_feed_item, - default_timeout=None, - client_info=client_info, - ), - self.mutate_feed_items: gapic_v1.method.wrap_method( - self.mutate_feed_items, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_item( - self, - ) -> typing.Callable[ - [feed_item_service.GetFeedItemRequest], feed_item.FeedItem - ]: - raise NotImplementedError - - @property - def mutate_feed_items( - self, - ) -> typing.Callable[ - [feed_item_service.MutateFeedItemsRequest], - feed_item_service.MutateFeedItemsResponse, - ]: - raise NotImplementedError - - -__all__ = ("FeedItemServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_item_service/transports/grpc.py deleted file mode 100644 index 91ca4657b..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_service/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item -from google.ads.googleads.v6.services.types import feed_item_service - -from .base import FeedItemServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedItemServiceGrpcTransport(FeedItemServiceTransport): - """gRPC backend transport for FeedItemService. - - Service to manage feed items. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_item( - self, - ) -> Callable[[feed_item_service.GetFeedItemRequest], feed_item.FeedItem]: - r"""Return a callable for the get feed item method over gRPC. - - Returns the requested feed item in full detail. - - Returns: - Callable[[~.GetFeedItemRequest], - ~.FeedItem]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_item" not in self._stubs: - self._stubs["get_feed_item"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemService/GetFeedItem", - request_serializer=feed_item_service.GetFeedItemRequest.serialize, - response_deserializer=feed_item.FeedItem.deserialize, - ) - return self._stubs["get_feed_item"] - - @property - def mutate_feed_items( - self, - ) -> Callable[ - [feed_item_service.MutateFeedItemsRequest], - feed_item_service.MutateFeedItemsResponse, - ]: - r"""Return a callable for the mutate feed items method over gRPC. - - Creates, updates, or removes feed items. Operation - statuses are returned. - - Returns: - Callable[[~.MutateFeedItemsRequest], - ~.MutateFeedItemsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feed_items" not in self._stubs: - self._stubs["mutate_feed_items"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemService/MutateFeedItems", - request_serializer=feed_item_service.MutateFeedItemsRequest.serialize, - response_deserializer=feed_item_service.MutateFeedItemsResponse.deserialize, - ) - return self._stubs["mutate_feed_items"] - - -__all__ = ("FeedItemServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_link_service/__init__.py b/google/ads/googleads/v6/services/services/feed_item_set_link_service/__init__.py deleted file mode 100644 index 8efa5df5a..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedItemSetLinkServiceClient - -__all__ = ("FeedItemSetLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_link_service/client.py b/google/ads/googleads/v6/services/services/feed_item_set_link_service/client.py deleted file mode 100644 index 7c644d719..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_link_service/client.py +++ /dev/null @@ -1,586 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set_link -from google.ads.googleads.v6.services.types import feed_item_set_link_service - -from .transports.base import ( - FeedItemSetLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import FeedItemSetLinkServiceGrpcTransport - - -class FeedItemSetLinkServiceClientMeta(type): - """Metaclass for the FeedItemSetLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedItemSetLinkServiceTransport]] - _transport_registry["grpc"] = FeedItemSetLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedItemSetLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedItemSetLinkServiceClient(metaclass=FeedItemSetLinkServiceClientMeta): - """Service to manage feed item set links.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemSetLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemSetLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedItemSetLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedItemSetLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_path( - customer_id: str, feed_id: str, feed_item_set_id: str, - ) -> str: - """Return a fully-qualified feed_item_set string.""" - return "customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - ) - - @staticmethod - def parse_feed_item_set_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_link_path( - customer_id: str, - feed_id: str, - feed_item_set_id: str, - feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item_set_link string.""" - return "customers/{customer_id}/feedItemSetLinks/{feed_id}~{feed_item_set_id}~{feed_item_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_set_link_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSetLinks/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedItemSetLinkServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed item set link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedItemSetLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedItemSetLinkServiceTransport): - # transport is a FeedItemSetLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedItemSetLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_item_set_link( - self, - request: feed_item_set_link_service.GetFeedItemSetLinkRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_set_link.FeedItemSetLink: - r"""Returns the requested feed item set link in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedItemSetLinkRequest`): - The request object. Request message for - [FeedItemSetLinkService.GetFeedItemSetLinks][]. - resource_name (:class:`str`): - Required. The resource name of the - feed item set link to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedItemSetLink: - Represents a link between a FeedItem - and a FeedItemSet. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_set_link_service.GetFeedItemSetLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_item_set_link_service.GetFeedItemSetLinkRequest - ): - request = feed_item_set_link_service.GetFeedItemSetLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_feed_item_set_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feed_item_set_links( - self, - request: feed_item_set_link_service.MutateFeedItemSetLinksRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - feed_item_set_link_service.FeedItemSetLinkOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_set_link_service.MutateFeedItemSetLinksResponse: - r"""Creates, updates, or removes feed item set links. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedItemSetLinksRequest`): - The request object. Request message for - [FeedItemSetLinkService.MutateFeedItemSetLinks][google.ads.googleads.v6.services.FeedItemSetLinkService.MutateFeedItemSetLinks]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feed item set links are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedItemSetLinkOperation]`): - Required. The list of operations to - perform on individual feed item set - links. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedItemSetLinksResponse: - Response message for a feed item set - link mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_set_link_service.MutateFeedItemSetLinksRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_item_set_link_service.MutateFeedItemSetLinksRequest - ): - request = feed_item_set_link_service.MutateFeedItemSetLinksRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_feed_item_set_links - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedItemSetLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/__init__.py deleted file mode 100644 index 8a494b172..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedItemSetLinkServiceTransport -from .grpc import FeedItemSetLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedItemSetLinkServiceTransport]] -_transport_registry["grpc"] = FeedItemSetLinkServiceGrpcTransport - - -__all__ = ( - "FeedItemSetLinkServiceTransport", - "FeedItemSetLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/base.py deleted file mode 100644 index 5dd927b8a..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set_link -from google.ads.googleads.v6.services.types import feed_item_set_link_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedItemSetLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedItemSetLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_item_set_link: gapic_v1.method.wrap_method( - self.get_feed_item_set_link, - default_timeout=None, - client_info=client_info, - ), - self.mutate_feed_item_set_links: gapic_v1.method.wrap_method( - self.mutate_feed_item_set_links, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_item_set_link( - self, - ) -> typing.Callable[ - [feed_item_set_link_service.GetFeedItemSetLinkRequest], - feed_item_set_link.FeedItemSetLink, - ]: - raise NotImplementedError - - @property - def mutate_feed_item_set_links( - self, - ) -> typing.Callable[ - [feed_item_set_link_service.MutateFeedItemSetLinksRequest], - feed_item_set_link_service.MutateFeedItemSetLinksResponse, - ]: - raise NotImplementedError - - -__all__ = ("FeedItemSetLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/grpc.py deleted file mode 100644 index 279ac7cf7..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_link_service/transports/grpc.py +++ /dev/null @@ -1,278 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set_link -from google.ads.googleads.v6.services.types import feed_item_set_link_service - -from .base import FeedItemSetLinkServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedItemSetLinkServiceGrpcTransport(FeedItemSetLinkServiceTransport): - """gRPC backend transport for FeedItemSetLinkService. - - Service to manage feed item set links. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_item_set_link( - self, - ) -> Callable[ - [feed_item_set_link_service.GetFeedItemSetLinkRequest], - feed_item_set_link.FeedItemSetLink, - ]: - r"""Return a callable for the get feed item set link method over gRPC. - - Returns the requested feed item set link in full - detail. - - Returns: - Callable[[~.GetFeedItemSetLinkRequest], - ~.FeedItemSetLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_item_set_link" not in self._stubs: - self._stubs[ - "get_feed_item_set_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemSetLinkService/GetFeedItemSetLink", - request_serializer=feed_item_set_link_service.GetFeedItemSetLinkRequest.serialize, - response_deserializer=feed_item_set_link.FeedItemSetLink.deserialize, - ) - return self._stubs["get_feed_item_set_link"] - - @property - def mutate_feed_item_set_links( - self, - ) -> Callable[ - [feed_item_set_link_service.MutateFeedItemSetLinksRequest], - feed_item_set_link_service.MutateFeedItemSetLinksResponse, - ]: - r"""Return a callable for the mutate feed item set links method over gRPC. - - Creates, updates, or removes feed item set links. - - Returns: - Callable[[~.MutateFeedItemSetLinksRequest], - ~.MutateFeedItemSetLinksResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feed_item_set_links" not in self._stubs: - self._stubs[ - "mutate_feed_item_set_links" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemSetLinkService/MutateFeedItemSetLinks", - request_serializer=feed_item_set_link_service.MutateFeedItemSetLinksRequest.serialize, - response_deserializer=feed_item_set_link_service.MutateFeedItemSetLinksResponse.deserialize, - ) - return self._stubs["mutate_feed_item_set_links"] - - -__all__ = ("FeedItemSetLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_service/__init__.py b/google/ads/googleads/v6/services/services/feed_item_set_service/__init__.py deleted file mode 100644 index 79883059a..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedItemSetServiceClient - -__all__ = ("FeedItemSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_service/client.py b/google/ads/googleads/v6/services/services/feed_item_set_service/client.py deleted file mode 100644 index 9ad0a5892..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_service/client.py +++ /dev/null @@ -1,550 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set -from google.ads.googleads.v6.services.types import feed_item_set_service - -from .transports.base import FeedItemSetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import FeedItemSetServiceGrpcTransport - - -class FeedItemSetServiceClientMeta(type): - """Metaclass for the FeedItemSetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedItemSetServiceTransport]] - _transport_registry["grpc"] = FeedItemSetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedItemSetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedItemSetServiceClient(metaclass=FeedItemSetServiceClientMeta): - """Service to manage feed Item Set""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemSetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemSetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedItemSetServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedItemSetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_path( - customer_id: str, feed_id: str, feed_item_set_id: str, - ) -> str: - """Return a fully-qualified feed_item_set string.""" - return "customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - ) - - @staticmethod - def parse_feed_item_set_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedItemSetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed item set service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedItemSetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedItemSetServiceTransport): - # transport is a FeedItemSetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedItemSetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_item_set( - self, - request: feed_item_set_service.GetFeedItemSetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_set.FeedItemSet: - r"""Returns the requested feed item set in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedItemSetRequest`): - The request object. Request message for - [FeedItemSetService.GetFeedItemSet][google.ads.googleads.v6.services.FeedItemSetService.GetFeedItemSet]. - resource_name (:class:`str`): - Required. The resource name of the - feed item set to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedItemSet: - Represents a set of feed items. The - set can be used and shared among certain - feed item features. For instance, the - set can be referenced within the - matching functions of CustomerFeed, - CampaignFeed, and AdGroupFeed. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_set_service.GetFeedItemSetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_item_set_service.GetFeedItemSetRequest): - request = feed_item_set_service.GetFeedItemSetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_feed_item_set - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feed_item_sets( - self, - request: feed_item_set_service.MutateFeedItemSetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[feed_item_set_service.FeedItemSetOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_set_service.MutateFeedItemSetsResponse: - r"""Creates, updates or removes feed item sets. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedItemSetsRequest`): - The request object. Request message for - [FeedItemSetService.MutateFeedItemSets][google.ads.googleads.v6.services.FeedItemSetService.MutateFeedItemSets]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feed item sets are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedItemSetOperation]`): - Required. The list of operations to - perform on individual feed item sets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedItemSetsResponse: - Response message for an feed item set - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_set_service.MutateFeedItemSetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_item_set_service.MutateFeedItemSetsRequest - ): - request = feed_item_set_service.MutateFeedItemSetsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_feed_item_sets - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedItemSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_item_set_service/transports/__init__.py deleted file mode 100644 index d809db1b0..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedItemSetServiceTransport -from .grpc import FeedItemSetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedItemSetServiceTransport]] -_transport_registry["grpc"] = FeedItemSetServiceGrpcTransport - - -__all__ = ( - "FeedItemSetServiceTransport", - "FeedItemSetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_item_set_service/transports/base.py deleted file mode 100644 index c305cb78e..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set -from google.ads.googleads.v6.services.types import feed_item_set_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedItemSetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedItemSetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_item_set: gapic_v1.method.wrap_method( - self.get_feed_item_set, - default_timeout=None, - client_info=client_info, - ), - self.mutate_feed_item_sets: gapic_v1.method.wrap_method( - self.mutate_feed_item_sets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_item_set( - self, - ) -> typing.Callable[ - [feed_item_set_service.GetFeedItemSetRequest], feed_item_set.FeedItemSet - ]: - raise NotImplementedError - - @property - def mutate_feed_item_sets( - self, - ) -> typing.Callable[ - [feed_item_set_service.MutateFeedItemSetsRequest], - feed_item_set_service.MutateFeedItemSetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("FeedItemSetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_item_set_service/transports/grpc.py deleted file mode 100644 index 9b906a24d..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_set_service/transports/grpc.py +++ /dev/null @@ -1,275 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_set -from google.ads.googleads.v6.services.types import feed_item_set_service - -from .base import FeedItemSetServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedItemSetServiceGrpcTransport(FeedItemSetServiceTransport): - """gRPC backend transport for FeedItemSetService. - - Service to manage feed Item Set - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_item_set( - self, - ) -> Callable[ - [feed_item_set_service.GetFeedItemSetRequest], feed_item_set.FeedItemSet - ]: - r"""Return a callable for the get feed item set method over gRPC. - - Returns the requested feed item set in full detail. - - Returns: - Callable[[~.GetFeedItemSetRequest], - ~.FeedItemSet]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_item_set" not in self._stubs: - self._stubs["get_feed_item_set"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemSetService/GetFeedItemSet", - request_serializer=feed_item_set_service.GetFeedItemSetRequest.serialize, - response_deserializer=feed_item_set.FeedItemSet.deserialize, - ) - return self._stubs["get_feed_item_set"] - - @property - def mutate_feed_item_sets( - self, - ) -> Callable[ - [feed_item_set_service.MutateFeedItemSetsRequest], - feed_item_set_service.MutateFeedItemSetsResponse, - ]: - r"""Return a callable for the mutate feed item sets method over gRPC. - - Creates, updates or removes feed item sets. Operation - statuses are returned. - - Returns: - Callable[[~.MutateFeedItemSetsRequest], - ~.MutateFeedItemSetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feed_item_sets" not in self._stubs: - self._stubs[ - "mutate_feed_item_sets" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemSetService/MutateFeedItemSets", - request_serializer=feed_item_set_service.MutateFeedItemSetsRequest.serialize, - response_deserializer=feed_item_set_service.MutateFeedItemSetsResponse.deserialize, - ) - return self._stubs["mutate_feed_item_sets"] - - -__all__ = ("FeedItemSetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_target_service/__init__.py b/google/ads/googleads/v6/services/services/feed_item_target_service/__init__.py deleted file mode 100644 index 80b504a6d..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_target_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedItemTargetServiceClient - -__all__ = ("FeedItemTargetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_target_service/client.py b/google/ads/googleads/v6/services/services/feed_item_target_service/client.py deleted file mode 100644 index 5aaf0230e..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_target_service/client.py +++ /dev/null @@ -1,606 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_target -from google.ads.googleads.v6.services.types import feed_item_target_service - -from .transports.base import FeedItemTargetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import FeedItemTargetServiceGrpcTransport - - -class FeedItemTargetServiceClientMeta(type): - """Metaclass for the FeedItemTargetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedItemTargetServiceTransport]] - _transport_registry["grpc"] = FeedItemTargetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedItemTargetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedItemTargetServiceClient(metaclass=FeedItemTargetServiceClientMeta): - """Service to manage feed item targets.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemTargetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedItemTargetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedItemTargetServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedItemTargetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_target_path( - customer_id: str, - feed_id: str, - feed_item_id: str, - feed_item_target_type: str, - feed_item_target_id: str, - ) -> str: - """Return a fully-qualified feed_item_target string.""" - return "customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_id=feed_item_id, - feed_item_target_type=feed_item_target_type, - feed_item_target_id=feed_item_target_id, - ) - - @staticmethod - def parse_feed_item_target_path(path: str) -> Dict[str, str]: - """Parse a feed_item_target path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemTargets/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedItemTargetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed item target service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedItemTargetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedItemTargetServiceTransport): - # transport is a FeedItemTargetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedItemTargetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_item_target( - self, - request: feed_item_target_service.GetFeedItemTargetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_target.FeedItemTarget: - r"""Returns the requested feed item targets in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedItemTargetRequest`): - The request object. Request message for - [FeedItemTargetService.GetFeedItemTarget][google.ads.googleads.v6.services.FeedItemTargetService.GetFeedItemTarget]. - resource_name (:class:`str`): - Required. The resource name of the - feed item targets to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedItemTarget: - A feed item target. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_target_service.GetFeedItemTargetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_item_target_service.GetFeedItemTargetRequest - ): - request = feed_item_target_service.GetFeedItemTargetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_feed_item_target - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feed_item_targets( - self, - request: feed_item_target_service.MutateFeedItemTargetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - feed_item_target_service.FeedItemTargetOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_item_target_service.MutateFeedItemTargetsResponse: - r"""Creates or removes feed item targets. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedItemTargetsRequest`): - The request object. Request message for - [FeedItemTargetService.MutateFeedItemTargets][google.ads.googleads.v6.services.FeedItemTargetService.MutateFeedItemTargets]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feed item targets are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedItemTargetOperation]`): - Required. The list of operations to - perform on individual feed item targets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedItemTargetsResponse: - Response message for an feed item - target mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_item_target_service.MutateFeedItemTargetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_item_target_service.MutateFeedItemTargetsRequest - ): - request = feed_item_target_service.MutateFeedItemTargetsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_feed_item_targets - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedItemTargetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_item_target_service/transports/__init__.py deleted file mode 100644 index 06d50c60d..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedItemTargetServiceTransport -from .grpc import FeedItemTargetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedItemTargetServiceTransport]] -_transport_registry["grpc"] = FeedItemTargetServiceGrpcTransport - - -__all__ = ( - "FeedItemTargetServiceTransport", - "FeedItemTargetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_item_target_service/transports/base.py deleted file mode 100644 index 4fe99c05e..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_target -from google.ads.googleads.v6.services.types import feed_item_target_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedItemTargetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedItemTargetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_item_target: gapic_v1.method.wrap_method( - self.get_feed_item_target, - default_timeout=None, - client_info=client_info, - ), - self.mutate_feed_item_targets: gapic_v1.method.wrap_method( - self.mutate_feed_item_targets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_item_target( - self, - ) -> typing.Callable[ - [feed_item_target_service.GetFeedItemTargetRequest], - feed_item_target.FeedItemTarget, - ]: - raise NotImplementedError - - @property - def mutate_feed_item_targets( - self, - ) -> typing.Callable[ - [feed_item_target_service.MutateFeedItemTargetsRequest], - feed_item_target_service.MutateFeedItemTargetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("FeedItemTargetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_item_target_service/transports/grpc.py deleted file mode 100644 index e3ec3e7cb..000000000 --- a/google/ads/googleads/v6/services/services/feed_item_target_service/transports/grpc.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_item_target -from google.ads.googleads.v6.services.types import feed_item_target_service - -from .base import FeedItemTargetServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedItemTargetServiceGrpcTransport(FeedItemTargetServiceTransport): - """gRPC backend transport for FeedItemTargetService. - - Service to manage feed item targets. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_item_target( - self, - ) -> Callable[ - [feed_item_target_service.GetFeedItemTargetRequest], - feed_item_target.FeedItemTarget, - ]: - r"""Return a callable for the get feed item target method over gRPC. - - Returns the requested feed item targets in full - detail. - - Returns: - Callable[[~.GetFeedItemTargetRequest], - ~.FeedItemTarget]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_item_target" not in self._stubs: - self._stubs["get_feed_item_target"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemTargetService/GetFeedItemTarget", - request_serializer=feed_item_target_service.GetFeedItemTargetRequest.serialize, - response_deserializer=feed_item_target.FeedItemTarget.deserialize, - ) - return self._stubs["get_feed_item_target"] - - @property - def mutate_feed_item_targets( - self, - ) -> Callable[ - [feed_item_target_service.MutateFeedItemTargetsRequest], - feed_item_target_service.MutateFeedItemTargetsResponse, - ]: - r"""Return a callable for the mutate feed item targets method over gRPC. - - Creates or removes feed item targets. Operation - statuses are returned. - - Returns: - Callable[[~.MutateFeedItemTargetsRequest], - ~.MutateFeedItemTargetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feed_item_targets" not in self._stubs: - self._stubs[ - "mutate_feed_item_targets" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedItemTargetService/MutateFeedItemTargets", - request_serializer=feed_item_target_service.MutateFeedItemTargetsRequest.serialize, - response_deserializer=feed_item_target_service.MutateFeedItemTargetsResponse.deserialize, - ) - return self._stubs["mutate_feed_item_targets"] - - -__all__ = ("FeedItemTargetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_mapping_service/__init__.py b/google/ads/googleads/v6/services/services/feed_mapping_service/__init__.py deleted file mode 100644 index 39afd4d99..000000000 --- a/google/ads/googleads/v6/services/services/feed_mapping_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedMappingServiceClient - -__all__ = ("FeedMappingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_mapping_service/client.py b/google/ads/googleads/v6/services/services/feed_mapping_service/client.py deleted file mode 100644 index feaf7317e..000000000 --- a/google/ads/googleads/v6/services/services/feed_mapping_service/client.py +++ /dev/null @@ -1,543 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_mapping -from google.ads.googleads.v6.services.types import feed_mapping_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import FeedMappingServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import FeedMappingServiceGrpcTransport - - -class FeedMappingServiceClientMeta(type): - """Metaclass for the FeedMappingService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedMappingServiceTransport]] - _transport_registry["grpc"] = FeedMappingServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedMappingServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedMappingServiceClient(metaclass=FeedMappingServiceClientMeta): - """Service to manage feed mappings.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedMappingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedMappingServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedMappingServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedMappingServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_mapping_path( - customer_id: str, feed_id: str, feed_mapping_id: str, - ) -> str: - """Return a fully-qualified feed_mapping string.""" - return "customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_mapping_id=feed_mapping_id, - ) - - @staticmethod - def parse_feed_mapping_path(path: str) -> Dict[str, str]: - """Parse a feed_mapping path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedMappings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedMappingServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed mapping service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedMappingServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedMappingServiceTransport): - # transport is a FeedMappingServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedMappingServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_mapping( - self, - request: feed_mapping_service.GetFeedMappingRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_mapping.FeedMapping: - r"""Returns the requested feed mapping in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedMappingRequest`): - The request object. Request message for - [FeedMappingService.GetFeedMapping][google.ads.googleads.v6.services.FeedMappingService.GetFeedMapping]. - resource_name (:class:`str`): - Required. The resource name of the - feed mapping to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedMapping: - A feed mapping. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_mapping_service.GetFeedMappingRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_mapping_service.GetFeedMappingRequest): - request = feed_mapping_service.GetFeedMappingRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_feed_mapping] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feed_mappings( - self, - request: feed_mapping_service.MutateFeedMappingsRequest = None, - *, - customer_id: str = None, - operations: Sequence[feed_mapping_service.FeedMappingOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_mapping_service.MutateFeedMappingsResponse: - r"""Creates or removes feed mappings. Operation statuses - are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedMappingsRequest`): - The request object. Request message for - [FeedMappingService.MutateFeedMappings][google.ads.googleads.v6.services.FeedMappingService.MutateFeedMappings]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feed mappings are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedMappingOperation]`): - Required. The list of operations to - perform on individual feed mappings. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedMappingsResponse: - Response message for a feed mapping - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_mapping_service.MutateFeedMappingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_mapping_service.MutateFeedMappingsRequest - ): - request = feed_mapping_service.MutateFeedMappingsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_feed_mappings - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedMappingServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_mapping_service/transports/__init__.py deleted file mode 100644 index e9d43c6a3..000000000 --- a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedMappingServiceTransport -from .grpc import FeedMappingServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedMappingServiceTransport]] -_transport_registry["grpc"] = FeedMappingServiceGrpcTransport - - -__all__ = ( - "FeedMappingServiceTransport", - "FeedMappingServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_mapping_service/transports/base.py deleted file mode 100644 index a0d0239a3..000000000 --- a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_mapping -from google.ads.googleads.v6.services.types import feed_mapping_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedMappingServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedMappingService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_mapping: gapic_v1.method.wrap_method( - self.get_feed_mapping, - default_timeout=None, - client_info=client_info, - ), - self.mutate_feed_mappings: gapic_v1.method.wrap_method( - self.mutate_feed_mappings, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_mapping( - self, - ) -> typing.Callable[ - [feed_mapping_service.GetFeedMappingRequest], feed_mapping.FeedMapping - ]: - raise NotImplementedError - - @property - def mutate_feed_mappings( - self, - ) -> typing.Callable[ - [feed_mapping_service.MutateFeedMappingsRequest], - feed_mapping_service.MutateFeedMappingsResponse, - ]: - raise NotImplementedError - - -__all__ = ("FeedMappingServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_mapping_service/transports/grpc.py deleted file mode 100644 index e5cb2f407..000000000 --- a/google/ads/googleads/v6/services/services/feed_mapping_service/transports/grpc.py +++ /dev/null @@ -1,273 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_mapping -from google.ads.googleads.v6.services.types import feed_mapping_service - -from .base import FeedMappingServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedMappingServiceGrpcTransport(FeedMappingServiceTransport): - """gRPC backend transport for FeedMappingService. - - Service to manage feed mappings. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_mapping( - self, - ) -> Callable[ - [feed_mapping_service.GetFeedMappingRequest], feed_mapping.FeedMapping - ]: - r"""Return a callable for the get feed mapping method over gRPC. - - Returns the requested feed mapping in full detail. - - Returns: - Callable[[~.GetFeedMappingRequest], - ~.FeedMapping]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_mapping" not in self._stubs: - self._stubs["get_feed_mapping"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedMappingService/GetFeedMapping", - request_serializer=feed_mapping_service.GetFeedMappingRequest.serialize, - response_deserializer=feed_mapping.FeedMapping.deserialize, - ) - return self._stubs["get_feed_mapping"] - - @property - def mutate_feed_mappings( - self, - ) -> Callable[ - [feed_mapping_service.MutateFeedMappingsRequest], - feed_mapping_service.MutateFeedMappingsResponse, - ]: - r"""Return a callable for the mutate feed mappings method over gRPC. - - Creates or removes feed mappings. Operation statuses - are returned. - - Returns: - Callable[[~.MutateFeedMappingsRequest], - ~.MutateFeedMappingsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feed_mappings" not in self._stubs: - self._stubs["mutate_feed_mappings"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedMappingService/MutateFeedMappings", - request_serializer=feed_mapping_service.MutateFeedMappingsRequest.serialize, - response_deserializer=feed_mapping_service.MutateFeedMappingsResponse.deserialize, - ) - return self._stubs["mutate_feed_mappings"] - - -__all__ = ("FeedMappingServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/__init__.py b/google/ads/googleads/v6/services/services/feed_placeholder_view_service/__init__.py deleted file mode 100644 index 84134823f..000000000 --- a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedPlaceholderViewServiceClient - -__all__ = ("FeedPlaceholderViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/client.py b/google/ads/googleads/v6/services/services/feed_placeholder_view_service/client.py deleted file mode 100644 index 1fea446be..000000000 --- a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/client.py +++ /dev/null @@ -1,445 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed_placeholder_view -from google.ads.googleads.v6.services.types import feed_placeholder_view_service - -from .transports.base import ( - FeedPlaceholderViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import FeedPlaceholderViewServiceGrpcTransport - - -class FeedPlaceholderViewServiceClientMeta(type): - """Metaclass for the FeedPlaceholderViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedPlaceholderViewServiceTransport]] - _transport_registry["grpc"] = FeedPlaceholderViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedPlaceholderViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedPlaceholderViewServiceClient( - metaclass=FeedPlaceholderViewServiceClientMeta -): - """Service to fetch feed placeholder views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedPlaceholderViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedPlaceholderViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedPlaceholderViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedPlaceholderViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_placeholder_view_path( - customer_id: str, placeholder_type: str, - ) -> str: - """Return a fully-qualified feed_placeholder_view string.""" - return "customers/{customer_id}/feedPlaceholderViews/{placeholder_type}".format( - customer_id=customer_id, placeholder_type=placeholder_type, - ) - - @staticmethod - def parse_feed_placeholder_view_path(path: str) -> Dict[str, str]: - """Parse a feed_placeholder_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedPlaceholderViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedPlaceholderViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed placeholder view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedPlaceholderViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedPlaceholderViewServiceTransport): - # transport is a FeedPlaceholderViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedPlaceholderViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed_placeholder_view( - self, - request: feed_placeholder_view_service.GetFeedPlaceholderViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_placeholder_view.FeedPlaceholderView: - r"""Returns the requested feed placeholder view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedPlaceholderViewRequest`): - The request object. Request message for - [FeedPlaceholderViewService.GetFeedPlaceholderView][google.ads.googleads.v6.services.FeedPlaceholderViewService.GetFeedPlaceholderView]. - resource_name (:class:`str`): - Required. The resource name of the - feed placeholder view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.FeedPlaceholderView: - A feed placeholder view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_placeholder_view_service.GetFeedPlaceholderViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, feed_placeholder_view_service.GetFeedPlaceholderViewRequest - ): - request = feed_placeholder_view_service.GetFeedPlaceholderViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_feed_placeholder_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedPlaceholderViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/__init__.py deleted file mode 100644 index 8359d336a..000000000 --- a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedPlaceholderViewServiceTransport -from .grpc import FeedPlaceholderViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedPlaceholderViewServiceTransport]] -_transport_registry["grpc"] = FeedPlaceholderViewServiceGrpcTransport - - -__all__ = ( - "FeedPlaceholderViewServiceTransport", - "FeedPlaceholderViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/base.py deleted file mode 100644 index cb21dfe8e..000000000 --- a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed_placeholder_view -from google.ads.googleads.v6.services.types import feed_placeholder_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedPlaceholderViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedPlaceholderViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed_placeholder_view: gapic_v1.method.wrap_method( - self.get_feed_placeholder_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed_placeholder_view( - self, - ) -> typing.Callable[ - [feed_placeholder_view_service.GetFeedPlaceholderViewRequest], - feed_placeholder_view.FeedPlaceholderView, - ]: - raise NotImplementedError - - -__all__ = ("FeedPlaceholderViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/grpc.py deleted file mode 100644 index 752d1559a..000000000 --- a/google/ads/googleads/v6/services/services/feed_placeholder_view_service/transports/grpc.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed_placeholder_view -from google.ads.googleads.v6.services.types import feed_placeholder_view_service - -from .base import FeedPlaceholderViewServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedPlaceholderViewServiceGrpcTransport( - FeedPlaceholderViewServiceTransport -): - """gRPC backend transport for FeedPlaceholderViewService. - - Service to fetch feed placeholder views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed_placeholder_view( - self, - ) -> Callable[ - [feed_placeholder_view_service.GetFeedPlaceholderViewRequest], - feed_placeholder_view.FeedPlaceholderView, - ]: - r"""Return a callable for the get feed placeholder view method over gRPC. - - Returns the requested feed placeholder view in full - detail. - - Returns: - Callable[[~.GetFeedPlaceholderViewRequest], - ~.FeedPlaceholderView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed_placeholder_view" not in self._stubs: - self._stubs[ - "get_feed_placeholder_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedPlaceholderViewService/GetFeedPlaceholderView", - request_serializer=feed_placeholder_view_service.GetFeedPlaceholderViewRequest.serialize, - response_deserializer=feed_placeholder_view.FeedPlaceholderView.deserialize, - ) - return self._stubs["get_feed_placeholder_view"] - - -__all__ = ("FeedPlaceholderViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_service/__init__.py b/google/ads/googleads/v6/services/services/feed_service/__init__.py deleted file mode 100644 index 89369debf..000000000 --- a/google/ads/googleads/v6/services/services/feed_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import FeedServiceClient - -__all__ = ("FeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_service/client.py b/google/ads/googleads/v6/services/services/feed_service/client.py deleted file mode 100644 index fc8fdc0b6..000000000 --- a/google/ads/googleads/v6/services/services/feed_service/client.py +++ /dev/null @@ -1,517 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import feed -from google.ads.googleads.v6.services.types import feed_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import FeedServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import FeedServiceGrpcTransport - - -class FeedServiceClientMeta(type): - """Metaclass for the FeedService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[FeedServiceTransport]] - _transport_registry["grpc"] = FeedServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[FeedServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class FeedServiceClient(metaclass=FeedServiceClientMeta): - """Service to manage feeds.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - FeedServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> FeedServiceTransport: - """Return the transport used by the client instance. - - Returns: - FeedServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, FeedServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the feed service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.FeedServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, FeedServiceTransport): - # transport is a FeedServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = FeedServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_feed( - self, - request: feed_service.GetFeedRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed.Feed: - r"""Returns the requested feed in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetFeedRequest`): - The request object. Request message for - [FeedService.GetFeed][google.ads.googleads.v6.services.FeedService.GetFeed]. - resource_name (:class:`str`): - Required. The resource name of the - feed to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Feed: - A feed. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_service.GetFeedRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_service.GetFeedRequest): - request = feed_service.GetFeedRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_feed] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_feeds( - self, - request: feed_service.MutateFeedsRequest = None, - *, - customer_id: str = None, - operations: Sequence[feed_service.FeedOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> feed_service.MutateFeedsResponse: - r"""Creates, updates, or removes feeds. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateFeedsRequest`): - The request object. Request message for - [FeedService.MutateFeeds][google.ads.googleads.v6.services.FeedService.MutateFeeds]. - customer_id (:class:`str`): - Required. The ID of the customer - whose feeds are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.FeedOperation]`): - Required. The list of operations to - perform on individual feeds. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateFeedsResponse: - Response message for an feed mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a feed_service.MutateFeedsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, feed_service.MutateFeedsRequest): - request = feed_service.MutateFeedsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_feeds] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("FeedServiceClient",) diff --git a/google/ads/googleads/v6/services/services/feed_service/transports/__init__.py b/google/ads/googleads/v6/services/services/feed_service/transports/__init__.py deleted file mode 100644 index bae7affcd..000000000 --- a/google/ads/googleads/v6/services/services/feed_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import FeedServiceTransport -from .grpc import FeedServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[FeedServiceTransport]] -_transport_registry["grpc"] = FeedServiceGrpcTransport - - -__all__ = ( - "FeedServiceTransport", - "FeedServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/feed_service/transports/base.py b/google/ads/googleads/v6/services/services/feed_service/transports/base.py deleted file mode 100644 index b3abbb316..000000000 --- a/google/ads/googleads/v6/services/services/feed_service/transports/base.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import feed -from google.ads.googleads.v6.services.types import feed_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class FeedServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for FeedService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_feed: gapic_v1.method.wrap_method( - self.get_feed, default_timeout=None, client_info=client_info, - ), - self.mutate_feeds: gapic_v1.method.wrap_method( - self.mutate_feeds, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_feed( - self, - ) -> typing.Callable[[feed_service.GetFeedRequest], feed.Feed]: - raise NotImplementedError - - @property - def mutate_feeds( - self, - ) -> typing.Callable[ - [feed_service.MutateFeedsRequest], feed_service.MutateFeedsResponse - ]: - raise NotImplementedError - - -__all__ = ("FeedServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/feed_service/transports/grpc.py b/google/ads/googleads/v6/services/services/feed_service/transports/grpc.py deleted file mode 100644 index c0a55ed3c..000000000 --- a/google/ads/googleads/v6/services/services/feed_service/transports/grpc.py +++ /dev/null @@ -1,268 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import feed -from google.ads.googleads.v6.services.types import feed_service - -from .base import FeedServiceTransport, DEFAULT_CLIENT_INFO - - -class FeedServiceGrpcTransport(FeedServiceTransport): - """gRPC backend transport for FeedService. - - Service to manage feeds. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_feed(self) -> Callable[[feed_service.GetFeedRequest], feed.Feed]: - r"""Return a callable for the get feed method over gRPC. - - Returns the requested feed in full detail. - - Returns: - Callable[[~.GetFeedRequest], - ~.Feed]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_feed" not in self._stubs: - self._stubs["get_feed"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedService/GetFeed", - request_serializer=feed_service.GetFeedRequest.serialize, - response_deserializer=feed.Feed.deserialize, - ) - return self._stubs["get_feed"] - - @property - def mutate_feeds( - self, - ) -> Callable[ - [feed_service.MutateFeedsRequest], feed_service.MutateFeedsResponse - ]: - r"""Return a callable for the mutate feeds method over gRPC. - - Creates, updates, or removes feeds. Operation - statuses are returned. - - Returns: - Callable[[~.MutateFeedsRequest], - ~.MutateFeedsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_feeds" not in self._stubs: - self._stubs["mutate_feeds"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.FeedService/MutateFeeds", - request_serializer=feed_service.MutateFeedsRequest.serialize, - response_deserializer=feed_service.MutateFeedsResponse.deserialize, - ) - return self._stubs["mutate_feeds"] - - -__all__ = ("FeedServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/gender_view_service/__init__.py b/google/ads/googleads/v6/services/services/gender_view_service/__init__.py deleted file mode 100644 index 19eda92ee..000000000 --- a/google/ads/googleads/v6/services/services/gender_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GenderViewServiceClient - -__all__ = ("GenderViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/gender_view_service/client.py b/google/ads/googleads/v6/services/services/gender_view_service/client.py deleted file mode 100644 index ff06dac20..000000000 --- a/google/ads/googleads/v6/services/services/gender_view_service/client.py +++ /dev/null @@ -1,435 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import gender_view -from google.ads.googleads.v6.services.types import gender_view_service - -from .transports.base import GenderViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import GenderViewServiceGrpcTransport - - -class GenderViewServiceClientMeta(type): - """Metaclass for the GenderViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GenderViewServiceTransport]] - _transport_registry["grpc"] = GenderViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GenderViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GenderViewServiceClient(metaclass=GenderViewServiceClientMeta): - """Service to manage gender views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GenderViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GenderViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GenderViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - GenderViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def gender_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified gender_view string.""" - return "customers/{customer_id}/genderViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_gender_view_path(path: str) -> Dict[str, str]: - """Parse a gender_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/genderViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GenderViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the gender view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GenderViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GenderViewServiceTransport): - # transport is a GenderViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GenderViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_gender_view( - self, - request: gender_view_service.GetGenderViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> gender_view.GenderView: - r"""Returns the requested gender view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetGenderViewRequest`): - The request object. Request message for - [GenderViewService.GetGenderView][google.ads.googleads.v6.services.GenderViewService.GetGenderView]. - resource_name (:class:`str`): - Required. The resource name of the - gender view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.GenderView: - A gender view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a gender_view_service.GetGenderViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, gender_view_service.GetGenderViewRequest): - request = gender_view_service.GetGenderViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_gender_view] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GenderViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/gender_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/gender_view_service/transports/__init__.py deleted file mode 100644 index 97af25ac8..000000000 --- a/google/ads/googleads/v6/services/services/gender_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GenderViewServiceTransport -from .grpc import GenderViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GenderViewServiceTransport]] -_transport_registry["grpc"] = GenderViewServiceGrpcTransport - - -__all__ = ( - "GenderViewServiceTransport", - "GenderViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/gender_view_service/transports/base.py b/google/ads/googleads/v6/services/services/gender_view_service/transports/base.py deleted file mode 100644 index c2715ba06..000000000 --- a/google/ads/googleads/v6/services/services/gender_view_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import gender_view -from google.ads.googleads.v6.services.types import gender_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GenderViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GenderViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_gender_view: gapic_v1.method.wrap_method( - self.get_gender_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_gender_view( - self, - ) -> typing.Callable[ - [gender_view_service.GetGenderViewRequest], gender_view.GenderView - ]: - raise NotImplementedError - - -__all__ = ("GenderViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/gender_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/gender_view_service/transports/grpc.py deleted file mode 100644 index 9f134f71c..000000000 --- a/google/ads/googleads/v6/services/services/gender_view_service/transports/grpc.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import gender_view -from google.ads.googleads.v6.services.types import gender_view_service - -from .base import GenderViewServiceTransport, DEFAULT_CLIENT_INFO - - -class GenderViewServiceGrpcTransport(GenderViewServiceTransport): - """gRPC backend transport for GenderViewService. - - Service to manage gender views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_gender_view( - self, - ) -> Callable[ - [gender_view_service.GetGenderViewRequest], gender_view.GenderView - ]: - r"""Return a callable for the get gender view method over gRPC. - - Returns the requested gender view in full detail. - - Returns: - Callable[[~.GetGenderViewRequest], - ~.GenderView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_gender_view" not in self._stubs: - self._stubs["get_gender_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GenderViewService/GetGenderView", - request_serializer=gender_view_service.GetGenderViewRequest.serialize, - response_deserializer=gender_view.GenderView.deserialize, - ) - return self._stubs["get_gender_view"] - - -__all__ = ("GenderViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/geo_target_constant_service/__init__.py b/google/ads/googleads/v6/services/services/geo_target_constant_service/__init__.py deleted file mode 100644 index 773f52ae9..000000000 --- a/google/ads/googleads/v6/services/services/geo_target_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GeoTargetConstantServiceClient - -__all__ = ("GeoTargetConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/geo_target_constant_service/client.py b/google/ads/googleads/v6/services/services/geo_target_constant_service/client.py deleted file mode 100644 index 26d023270..000000000 --- a/google/ads/googleads/v6/services/services/geo_target_constant_service/client.py +++ /dev/null @@ -1,496 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import geo_target_constant -from google.ads.googleads.v6.services.types import geo_target_constant_service - -from .transports.base import ( - GeoTargetConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import GeoTargetConstantServiceGrpcTransport - - -class GeoTargetConstantServiceClientMeta(type): - """Metaclass for the GeoTargetConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GeoTargetConstantServiceTransport]] - _transport_registry["grpc"] = GeoTargetConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GeoTargetConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GeoTargetConstantServiceClient( - metaclass=GeoTargetConstantServiceClientMeta -): - """Service to fetch geo target constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GeoTargetConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GeoTargetConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GeoTargetConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - GeoTargetConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GeoTargetConstantServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the geo target constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GeoTargetConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GeoTargetConstantServiceTransport): - # transport is a GeoTargetConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GeoTargetConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_geo_target_constant( - self, - request: geo_target_constant_service.GetGeoTargetConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> geo_target_constant.GeoTargetConstant: - r"""Returns the requested geo target constant in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetGeoTargetConstantRequest`): - The request object. Request message for - [GeoTargetConstantService.GetGeoTargetConstant][google.ads.googleads.v6.services.GeoTargetConstantService.GetGeoTargetConstant]. - resource_name (:class:`str`): - Required. The resource name of the - geo target constant to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.GeoTargetConstant: - A geo target constant. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a geo_target_constant_service.GetGeoTargetConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, geo_target_constant_service.GetGeoTargetConstantRequest - ): - request = geo_target_constant_service.GetGeoTargetConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_geo_target_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def suggest_geo_target_constants( - self, - request: geo_target_constant_service.SuggestGeoTargetConstantsRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> geo_target_constant_service.SuggestGeoTargetConstantsResponse: - r"""Returns GeoTargetConstant suggestions by location - name or by resource name. - - Args: - request (:class:`google.ads.googleads.v6.services.types.SuggestGeoTargetConstantsRequest`): - The request object. Request message for - [GeoTargetConstantService.SuggestGeoTargetConstants][google.ads.googleads.v6.services.GeoTargetConstantService.SuggestGeoTargetConstants]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.SuggestGeoTargetConstantsResponse: - Response message for - [GeoTargetConstantService.SuggestGeoTargetConstants][google.ads.googleads.v6.services.GeoTargetConstantService.SuggestGeoTargetConstants]. - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a geo_target_constant_service.SuggestGeoTargetConstantsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - geo_target_constant_service.SuggestGeoTargetConstantsRequest, - ): - request = geo_target_constant_service.SuggestGeoTargetConstantsRequest( - request - ) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.suggest_geo_target_constants - ] - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GeoTargetConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/__init__.py deleted file mode 100644 index e9d0d6259..000000000 --- a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GeoTargetConstantServiceTransport -from .grpc import GeoTargetConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GeoTargetConstantServiceTransport]] -_transport_registry["grpc"] = GeoTargetConstantServiceGrpcTransport - - -__all__ = ( - "GeoTargetConstantServiceTransport", - "GeoTargetConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/base.py deleted file mode 100644 index 9074e1876..000000000 --- a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import geo_target_constant -from google.ads.googleads.v6.services.types import geo_target_constant_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GeoTargetConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GeoTargetConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_geo_target_constant: gapic_v1.method.wrap_method( - self.get_geo_target_constant, - default_timeout=None, - client_info=client_info, - ), - self.suggest_geo_target_constants: gapic_v1.method.wrap_method( - self.suggest_geo_target_constants, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_geo_target_constant( - self, - ) -> typing.Callable[ - [geo_target_constant_service.GetGeoTargetConstantRequest], - geo_target_constant.GeoTargetConstant, - ]: - raise NotImplementedError - - @property - def suggest_geo_target_constants( - self, - ) -> typing.Callable[ - [geo_target_constant_service.SuggestGeoTargetConstantsRequest], - geo_target_constant_service.SuggestGeoTargetConstantsResponse, - ]: - raise NotImplementedError - - -__all__ = ("GeoTargetConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/grpc.py deleted file mode 100644 index 3d43c3906..000000000 --- a/google/ads/googleads/v6/services/services/geo_target_constant_service/transports/grpc.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import geo_target_constant -from google.ads.googleads.v6.services.types import geo_target_constant_service - -from .base import GeoTargetConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class GeoTargetConstantServiceGrpcTransport(GeoTargetConstantServiceTransport): - """gRPC backend transport for GeoTargetConstantService. - - Service to fetch geo target constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_geo_target_constant( - self, - ) -> Callable[ - [geo_target_constant_service.GetGeoTargetConstantRequest], - geo_target_constant.GeoTargetConstant, - ]: - r"""Return a callable for the get geo target constant method over gRPC. - - Returns the requested geo target constant in full - detail. - - Returns: - Callable[[~.GetGeoTargetConstantRequest], - ~.GeoTargetConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_geo_target_constant" not in self._stubs: - self._stubs[ - "get_geo_target_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GeoTargetConstantService/GetGeoTargetConstant", - request_serializer=geo_target_constant_service.GetGeoTargetConstantRequest.serialize, - response_deserializer=geo_target_constant.GeoTargetConstant.deserialize, - ) - return self._stubs["get_geo_target_constant"] - - @property - def suggest_geo_target_constants( - self, - ) -> Callable[ - [geo_target_constant_service.SuggestGeoTargetConstantsRequest], - geo_target_constant_service.SuggestGeoTargetConstantsResponse, - ]: - r"""Return a callable for the suggest geo target constants method over gRPC. - - Returns GeoTargetConstant suggestions by location - name or by resource name. - - Returns: - Callable[[~.SuggestGeoTargetConstantsRequest], - ~.SuggestGeoTargetConstantsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "suggest_geo_target_constants" not in self._stubs: - self._stubs[ - "suggest_geo_target_constants" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GeoTargetConstantService/SuggestGeoTargetConstants", - request_serializer=geo_target_constant_service.SuggestGeoTargetConstantsRequest.serialize, - response_deserializer=geo_target_constant_service.SuggestGeoTargetConstantsResponse.deserialize, - ) - return self._stubs["suggest_geo_target_constants"] - - -__all__ = ("GeoTargetConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/geographic_view_service/__init__.py b/google/ads/googleads/v6/services/services/geographic_view_service/__init__.py deleted file mode 100644 index ae3d6fa27..000000000 --- a/google/ads/googleads/v6/services/services/geographic_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GeographicViewServiceClient - -__all__ = ("GeographicViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/geographic_view_service/client.py b/google/ads/googleads/v6/services/services/geographic_view_service/client.py deleted file mode 100644 index 374e31a31..000000000 --- a/google/ads/googleads/v6/services/services/geographic_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import geographic_view -from google.ads.googleads.v6.services.types import geographic_view_service - -from .transports.base import GeographicViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import GeographicViewServiceGrpcTransport - - -class GeographicViewServiceClientMeta(type): - """Metaclass for the GeographicViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GeographicViewServiceTransport]] - _transport_registry["grpc"] = GeographicViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GeographicViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GeographicViewServiceClient(metaclass=GeographicViewServiceClientMeta): - """Service to manage geographic views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GeographicViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GeographicViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GeographicViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - GeographicViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def geographic_view_path( - customer_id: str, country_criterion_id: str, location_type: str, - ) -> str: - """Return a fully-qualified geographic_view string.""" - return "customers/{customer_id}/geographicViews/{country_criterion_id}~{location_type}".format( - customer_id=customer_id, - country_criterion_id=country_criterion_id, - location_type=location_type, - ) - - @staticmethod - def parse_geographic_view_path(path: str) -> Dict[str, str]: - """Parse a geographic_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/geographicViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GeographicViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the geographic view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GeographicViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GeographicViewServiceTransport): - # transport is a GeographicViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GeographicViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_geographic_view( - self, - request: geographic_view_service.GetGeographicViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> geographic_view.GeographicView: - r"""Returns the requested geographic view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetGeographicViewRequest`): - The request object. Request message for - [GeographicViewService.GetGeographicView][google.ads.googleads.v6.services.GeographicViewService.GetGeographicView]. - resource_name (:class:`str`): - Required. The resource name of the - geographic view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.GeographicView: - A geographic view. - Geographic View includes all metrics - aggregated at the country level, one row - per country. It reports metrics at - either actual physical location of the - user or an area of interest. If other - segment fields are used, you may get - more than one row per country. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a geographic_view_service.GetGeographicViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, geographic_view_service.GetGeographicViewRequest - ): - request = geographic_view_service.GetGeographicViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_geographic_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GeographicViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/geographic_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/geographic_view_service/transports/__init__.py deleted file mode 100644 index 110b45f38..000000000 --- a/google/ads/googleads/v6/services/services/geographic_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GeographicViewServiceTransport -from .grpc import GeographicViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GeographicViewServiceTransport]] -_transport_registry["grpc"] = GeographicViewServiceGrpcTransport - - -__all__ = ( - "GeographicViewServiceTransport", - "GeographicViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/geographic_view_service/transports/base.py b/google/ads/googleads/v6/services/services/geographic_view_service/transports/base.py deleted file mode 100644 index 48cd15c63..000000000 --- a/google/ads/googleads/v6/services/services/geographic_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import geographic_view -from google.ads.googleads.v6.services.types import geographic_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GeographicViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GeographicViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_geographic_view: gapic_v1.method.wrap_method( - self.get_geographic_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_geographic_view( - self, - ) -> typing.Callable[ - [geographic_view_service.GetGeographicViewRequest], - geographic_view.GeographicView, - ]: - raise NotImplementedError - - -__all__ = ("GeographicViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/geographic_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/geographic_view_service/transports/grpc.py deleted file mode 100644 index fb34f11dc..000000000 --- a/google/ads/googleads/v6/services/services/geographic_view_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import geographic_view -from google.ads.googleads.v6.services.types import geographic_view_service - -from .base import GeographicViewServiceTransport, DEFAULT_CLIENT_INFO - - -class GeographicViewServiceGrpcTransport(GeographicViewServiceTransport): - """gRPC backend transport for GeographicViewService. - - Service to manage geographic views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_geographic_view( - self, - ) -> Callable[ - [geographic_view_service.GetGeographicViewRequest], - geographic_view.GeographicView, - ]: - r"""Return a callable for the get geographic view method over gRPC. - - Returns the requested geographic view in full detail. - - Returns: - Callable[[~.GetGeographicViewRequest], - ~.GeographicView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_geographic_view" not in self._stubs: - self._stubs["get_geographic_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GeographicViewService/GetGeographicView", - request_serializer=geographic_view_service.GetGeographicViewRequest.serialize, - response_deserializer=geographic_view.GeographicView.deserialize, - ) - return self._stubs["get_geographic_view"] - - -__all__ = ("GeographicViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/__init__.py b/google/ads/googleads/v6/services/services/google_ads_field_service/__init__.py deleted file mode 100644 index d8d9e938a..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GoogleAdsFieldServiceClient - -__all__ = ("GoogleAdsFieldServiceClient",) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/client.py b/google/ads/googleads/v6/services/services/google_ads_field_service/client.py deleted file mode 100644 index 175e72e74..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/client.py +++ /dev/null @@ -1,519 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import google_ads_field -from google.ads.googleads.v6.services.services.google_ads_field_service import ( - pagers, -) -from google.ads.googleads.v6.services.types import google_ads_field_service - -from .transports.base import GoogleAdsFieldServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import GoogleAdsFieldServiceGrpcTransport - - -class GoogleAdsFieldServiceClientMeta(type): - """Metaclass for the GoogleAdsFieldService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GoogleAdsFieldServiceTransport]] - _transport_registry["grpc"] = GoogleAdsFieldServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GoogleAdsFieldServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GoogleAdsFieldServiceClient(metaclass=GoogleAdsFieldServiceClientMeta): - """Service to fetch Google Ads API fields.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GoogleAdsFieldServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GoogleAdsFieldServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GoogleAdsFieldServiceTransport: - """Return the transport used by the client instance. - - Returns: - GoogleAdsFieldServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def google_ads_field_path(google_ads_field: str,) -> str: - """Return a fully-qualified google_ads_field string.""" - return "googleAdsFields/{google_ads_field}".format( - google_ads_field=google_ads_field, - ) - - @staticmethod - def parse_google_ads_field_path(path: str) -> Dict[str, str]: - """Parse a google_ads_field path into its component segments.""" - m = re.match(r"^googleAdsFields/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GoogleAdsFieldServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the google ads field service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GoogleAdsFieldServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GoogleAdsFieldServiceTransport): - # transport is a GoogleAdsFieldServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GoogleAdsFieldServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_google_ads_field( - self, - request: google_ads_field_service.GetGoogleAdsFieldRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> google_ads_field.GoogleAdsField: - r"""Returns just the requested field. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetGoogleAdsFieldRequest`): - The request object. Request message for - [GoogleAdsFieldService.GetGoogleAdsField][google.ads.googleads.v6.services.GoogleAdsFieldService.GetGoogleAdsField]. - resource_name (:class:`str`): - Required. The resource name of the - field to get. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.GoogleAdsField: - A field or resource (artifact) used - by GoogleAdsService. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a google_ads_field_service.GetGoogleAdsFieldRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, google_ads_field_service.GetGoogleAdsFieldRequest - ): - request = google_ads_field_service.GetGoogleAdsFieldRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_google_ads_field - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def search_google_ads_fields( - self, - request: google_ads_field_service.SearchGoogleAdsFieldsRequest = None, - *, - query: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.SearchGoogleAdsFieldsPager: - r"""Returns all fields that match the search query. - - Args: - request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsRequest`): - The request object. Request message for - [GoogleAdsFieldService.SearchGoogleAdsFields][google.ads.googleads.v6.services.GoogleAdsFieldService.SearchGoogleAdsFields]. - query (:class:`str`): - Required. The query string. - This corresponds to the ``query`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.google_ads_field_service.pagers.SearchGoogleAdsFieldsPager: - Response message for - [GoogleAdsFieldService.SearchGoogleAdsFields][google.ads.googleads.v6.services.GoogleAdsFieldService.SearchGoogleAdsFields]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([query]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a google_ads_field_service.SearchGoogleAdsFieldsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, google_ads_field_service.SearchGoogleAdsFieldsRequest - ): - request = google_ads_field_service.SearchGoogleAdsFieldsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if query is not None: - request.query = query - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.search_google_ads_fields - ] - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.SearchGoogleAdsFieldsPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GoogleAdsFieldServiceClient",) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/pagers.py b/google/ads/googleads/v6/services/services/google_ads_field_service/pagers.py deleted file mode 100644 index f701dacd6..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/pagers.py +++ /dev/null @@ -1,90 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.resources.types import google_ads_field -from google.ads.googleads.v6.services.types import google_ads_field_service - - -class SearchGoogleAdsFieldsPager: - """A pager for iterating through ``search_google_ads_fields`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``results`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``SearchGoogleAdsFields`` requests and continue to iterate - through the ``results`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[ - ..., google_ads_field_service.SearchGoogleAdsFieldsResponse - ], - request: google_ads_field_service.SearchGoogleAdsFieldsRequest, - response: google_ads_field_service.SearchGoogleAdsFieldsResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsFieldsResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = google_ads_field_service.SearchGoogleAdsFieldsRequest( - request - ) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages( - self, - ) -> Iterable[google_ads_field_service.SearchGoogleAdsFieldsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__(self) -> Iterable[google_ads_field.GoogleAdsField]: - for page in self.pages: - yield from page.results - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/__init__.py b/google/ads/googleads/v6/services/services/google_ads_field_service/transports/__init__.py deleted file mode 100644 index 480fc9f48..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GoogleAdsFieldServiceTransport -from .grpc import GoogleAdsFieldServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GoogleAdsFieldServiceTransport]] -_transport_registry["grpc"] = GoogleAdsFieldServiceGrpcTransport - - -__all__ = ( - "GoogleAdsFieldServiceTransport", - "GoogleAdsFieldServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/base.py b/google/ads/googleads/v6/services/services/google_ads_field_service/transports/base.py deleted file mode 100644 index 68c47b208..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import google_ads_field -from google.ads.googleads.v6.services.types import google_ads_field_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GoogleAdsFieldServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GoogleAdsFieldService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_google_ads_field: gapic_v1.method.wrap_method( - self.get_google_ads_field, - default_timeout=None, - client_info=client_info, - ), - self.search_google_ads_fields: gapic_v1.method.wrap_method( - self.search_google_ads_fields, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_google_ads_field( - self, - ) -> typing.Callable[ - [google_ads_field_service.GetGoogleAdsFieldRequest], - google_ads_field.GoogleAdsField, - ]: - raise NotImplementedError - - @property - def search_google_ads_fields( - self, - ) -> typing.Callable[ - [google_ads_field_service.SearchGoogleAdsFieldsRequest], - google_ads_field_service.SearchGoogleAdsFieldsResponse, - ]: - raise NotImplementedError - - -__all__ = ("GoogleAdsFieldServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/grpc.py b/google/ads/googleads/v6/services/services/google_ads_field_service/transports/grpc.py deleted file mode 100644 index 409f15acc..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_field_service/transports/grpc.py +++ /dev/null @@ -1,275 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import google_ads_field -from google.ads.googleads.v6.services.types import google_ads_field_service - -from .base import GoogleAdsFieldServiceTransport, DEFAULT_CLIENT_INFO - - -class GoogleAdsFieldServiceGrpcTransport(GoogleAdsFieldServiceTransport): - """gRPC backend transport for GoogleAdsFieldService. - - Service to fetch Google Ads API fields. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_google_ads_field( - self, - ) -> Callable[ - [google_ads_field_service.GetGoogleAdsFieldRequest], - google_ads_field.GoogleAdsField, - ]: - r"""Return a callable for the get google ads field method over gRPC. - - Returns just the requested field. - - Returns: - Callable[[~.GetGoogleAdsFieldRequest], - ~.GoogleAdsField]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_google_ads_field" not in self._stubs: - self._stubs["get_google_ads_field"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GoogleAdsFieldService/GetGoogleAdsField", - request_serializer=google_ads_field_service.GetGoogleAdsFieldRequest.serialize, - response_deserializer=google_ads_field.GoogleAdsField.deserialize, - ) - return self._stubs["get_google_ads_field"] - - @property - def search_google_ads_fields( - self, - ) -> Callable[ - [google_ads_field_service.SearchGoogleAdsFieldsRequest], - google_ads_field_service.SearchGoogleAdsFieldsResponse, - ]: - r"""Return a callable for the search google ads fields method over gRPC. - - Returns all fields that match the search query. - - Returns: - Callable[[~.SearchGoogleAdsFieldsRequest], - ~.SearchGoogleAdsFieldsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "search_google_ads_fields" not in self._stubs: - self._stubs[ - "search_google_ads_fields" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GoogleAdsFieldService/SearchGoogleAdsFields", - request_serializer=google_ads_field_service.SearchGoogleAdsFieldsRequest.serialize, - response_deserializer=google_ads_field_service.SearchGoogleAdsFieldsResponse.deserialize, - ) - return self._stubs["search_google_ads_fields"] - - -__all__ = ("GoogleAdsFieldServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/__init__.py b/google/ads/googleads/v6/services/services/google_ads_service/__init__.py deleted file mode 100644 index 9d229c1de..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GoogleAdsServiceClient - -__all__ = ("GoogleAdsServiceClient",) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/client.py b/google/ads/googleads/v6/services/services/google_ads_service/client.py deleted file mode 100644 index a5be56875..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/client.py +++ /dev/null @@ -1,2753 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Iterable, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.services.google_ads_service import pagers -from google.ads.googleads.v6.services.types import google_ads_service -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import GoogleAdsServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import GoogleAdsServiceGrpcTransport - - -class GoogleAdsServiceClientMeta(type): - """Metaclass for the GoogleAdsService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GoogleAdsServiceTransport]] - _transport_registry["grpc"] = GoogleAdsServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GoogleAdsServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GoogleAdsServiceClient(metaclass=GoogleAdsServiceClientMeta): - """Service to fetch data and metrics across resources.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GoogleAdsServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GoogleAdsServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GoogleAdsServiceTransport: - """Return the transport used by the client instance. - - Returns: - GoogleAdsServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def account_budget_path(customer_id: str, account_budget_id: str,) -> str: - """Return a fully-qualified account_budget string.""" - return "customers/{customer_id}/accountBudgets/{account_budget_id}".format( - customer_id=customer_id, account_budget_id=account_budget_id, - ) - - @staticmethod - def parse_account_budget_path(path: str) -> Dict[str, str]: - """Parse a account_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def account_budget_proposal_path( - customer_id: str, account_budget_proposal_id: str, - ) -> str: - """Return a fully-qualified account_budget_proposal string.""" - return "customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}".format( - customer_id=customer_id, - account_budget_proposal_id=account_budget_proposal_id, - ) - - @staticmethod - def parse_account_budget_proposal_path(path: str) -> Dict[str, str]: - """Parse a account_budget_proposal path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountBudgetProposals/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def account_link_path(customer_id: str, account_link_id: str,) -> str: - """Return a fully-qualified account_link string.""" - return "customers/{customer_id}/accountLinks/{account_link_id}".format( - customer_id=customer_id, account_link_id=account_link_id, - ) - - @staticmethod - def parse_account_link_path(path: str) -> Dict[str, str]: - """Parse a account_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/accountLinks/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_path(customer_id: str, ad_id: str,) -> str: - """Return a fully-qualified ad string.""" - return "customers/{customer_id}/ads/{ad_id}".format( - customer_id=customer_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_path(path: str) -> Dict[str, str]: - """Parse a ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ads/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_path( - customer_id: str, ad_group_id: str, ad_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad string.""" - return "customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_group_ad_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_asset_view_path( - customer_id: str, - ad_group_id: str, - ad_id: str, - asset_id: str, - field_type: str, - ) -> str: - """Return a fully-qualified ad_group_ad_asset_view string.""" - return "customers/{customer_id}/adGroupAdAssetViews/{ad_group_id}~{ad_id}~{asset_id}~{field_type}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - ad_id=ad_id, - asset_id=asset_id, - field_type=field_type, - ) - - @staticmethod - def parse_ad_group_ad_asset_view_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad_asset_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAdAssetViews/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_ad_label_path( - customer_id: str, ad_group_id: str, ad_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_ad_label string.""" - return "customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - ad_id=ad_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_ad_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_ad_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAdLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_audience_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_audience_view string.""" - return "customers/{customer_id}/adGroupAudienceViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_audience_view_path(path: str) -> Dict[str, str]: - """Parse a ad_group_audience_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupAudienceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_bid_modifier_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_bid_modifier string.""" - return "customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a ad_group_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion string.""" - return "customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_group_criterion_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_label_path( - customer_id: str, ad_group_id: str, criterion_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_criterion_label string.""" - return "customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - label_id=label_id, - ) - - @staticmethod - def parse_ad_group_criterion_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriterionLabels/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_criterion_simulation_path( - customer_id: str, - ad_group_id: str, - criterion_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified ad_group_criterion_simulation string.""" - return "customers/{customer_id}/adGroupCriterionSimulations/{ad_group_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_ad_group_criterion_simulation_path(path: str) -> Dict[str, str]: - """Parse a ad_group_criterion_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupCriterionSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_extension_setting_path( - customer_id: str, ad_group_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified ad_group_extension_setting string.""" - return "customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - extension_type=extension_type, - ) - - @staticmethod - def parse_ad_group_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a ad_group_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupExtensionSettings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_feed_path( - customer_id: str, ad_group_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified ad_group_feed string.""" - return "customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, feed_id=feed_id, - ) - - @staticmethod - def parse_ad_group_feed_path(path: str) -> Dict[str, str]: - """Parse a ad_group_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_label_path( - customer_id: str, ad_group_id: str, label_id: str, - ) -> str: - """Return a fully-qualified ad_group_label string.""" - return "customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, label_id=label_id, - ) - - @staticmethod - def parse_ad_group_label_path(path: str) -> Dict[str, str]: - """Parse a ad_group_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_simulation_path( - customer_id: str, - ad_group_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified ad_group_simulation string.""" - return "customers/{customer_id}/adGroupSimulations/{ad_group_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_ad_group_simulation_path(path: str) -> Dict[str, str]: - """Parse a ad_group_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroupSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_parameter_path( - customer_id: str, - ad_group_id: str, - criterion_id: str, - parameter_index: str, - ) -> str: - """Return a fully-qualified ad_parameter string.""" - return "customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - parameter_index=parameter_index, - ) - - @staticmethod - def parse_ad_parameter_path(path: str) -> Dict[str, str]: - """Parse a ad_parameter path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adParameters/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_schedule_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified ad_schedule_view string.""" - return "customers/{customer_id}/adScheduleViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_ad_schedule_view_path(path: str) -> Dict[str, str]: - """Parse a ad_schedule_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adScheduleViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def age_range_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified age_range_view string.""" - return "customers/{customer_id}/ageRangeViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_age_range_view_path(path: str) -> Dict[str, str]: - """Parse a age_range_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ageRangeViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def asset_path(customer_id: str, asset_id: str,) -> str: - """Return a fully-qualified asset string.""" - return "customers/{customer_id}/assets/{asset_id}".format( - customer_id=customer_id, asset_id=asset_id, - ) - - @staticmethod - def parse_asset_path(path: str) -> Dict[str, str]: - """Parse a asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/assets/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def batch_job_path(customer_id: str, batch_job_id: str,) -> str: - """Return a fully-qualified batch_job string.""" - return "customers/{customer_id}/batchJobs/{batch_job_id}".format( - customer_id=customer_id, batch_job_id=batch_job_id, - ) - - @staticmethod - def parse_batch_job_path(path: str) -> Dict[str, str]: - """Parse a batch_job path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/batchJobs/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def bidding_strategy_path( - customer_id: str, bidding_strategy_id: str, - ) -> str: - """Return a fully-qualified bidding_strategy string.""" - return "customers/{customer_id}/biddingStrategies/{bidding_strategy_id}".format( - customer_id=customer_id, bidding_strategy_id=bidding_strategy_id, - ) - - @staticmethod - def parse_bidding_strategy_path(path: str) -> Dict[str, str]: - """Parse a bidding_strategy path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/biddingStrategies/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def billing_setup_path(customer_id: str, billing_setup_id: str,) -> str: - """Return a fully-qualified billing_setup string.""" - return "customers/{customer_id}/billingSetups/{billing_setup_id}".format( - customer_id=customer_id, billing_setup_id=billing_setup_id, - ) - - @staticmethod - def parse_billing_setup_path(path: str) -> Dict[str, str]: - """Parse a billing_setup path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/billingSetups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def call_view_path(customer_id: str, call_detail_id: str,) -> str: - """Return a fully-qualified call_view string.""" - return "customers/{customer_id}/callViews/{call_detail_id}".format( - customer_id=customer_id, call_detail_id=call_detail_id, - ) - - @staticmethod - def parse_call_view_path(path: str) -> Dict[str, str]: - """Parse a call_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/callViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_asset_path( - customer_id: str, campaign_id: str, asset_id: str, field_type: str, - ) -> str: - """Return a fully-qualified campaign_asset string.""" - return "customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}".format( - customer_id=customer_id, - campaign_id=campaign_id, - asset_id=asset_id, - field_type=field_type, - ) - - @staticmethod - def parse_campaign_asset_path(path: str) -> Dict[str, str]: - """Parse a campaign_asset path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignAssets/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_audience_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_audience_view string.""" - return "customers/{customer_id}/campaignAudienceViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_audience_view_path(path: str) -> Dict[str, str]: - """Parse a campaign_audience_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignAudienceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_bid_modifier_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_bid_modifier string.""" - return "customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a campaign_bid_modifier path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBidModifiers/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_budget_path(customer_id: str, campaign_budget_id: str,) -> str: - """Return a fully-qualified campaign_budget string.""" - return "customers/{customer_id}/campaignBudgets/{campaign_budget_id}".format( - customer_id=customer_id, campaign_budget_id=campaign_budget_id, - ) - - @staticmethod - def parse_campaign_budget_path(path: str) -> Dict[str, str]: - """Parse a campaign_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_criterion_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_criterion string.""" - return "customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_campaign_criterion_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_criterion_simulation_path( - customer_id: str, - campaign_id: str, - criterion_id: str, - type: str, - modification_method: str, - start_date: str, - end_date: str, - ) -> str: - """Return a fully-qualified campaign_criterion_simulation string.""" - return "customers/{customer_id}/campaignCriterionSimulations/{campaign_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - type=type, - modification_method=modification_method, - start_date=start_date, - end_date=end_date, - ) - - @staticmethod - def parse_campaign_criterion_simulation_path(path: str) -> Dict[str, str]: - """Parse a campaign_criterion_simulation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignCriterionSimulations/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_draft_path( - customer_id: str, base_campaign_id: str, draft_id: str, - ) -> str: - """Return a fully-qualified campaign_draft string.""" - return "customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}".format( - customer_id=customer_id, - base_campaign_id=base_campaign_id, - draft_id=draft_id, - ) - - @staticmethod - def parse_campaign_draft_path(path: str) -> Dict[str, str]: - """Parse a campaign_draft path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignDrafts/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_experiment_path( - customer_id: str, campaign_experiment_id: str, - ) -> str: - """Return a fully-qualified campaign_experiment string.""" - return "customers/{customer_id}/campaignExperiments/{campaign_experiment_id}".format( - customer_id=customer_id, - campaign_experiment_id=campaign_experiment_id, - ) - - @staticmethod - def parse_campaign_experiment_path(path: str) -> Dict[str, str]: - """Parse a campaign_experiment path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignExperiments/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_extension_setting_path( - customer_id: str, campaign_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified campaign_extension_setting string.""" - return "customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}".format( - customer_id=customer_id, - campaign_id=campaign_id, - extension_type=extension_type, - ) - - @staticmethod - def parse_campaign_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a campaign_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignExtensionSettings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_feed_path( - customer_id: str, campaign_id: str, feed_id: str, - ) -> str: - """Return a fully-qualified campaign_feed string.""" - return "customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}".format( - customer_id=customer_id, campaign_id=campaign_id, feed_id=feed_id, - ) - - @staticmethod - def parse_campaign_feed_path(path: str) -> Dict[str, str]: - """Parse a campaign_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignFeeds/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_label_path( - customer_id: str, campaign_id: str, label_id: str, - ) -> str: - """Return a fully-qualified campaign_label string.""" - return "customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}".format( - customer_id=customer_id, campaign_id=campaign_id, label_id=label_id, - ) - - @staticmethod - def parse_campaign_label_path(path: str) -> Dict[str, str]: - """Parse a campaign_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignLabels/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_shared_set_path( - customer_id: str, campaign_id: str, shared_set_id: str, - ) -> str: - """Return a fully-qualified campaign_shared_set string.""" - return "customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_campaign_shared_set_path(path: str) -> Dict[str, str]: - """Parse a campaign_shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignSharedSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def carrier_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified carrier_constant string.""" - return "carrierConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_carrier_constant_path(path: str) -> Dict[str, str]: - """Parse a carrier_constant path into its component segments.""" - m = re.match(r"^carrierConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def change_event_path( - customer_id: str, - timestamp_micros: str, - command_index: str, - mutate_index: str, - ) -> str: - """Return a fully-qualified change_event string.""" - return "customers/{customer_id}/changeEvents/{timestamp_micros}~{command_index}~{mutate_index}".format( - customer_id=customer_id, - timestamp_micros=timestamp_micros, - command_index=command_index, - mutate_index=mutate_index, - ) - - @staticmethod - def parse_change_event_path(path: str) -> Dict[str, str]: - """Parse a change_event path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/changeEvents/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def change_status_path(customer_id: str, change_status_id: str,) -> str: - """Return a fully-qualified change_status string.""" - return "customers/{customer_id}/changeStatus/{change_status_id}".format( - customer_id=customer_id, change_status_id=change_status_id, - ) - - @staticmethod - def parse_change_status_path(path: str) -> Dict[str, str]: - """Parse a change_status path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/changeStatus/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def click_view_path(customer_id: str, date: str, gclid: str,) -> str: - """Return a fully-qualified click_view string.""" - return "customers/{customer_id}/clickViews/{date}~{gclid}".format( - customer_id=customer_id, date=date, gclid=gclid, - ) - - @staticmethod - def parse_click_view_path(path: str) -> Dict[str, str]: - """Parse a click_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/clickViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def combined_audience_path( - customer_id: str, combined_audience_id: str, - ) -> str: - """Return a fully-qualified combined_audience string.""" - return "customers/{customer_id}/combinedAudiences/{combined_audience_id}".format( - customer_id=customer_id, combined_audience_id=combined_audience_id, - ) - - @staticmethod - def parse_combined_audience_path(path: str) -> Dict[str, str]: - """Parse a combined_audience path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/combinedAudiences/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def conversion_action_path( - customer_id: str, conversion_action_id: str, - ) -> str: - """Return a fully-qualified conversion_action string.""" - return "customers/{customer_id}/conversionActions/{conversion_action_id}".format( - customer_id=customer_id, conversion_action_id=conversion_action_id, - ) - - @staticmethod - def parse_conversion_action_path(path: str) -> Dict[str, str]: - """Parse a conversion_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/conversionActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def currency_constant_path(code: str,) -> str: - """Return a fully-qualified currency_constant string.""" - return "currencyConstants/{code}".format(code=code,) - - @staticmethod - def parse_currency_constant_path(path: str) -> Dict[str, str]: - """Parse a currency_constant path into its component segments.""" - m = re.match(r"^currencyConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def custom_audience_path(customer_id: str, custom_audience_id: str,) -> str: - """Return a fully-qualified custom_audience string.""" - return "customers/{customer_id}/customAudiences/{custom_audience_id}".format( - customer_id=customer_id, custom_audience_id=custom_audience_id, - ) - - @staticmethod - def parse_custom_audience_path(path: str) -> Dict[str, str]: - """Parse a custom_audience path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customAudiences/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def customer_client_path(customer_id: str, client_customer_id: str,) -> str: - """Return a fully-qualified customer_client string.""" - return "customers/{customer_id}/customerClients/{client_customer_id}".format( - customer_id=customer_id, client_customer_id=client_customer_id, - ) - - @staticmethod - def parse_customer_client_path(path: str) -> Dict[str, str]: - """Parse a customer_client path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerClients/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_client_link_path( - customer_id: str, client_customer_id: str, manager_link_id: str, - ) -> str: - """Return a fully-qualified customer_client_link string.""" - return "customers/{customer_id}/customerClientLinks/{client_customer_id}~{manager_link_id}".format( - customer_id=customer_id, - client_customer_id=client_customer_id, - manager_link_id=manager_link_id, - ) - - @staticmethod - def parse_customer_client_link_path(path: str) -> Dict[str, str]: - """Parse a customer_client_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerClientLinks/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_extension_setting_path( - customer_id: str, extension_type: str, - ) -> str: - """Return a fully-qualified customer_extension_setting string.""" - return "customers/{customer_id}/customerExtensionSettings/{extension_type}".format( - customer_id=customer_id, extension_type=extension_type, - ) - - @staticmethod - def parse_customer_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a customer_extension_setting path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerExtensionSettings/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified customer_feed string.""" - return "customers/{customer_id}/customerFeeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_customer_feed_path(path: str) -> Dict[str, str]: - """Parse a customer_feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerFeeds/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified customer_label string.""" - return "customers/{customer_id}/customerLabels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_customer_label_path(path: str) -> Dict[str, str]: - """Parse a customer_label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerLabels/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_manager_link_path( - customer_id: str, manager_customer_id: str, manager_link_id: str, - ) -> str: - """Return a fully-qualified customer_manager_link string.""" - return "customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}".format( - customer_id=customer_id, - manager_customer_id=manager_customer_id, - manager_link_id=manager_link_id, - ) - - @staticmethod - def parse_customer_manager_link_path(path: str) -> Dict[str, str]: - """Parse a customer_manager_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerManagerLinks/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_negative_criterion_path( - customer_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified customer_negative_criterion string.""" - return "customers/{customer_id}/customerNegativeCriteria/{criterion_id}".format( - customer_id=customer_id, criterion_id=criterion_id, - ) - - @staticmethod - def parse_customer_negative_criterion_path(path: str) -> Dict[str, str]: - """Parse a customer_negative_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerNegativeCriteria/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_user_access_path(customer_id: str, user_id: str,) -> str: - """Return a fully-qualified customer_user_access string.""" - return "customers/{customer_id}/customerUserAccesses/{user_id}".format( - customer_id=customer_id, user_id=user_id, - ) - - @staticmethod - def parse_customer_user_access_path(path: str) -> Dict[str, str]: - """Parse a customer_user_access path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerUserAccesses/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def customer_user_access_invitation_path( - customer_id: str, invitation_id: str, - ) -> str: - """Return a fully-qualified customer_user_access_invitation string.""" - return "customers/{customer_id}/customerUserAccessInvitations/{invitation_id}".format( - customer_id=customer_id, invitation_id=invitation_id, - ) - - @staticmethod - def parse_customer_user_access_invitation_path(path: str) -> Dict[str, str]: - """Parse a customer_user_access_invitation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customerUserAccessInvitations/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def custom_interest_path(customer_id: str, custom_interest_id: str,) -> str: - """Return a fully-qualified custom_interest string.""" - return "customers/{customer_id}/customInterests/{custom_interest_id}".format( - customer_id=customer_id, custom_interest_id=custom_interest_id, - ) - - @staticmethod - def parse_custom_interest_path(path: str) -> Dict[str, str]: - """Parse a custom_interest path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/customInterests/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def detail_placement_view_path( - customer_id: str, ad_group_id: str, base64_placement: str, - ) -> str: - """Return a fully-qualified detail_placement_view string.""" - return "customers/{customer_id}/detailPlacementViews/{ad_group_id}~{base64_placement}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - base64_placement=base64_placement, - ) - - @staticmethod - def parse_detail_placement_view_path(path: str) -> Dict[str, str]: - """Parse a detail_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/detailPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def display_keyword_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified display_keyword_view string.""" - return "customers/{customer_id}/displayKeywordViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_display_keyword_view_path(path: str) -> Dict[str, str]: - """Parse a display_keyword_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/displayKeywordViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def distance_view_path( - customer_id: str, placeholder_chain_id: str, distance_bucket: str, - ) -> str: - """Return a fully-qualified distance_view string.""" - return "customers/{customer_id}/distanceViews/{placeholder_chain_id}~{distance_bucket}".format( - customer_id=customer_id, - placeholder_chain_id=placeholder_chain_id, - distance_bucket=distance_bucket, - ) - - @staticmethod - def parse_distance_view_path(path: str) -> Dict[str, str]: - """Parse a distance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/distanceViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def domain_category_path( - customer_id: str, - campaign_id: str, - base64_category: str, - language_code: str, - ) -> str: - """Return a fully-qualified domain_category string.""" - return "customers/{customer_id}/domainCategories/{campaign_id}~{base64_category}~{language_code}".format( - customer_id=customer_id, - campaign_id=campaign_id, - base64_category=base64_category, - language_code=language_code, - ) - - @staticmethod - def parse_domain_category_path(path: str) -> Dict[str, str]: - """Parse a domain_category path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/domainCategories/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def dynamic_search_ads_search_term_view_path( - customer_id: str, - ad_group_id: str, - search_term_fingerprint: str, - headline_fingerprint: str, - landing_page_fingerprint: str, - page_url_fingerprint: str, - ) -> str: - """Return a fully-qualified dynamic_search_ads_search_term_view string.""" - return "customers/{customer_id}/dynamicSearchAdsSearchTermViews/{ad_group_id}~{search_term_fingerprint}~{headline_fingerprint}~{landing_page_fingerprint}~{page_url_fingerprint}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - search_term_fingerprint=search_term_fingerprint, - headline_fingerprint=headline_fingerprint, - landing_page_fingerprint=landing_page_fingerprint, - page_url_fingerprint=page_url_fingerprint, - ) - - @staticmethod - def parse_dynamic_search_ads_search_term_view_path( - path: str, - ) -> Dict[str, str]: - """Parse a dynamic_search_ads_search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/dynamicSearchAdsSearchTermViews/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def expanded_landing_page_view_path( - customer_id: str, expanded_final_url_fingerprint: str, - ) -> str: - """Return a fully-qualified expanded_landing_page_view string.""" - return "customers/{customer_id}/expandedLandingPageViews/{expanded_final_url_fingerprint}".format( - customer_id=customer_id, - expanded_final_url_fingerprint=expanded_final_url_fingerprint, - ) - - @staticmethod - def parse_expanded_landing_page_view_path(path: str) -> Dict[str, str]: - """Parse a expanded_landing_page_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/expandedLandingPageViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_path(customer_id: str, feed_id: str,) -> str: - """Return a fully-qualified feed string.""" - return "customers/{customer_id}/feeds/{feed_id}".format( - customer_id=customer_id, feed_id=feed_id, - ) - - @staticmethod - def parse_feed_path(path: str) -> Dict[str, str]: - """Parse a feed path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feeds/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_path( - customer_id: str, feed_id: str, feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item string.""" - return "customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}".format( - customer_id=customer_id, feed_id=feed_id, feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_path(path: str) -> Dict[str, str]: - """Parse a feed_item path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItems/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_path( - customer_id: str, feed_id: str, feed_item_set_id: str, - ) -> str: - """Return a fully-qualified feed_item_set string.""" - return "customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - ) - - @staticmethod - def parse_feed_item_set_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSets/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_set_link_path( - customer_id: str, - feed_id: str, - feed_item_set_id: str, - feed_item_id: str, - ) -> str: - """Return a fully-qualified feed_item_set_link string.""" - return "customers/{customer_id}/feedItemSetLinks/{feed_id}~{feed_item_set_id}~{feed_item_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_set_id=feed_item_set_id, - feed_item_id=feed_item_id, - ) - - @staticmethod - def parse_feed_item_set_link_path(path: str) -> Dict[str, str]: - """Parse a feed_item_set_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemSetLinks/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_item_target_path( - customer_id: str, - feed_id: str, - feed_item_id: str, - feed_item_target_type: str, - feed_item_target_id: str, - ) -> str: - """Return a fully-qualified feed_item_target string.""" - return "customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_item_id=feed_item_id, - feed_item_target_type=feed_item_target_type, - feed_item_target_id=feed_item_target_id, - ) - - @staticmethod - def parse_feed_item_target_path(path: str) -> Dict[str, str]: - """Parse a feed_item_target path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedItemTargets/(?P.+?)~(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_mapping_path( - customer_id: str, feed_id: str, feed_mapping_id: str, - ) -> str: - """Return a fully-qualified feed_mapping string.""" - return "customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}".format( - customer_id=customer_id, - feed_id=feed_id, - feed_mapping_id=feed_mapping_id, - ) - - @staticmethod - def parse_feed_mapping_path(path: str) -> Dict[str, str]: - """Parse a feed_mapping path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedMappings/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def feed_placeholder_view_path( - customer_id: str, placeholder_type: str, - ) -> str: - """Return a fully-qualified feed_placeholder_view string.""" - return "customers/{customer_id}/feedPlaceholderViews/{placeholder_type}".format( - customer_id=customer_id, placeholder_type=placeholder_type, - ) - - @staticmethod - def parse_feed_placeholder_view_path(path: str) -> Dict[str, str]: - """Parse a feed_placeholder_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/feedPlaceholderViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def gender_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified gender_view string.""" - return "customers/{customer_id}/genderViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_gender_view_path(path: str) -> Dict[str, str]: - """Parse a gender_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/genderViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geographic_view_path( - customer_id: str, country_criterion_id: str, location_type: str, - ) -> str: - """Return a fully-qualified geographic_view string.""" - return "customers/{customer_id}/geographicViews/{country_criterion_id}~{location_type}".format( - customer_id=customer_id, - country_criterion_id=country_criterion_id, - location_type=location_type, - ) - - @staticmethod - def parse_geographic_view_path(path: str) -> Dict[str, str]: - """Parse a geographic_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/geographicViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def geo_target_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified geo_target_constant string.""" - return "geoTargetConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_geo_target_constant_path(path: str) -> Dict[str, str]: - """Parse a geo_target_constant path into its component segments.""" - m = re.match(r"^geoTargetConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def group_placement_view_path( - customer_id: str, ad_group_id: str, base64_placement: str, - ) -> str: - """Return a fully-qualified group_placement_view string.""" - return "customers/{customer_id}/groupPlacementViews/{ad_group_id}~{base64_placement}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - base64_placement=base64_placement, - ) - - @staticmethod - def parse_group_placement_view_path(path: str) -> Dict[str, str]: - """Parse a group_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/groupPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def hotel_group_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified hotel_group_view string.""" - return "customers/{customer_id}/hotelGroupViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_hotel_group_view_path(path: str) -> Dict[str, str]: - """Parse a hotel_group_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/hotelGroupViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def hotel_performance_view_path(customer_id: str,) -> str: - """Return a fully-qualified hotel_performance_view string.""" - return "customers/{customer_id}/hotelPerformanceView".format( - customer_id=customer_id, - ) - - @staticmethod - def parse_hotel_performance_view_path(path: str) -> Dict[str, str]: - """Parse a hotel_performance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/hotelPerformanceView$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def income_range_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified income_range_view string.""" - return "customers/{customer_id}/incomeRangeViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_income_range_view_path(path: str) -> Dict[str, str]: - """Parse a income_range_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/incomeRangeViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_path(customer_id: str, keyword_plan_id: str,) -> str: - """Return a fully-qualified keyword_plan string.""" - return "customers/{customer_id}/keywordPlans/{keyword_plan_id}".format( - customer_id=customer_id, keyword_plan_id=keyword_plan_id, - ) - - @staticmethod - def parse_keyword_plan_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlans/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_ad_group_path( - customer_id: str, keyword_plan_ad_group_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group string.""" - return "customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_id=keyword_plan_ad_group_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_ad_group_keyword_path( - customer_id: str, keyword_plan_ad_group_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group_keyword string.""" - return "customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_keyword_id=keyword_plan_ad_group_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroupKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_path( - customer_id: str, keyword_plan_campaign_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign string.""" - return "customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}".format( - customer_id=customer_id, - keyword_plan_campaign_id=keyword_plan_campaign_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_keyword_path( - customer_id: str, keyword_plan_campaign_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign_keyword string.""" - return "customers/{customer_id}/keywordPlanCampaignKeywords/{keyword_plan_campaign_keyword_id}".format( - customer_id=customer_id, - keyword_plan_campaign_keyword_id=keyword_plan_campaign_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaignKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified keyword_view string.""" - return "customers/{customer_id}/keywordViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_keyword_view_path(path: str) -> Dict[str, str]: - """Parse a keyword_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def landing_page_view_path( - customer_id: str, unexpanded_final_url_fingerprint: str, - ) -> str: - """Return a fully-qualified landing_page_view string.""" - return "customers/{customer_id}/landingPageViews/{unexpanded_final_url_fingerprint}".format( - customer_id=customer_id, - unexpanded_final_url_fingerprint=unexpanded_final_url_fingerprint, - ) - - @staticmethod - def parse_landing_page_view_path(path: str) -> Dict[str, str]: - """Parse a landing_page_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/landingPageViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def language_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified language_constant string.""" - return "languageConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_language_constant_path(path: str) -> Dict[str, str]: - """Parse a language_constant path into its component segments.""" - m = re.match(r"^languageConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def location_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified location_view string.""" - return "customers/{customer_id}/locationViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_location_view_path(path: str) -> Dict[str, str]: - """Parse a location_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/locationViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def managed_placement_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified managed_placement_view string.""" - return "customers/{customer_id}/managedPlacementViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_managed_placement_view_path(path: str) -> Dict[str, str]: - """Parse a managed_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/managedPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def media_file_path(customer_id: str, media_file_id: str,) -> str: - """Return a fully-qualified media_file string.""" - return "customers/{customer_id}/mediaFiles/{media_file_id}".format( - customer_id=customer_id, media_file_id=media_file_id, - ) - - @staticmethod - def parse_media_file_path(path: str) -> Dict[str, str]: - """Parse a media_file path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/mediaFiles/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def mobile_app_category_constant_path(mobile_app_category_id: str,) -> str: - """Return a fully-qualified mobile_app_category_constant string.""" - return "mobileAppCategoryConstants/{mobile_app_category_id}".format( - mobile_app_category_id=mobile_app_category_id, - ) - - @staticmethod - def parse_mobile_app_category_constant_path(path: str) -> Dict[str, str]: - """Parse a mobile_app_category_constant path into its component segments.""" - m = re.match( - r"^mobileAppCategoryConstants/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def mobile_device_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified mobile_device_constant string.""" - return "mobileDeviceConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_mobile_device_constant_path(path: str) -> Dict[str, str]: - """Parse a mobile_device_constant path into its component segments.""" - m = re.match(r"^mobileDeviceConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def offline_user_data_job_path( - customer_id: str, offline_user_data_update_id: str, - ) -> str: - """Return a fully-qualified offline_user_data_job string.""" - return "customers/{customer_id}/offlineUserDataJobs/{offline_user_data_update_id}".format( - customer_id=customer_id, - offline_user_data_update_id=offline_user_data_update_id, - ) - - @staticmethod - def parse_offline_user_data_job_path(path: str) -> Dict[str, str]: - """Parse a offline_user_data_job path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/offlineUserDataJobs/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def operating_system_version_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified operating_system_version_constant string.""" - return "operatingSystemVersionConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_operating_system_version_constant_path( - path: str, - ) -> Dict[str, str]: - """Parse a operating_system_version_constant path into its component segments.""" - m = re.match( - r"^operatingSystemVersionConstants/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def paid_organic_search_term_view_path( - customer_id: str, - campaign_id: str, - ad_group_id: str, - base64_search_term: str, - ) -> str: - """Return a fully-qualified paid_organic_search_term_view string.""" - return "customers/{customer_id}/paidOrganicSearchTermViews/{campaign_id}~{ad_group_id}~{base64_search_term}".format( - customer_id=customer_id, - campaign_id=campaign_id, - ad_group_id=ad_group_id, - base64_search_term=base64_search_term, - ) - - @staticmethod - def parse_paid_organic_search_term_view_path(path: str) -> Dict[str, str]: - """Parse a paid_organic_search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/paidOrganicSearchTermViews/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def parental_status_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified parental_status_view string.""" - return "customers/{customer_id}/parentalStatusViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_parental_status_view_path(path: str) -> Dict[str, str]: - """Parse a parental_status_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/parentalStatusViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def payments_account_path( - customer_id: str, payments_account_id: str, - ) -> str: - """Return a fully-qualified payments_account string.""" - return "customers/{customer_id}/paymentsAccounts/{payments_account_id}".format( - customer_id=customer_id, payments_account_id=payments_account_id, - ) - - @staticmethod - def parse_payments_account_path(path: str) -> Dict[str, str]: - """Parse a payments_account path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/paymentsAccounts/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def product_bidding_category_constant_path( - country_code: str, level: str, id: str, - ) -> str: - """Return a fully-qualified product_bidding_category_constant string.""" - return "productBiddingCategoryConstants/{country_code}~{level}~{id}".format( - country_code=country_code, level=level, id=id, - ) - - @staticmethod - def parse_product_bidding_category_constant_path( - path: str, - ) -> Dict[str, str]: - """Parse a product_bidding_category_constant path into its component segments.""" - m = re.match( - r"^productBiddingCategoryConstants/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def product_group_view_path( - customer_id: str, adgroup_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified product_group_view string.""" - return "customers/{customer_id}/productGroupViews/{adgroup_id}~{criterion_id}".format( - customer_id=customer_id, - adgroup_id=adgroup_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_product_group_view_path(path: str) -> Dict[str, str]: - """Parse a product_group_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/productGroupViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def recommendation_path(customer_id: str, recommendation_id: str,) -> str: - """Return a fully-qualified recommendation string.""" - return "customers/{customer_id}/recommendations/{recommendation_id}".format( - customer_id=customer_id, recommendation_id=recommendation_id, - ) - - @staticmethod - def parse_recommendation_path(path: str) -> Dict[str, str]: - """Parse a recommendation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/recommendations/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def remarketing_action_path( - customer_id: str, remarketing_action_id: str, - ) -> str: - """Return a fully-qualified remarketing_action string.""" - return "customers/{customer_id}/remarketingActions/{remarketing_action_id}".format( - customer_id=customer_id, - remarketing_action_id=remarketing_action_id, - ) - - @staticmethod - def parse_remarketing_action_path(path: str) -> Dict[str, str]: - """Parse a remarketing_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/remarketingActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def search_term_view_path( - customer_id: str, campaign_id: str, ad_group_id: str, query: str, - ) -> str: - """Return a fully-qualified search_term_view string.""" - return "customers/{customer_id}/searchTermViews/{campaign_id}~{ad_group_id}~{query}".format( - customer_id=customer_id, - campaign_id=campaign_id, - ad_group_id=ad_group_id, - query=query, - ) - - @staticmethod - def parse_search_term_view_path(path: str) -> Dict[str, str]: - """Parse a search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/searchTermViews/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shared_criterion_path( - customer_id: str, shared_set_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified shared_criterion string.""" - return "customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}".format( - customer_id=customer_id, - shared_set_id=shared_set_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_shared_criterion_path(path: str) -> Dict[str, str]: - """Parse a shared_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shared_set_path(customer_id: str, shared_set_id: str,) -> str: - """Return a fully-qualified shared_set string.""" - return "customers/{customer_id}/sharedSets/{shared_set_id}".format( - customer_id=customer_id, shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_shared_set_path(path: str) -> Dict[str, str]: - """Parse a shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedSets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shopping_performance_view_path(customer_id: str,) -> str: - """Return a fully-qualified shopping_performance_view string.""" - return "customers/{customer_id}/shoppingPerformanceView".format( - customer_id=customer_id, - ) - - @staticmethod - def parse_shopping_performance_view_path(path: str) -> Dict[str, str]: - """Parse a shopping_performance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/shoppingPerformanceView$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def third_party_app_analytics_link_path( - customer_id: str, customer_link_id: str, - ) -> str: - """Return a fully-qualified third_party_app_analytics_link string.""" - return "customers/{customer_id}/thirdPartyAppAnalyticsLinks/{customer_link_id}".format( - customer_id=customer_id, customer_link_id=customer_link_id, - ) - - @staticmethod - def parse_third_party_app_analytics_link_path(path: str) -> Dict[str, str]: - """Parse a third_party_app_analytics_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/thirdPartyAppAnalyticsLinks/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def topic_constant_path(topic_id: str,) -> str: - """Return a fully-qualified topic_constant string.""" - return "topicConstants/{topic_id}".format(topic_id=topic_id,) - - @staticmethod - def parse_topic_constant_path(path: str) -> Dict[str, str]: - """Parse a topic_constant path into its component segments.""" - m = re.match(r"^topicConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def topic_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified topic_view string.""" - return "customers/{customer_id}/topicViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_topic_view_path(path: str) -> Dict[str, str]: - """Parse a topic_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/topicViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def user_interest_path(customer_id: str, user_interest_id: str,) -> str: - """Return a fully-qualified user_interest string.""" - return "customers/{customer_id}/userInterests/{user_interest_id}".format( - customer_id=customer_id, user_interest_id=user_interest_id, - ) - - @staticmethod - def parse_user_interest_path(path: str) -> Dict[str, str]: - """Parse a user_interest path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userInterests/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def user_list_path(customer_id: str, user_list_id: str,) -> str: - """Return a fully-qualified user_list string.""" - return "customers/{customer_id}/userLists/{user_list_id}".format( - customer_id=customer_id, user_list_id=user_list_id, - ) - - @staticmethod - def parse_user_list_path(path: str) -> Dict[str, str]: - """Parse a user_list path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLists/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def user_location_view_path( - customer_id: str, country_criterion_id: str, is_targeting_location: str, - ) -> str: - """Return a fully-qualified user_location_view string.""" - return "customers/{customer_id}/userLocationViews/{country_criterion_id}~{is_targeting_location}".format( - customer_id=customer_id, - country_criterion_id=country_criterion_id, - is_targeting_location=is_targeting_location, - ) - - @staticmethod - def parse_user_location_view_path(path: str) -> Dict[str, str]: - """Parse a user_location_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLocationViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def video_path(customer_id: str, video_id: str,) -> str: - """Return a fully-qualified video string.""" - return "customers/{customer_id}/videos/{video_id}".format( - customer_id=customer_id, video_id=video_id, - ) - - @staticmethod - def parse_video_path(path: str) -> Dict[str, str]: - """Parse a video path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/videos/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GoogleAdsServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the google ads service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GoogleAdsServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GoogleAdsServiceTransport): - # transport is a GoogleAdsServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GoogleAdsServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def search( - self, - request: google_ads_service.SearchGoogleAdsRequest = None, - *, - customer_id: str = None, - query: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.SearchPager: - r"""Returns all rows that match the search query. - - Args: - request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsRequest`): - The request object. Request message for - [GoogleAdsService.Search][google.ads.googleads.v6.services.GoogleAdsService.Search]. - customer_id (:class:`str`): - Required. The ID of the customer - being queried. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - query (:class:`str`): - Required. The query string. - This corresponds to the ``query`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.google_ads_service.pagers.SearchPager: - Response message for - [GoogleAdsService.Search][google.ads.googleads.v6.services.GoogleAdsService.Search]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, query]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a google_ads_service.SearchGoogleAdsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, google_ads_service.SearchGoogleAdsRequest): - request = google_ads_service.SearchGoogleAdsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if query is not None: - request.query = query - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.search] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.SearchPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - def search_stream( - self, - request: google_ads_service.SearchGoogleAdsStreamRequest = None, - *, - customer_id: str = None, - query: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> Iterable[google_ads_service.SearchGoogleAdsStreamResponse]: - r"""Returns all rows that match the search stream query. - - Args: - request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsStreamRequest`): - The request object. Request message for - [GoogleAdsService.SearchStream][google.ads.googleads.v6.services.GoogleAdsService.SearchStream]. - customer_id (:class:`str`): - Required. The ID of the customer - being queried. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - query (:class:`str`): - Required. The query string. - This corresponds to the ``query`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - Iterable[google.ads.googleads.v6.services.types.SearchGoogleAdsStreamResponse]: - Response message for - [GoogleAdsService.SearchStream][google.ads.googleads.v6.services.GoogleAdsService.SearchStream]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, query]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a google_ads_service.SearchGoogleAdsStreamRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, google_ads_service.SearchGoogleAdsStreamRequest - ): - request = google_ads_service.SearchGoogleAdsStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if query is not None: - request.query = query - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.search_stream] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate( - self, - request: google_ads_service.MutateGoogleAdsRequest = None, - *, - customer_id: str = None, - mutate_operations: Sequence[google_ads_service.MutateOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> google_ads_service.MutateGoogleAdsResponse: - r"""Creates, updates, or removes resources. This method supports - atomic transactions with multiple types of resources. For - example, you can atomically create a campaign and a campaign - budget, or perform up to thousands of mutates atomically. - - This method is essentially a wrapper around a series of mutate - methods. The only features it offers over calling those methods - directly are: - - - Atomic transactions - - Temp resource names (described below) - - Somewhat reduced latency over making a series of mutate calls - - Note: Only resources that support atomic transactions are - included, so this method can't replace all calls to individual - services. - - Atomic Transaction Benefits - --------------------------- - - Atomicity makes error handling much easier. If you're making a - series of changes and one fails, it can leave your account in an - inconsistent state. With atomicity, you either reach the desired - state directly, or the request fails and you can retry. - - Temp Resource Names - ------------------- - - Temp resource names are a special type of resource name used to - create a resource and reference that resource in the same - request. For example, if a campaign budget is created with - ``resource_name`` equal to ``customers/123/campaignBudgets/-1``, - that resource name can be reused in the ``Campaign.budget`` - field in the same request. That way, the two resources are - created and linked atomically. - - To create a temp resource name, put a negative number in the - part of the name that the server would normally allocate. - - Note: - - - Resources must be created with a temp name before the name - can be reused. For example, the previous - CampaignBudget+Campaign example would fail if the mutate - order was reversed. - - Temp names are not remembered across requests. - - There's no limit to the number of temp names in a request. - - Each temp name must use a unique negative number, even if the - resource types differ. - - Latency - ------- - - It's important to group mutates by resource type or the request - may time out and fail. Latency is roughly equal to a series of - calls to individual mutate methods, where each change in - resource type is a new call. For example, mutating 10 campaigns - then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 - ad group, 1 campaign, 1 ad group is like 4 calls. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateGoogleAdsRequest`): - The request object. Request message for - [GoogleAdsService.Mutate][google.ads.googleads.v6.services.GoogleAdsService.Mutate]. - customer_id (:class:`str`): - Required. The ID of the customer - whose resources are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - mutate_operations (:class:`Sequence[google.ads.googleads.v6.services.types.MutateOperation]`): - Required. The list of operations to - perform on individual resources. - - This corresponds to the ``mutate_operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateGoogleAdsResponse: - Response message for - [GoogleAdsService.Mutate][google.ads.googleads.v6.services.GoogleAdsService.Mutate]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, mutate_operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a google_ads_service.MutateGoogleAdsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, google_ads_service.MutateGoogleAdsRequest): - request = google_ads_service.MutateGoogleAdsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if mutate_operations is not None: - request.mutate_operations = mutate_operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GoogleAdsServiceClient",) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/pagers.py b/google/ads/googleads/v6/services/services/google_ads_service/pagers.py deleted file mode 100644 index cb98fecd0..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/pagers.py +++ /dev/null @@ -1,83 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.services.types import google_ads_service - - -class SearchPager: - """A pager for iterating through ``search`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.SearchGoogleAdsResponse` object, and - provides an ``__iter__`` method to iterate through its - ``results`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``Search`` requests and continue to iterate - through the ``results`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.SearchGoogleAdsResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[..., google_ads_service.SearchGoogleAdsResponse], - request: google_ads_service.SearchGoogleAdsRequest, - response: google_ads_service.SearchGoogleAdsResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.SearchGoogleAdsResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = google_ads_service.SearchGoogleAdsRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterable[google_ads_service.SearchGoogleAdsResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__(self) -> Iterable[google_ads_service.GoogleAdsRow]: - for page in self.pages: - yield from page.results - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/transports/__init__.py b/google/ads/googleads/v6/services/services/google_ads_service/transports/__init__.py deleted file mode 100644 index a149ae623..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GoogleAdsServiceTransport -from .grpc import GoogleAdsServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GoogleAdsServiceTransport]] -_transport_registry["grpc"] = GoogleAdsServiceGrpcTransport - - -__all__ = ( - "GoogleAdsServiceTransport", - "GoogleAdsServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/transports/base.py b/google/ads/googleads/v6/services/services/google_ads_service/transports/base.py deleted file mode 100644 index 0641b9ac7..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/transports/base.py +++ /dev/null @@ -1,125 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import google_ads_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GoogleAdsServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GoogleAdsService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.search: gapic_v1.method.wrap_method( - self.search, default_timeout=None, client_info=client_info, - ), - self.search_stream: gapic_v1.method.wrap_method( - self.search_stream, - default_timeout=None, - client_info=client_info, - ), - self.mutate: gapic_v1.method.wrap_method( - self.mutate, default_timeout=None, client_info=client_info, - ), - } - - @property - def search( - self, - ) -> typing.Callable[ - [google_ads_service.SearchGoogleAdsRequest], - google_ads_service.SearchGoogleAdsResponse, - ]: - raise NotImplementedError - - @property - def search_stream( - self, - ) -> typing.Callable[ - [google_ads_service.SearchGoogleAdsStreamRequest], - google_ads_service.SearchGoogleAdsStreamResponse, - ]: - raise NotImplementedError - - @property - def mutate( - self, - ) -> typing.Callable[ - [google_ads_service.MutateGoogleAdsRequest], - google_ads_service.MutateGoogleAdsResponse, - ]: - raise NotImplementedError - - -__all__ = ("GoogleAdsServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/google_ads_service/transports/grpc.py b/google/ads/googleads/v6/services/services/google_ads_service/transports/grpc.py deleted file mode 100644 index e1cb7a411..000000000 --- a/google/ads/googleads/v6/services/services/google_ads_service/transports/grpc.py +++ /dev/null @@ -1,359 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import google_ads_service - -from .base import GoogleAdsServiceTransport, DEFAULT_CLIENT_INFO - - -class GoogleAdsServiceGrpcTransport(GoogleAdsServiceTransport): - """gRPC backend transport for GoogleAdsService. - - Service to fetch data and metrics across resources. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def search( - self, - ) -> Callable[ - [google_ads_service.SearchGoogleAdsRequest], - google_ads_service.SearchGoogleAdsResponse, - ]: - r"""Return a callable for the search method over gRPC. - - Returns all rows that match the search query. - - Returns: - Callable[[~.SearchGoogleAdsRequest], - ~.SearchGoogleAdsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "search" not in self._stubs: - self._stubs["search"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GoogleAdsService/Search", - request_serializer=google_ads_service.SearchGoogleAdsRequest.serialize, - response_deserializer=google_ads_service.SearchGoogleAdsResponse.deserialize, - ) - return self._stubs["search"] - - @property - def search_stream( - self, - ) -> Callable[ - [google_ads_service.SearchGoogleAdsStreamRequest], - google_ads_service.SearchGoogleAdsStreamResponse, - ]: - r"""Return a callable for the search stream method over gRPC. - - Returns all rows that match the search stream query. - - Returns: - Callable[[~.SearchGoogleAdsStreamRequest], - ~.SearchGoogleAdsStreamResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "search_stream" not in self._stubs: - self._stubs["search_stream"] = self.grpc_channel.unary_stream( - "/google.ads.googleads.v6.services.GoogleAdsService/SearchStream", - request_serializer=google_ads_service.SearchGoogleAdsStreamRequest.serialize, - response_deserializer=google_ads_service.SearchGoogleAdsStreamResponse.deserialize, - ) - return self._stubs["search_stream"] - - @property - def mutate( - self, - ) -> Callable[ - [google_ads_service.MutateGoogleAdsRequest], - google_ads_service.MutateGoogleAdsResponse, - ]: - r"""Return a callable for the mutate method over gRPC. - - Creates, updates, or removes resources. This method supports - atomic transactions with multiple types of resources. For - example, you can atomically create a campaign and a campaign - budget, or perform up to thousands of mutates atomically. - - This method is essentially a wrapper around a series of mutate - methods. The only features it offers over calling those methods - directly are: - - - Atomic transactions - - Temp resource names (described below) - - Somewhat reduced latency over making a series of mutate calls - - Note: Only resources that support atomic transactions are - included, so this method can't replace all calls to individual - services. - - Atomic Transaction Benefits - --------------------------- - - Atomicity makes error handling much easier. If you're making a - series of changes and one fails, it can leave your account in an - inconsistent state. With atomicity, you either reach the desired - state directly, or the request fails and you can retry. - - Temp Resource Names - ------------------- - - Temp resource names are a special type of resource name used to - create a resource and reference that resource in the same - request. For example, if a campaign budget is created with - ``resource_name`` equal to ``customers/123/campaignBudgets/-1``, - that resource name can be reused in the ``Campaign.budget`` - field in the same request. That way, the two resources are - created and linked atomically. - - To create a temp resource name, put a negative number in the - part of the name that the server would normally allocate. - - Note: - - - Resources must be created with a temp name before the name - can be reused. For example, the previous - CampaignBudget+Campaign example would fail if the mutate - order was reversed. - - Temp names are not remembered across requests. - - There's no limit to the number of temp names in a request. - - Each temp name must use a unique negative number, even if the - resource types differ. - - Latency - ------- - - It's important to group mutates by resource type or the request - may time out and fail. Latency is roughly equal to a series of - calls to individual mutate methods, where each change in - resource type is a new call. For example, mutating 10 campaigns - then 10 ad groups is like 2 calls, while mutating 1 campaign, 1 - ad group, 1 campaign, 1 ad group is like 4 calls. - - Returns: - Callable[[~.MutateGoogleAdsRequest], - ~.MutateGoogleAdsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate" not in self._stubs: - self._stubs["mutate"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GoogleAdsService/Mutate", - request_serializer=google_ads_service.MutateGoogleAdsRequest.serialize, - response_deserializer=google_ads_service.MutateGoogleAdsResponse.deserialize, - ) - return self._stubs["mutate"] - - -__all__ = ("GoogleAdsServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/group_placement_view_service/__init__.py b/google/ads/googleads/v6/services/services/group_placement_view_service/__init__.py deleted file mode 100644 index 81328a255..000000000 --- a/google/ads/googleads/v6/services/services/group_placement_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import GroupPlacementViewServiceClient - -__all__ = ("GroupPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/group_placement_view_service/client.py b/google/ads/googleads/v6/services/services/group_placement_view_service/client.py deleted file mode 100644 index d708544a1..000000000 --- a/google/ads/googleads/v6/services/services/group_placement_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import group_placement_view -from google.ads.googleads.v6.services.types import group_placement_view_service - -from .transports.base import ( - GroupPlacementViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import GroupPlacementViewServiceGrpcTransport - - -class GroupPlacementViewServiceClientMeta(type): - """Metaclass for the GroupPlacementViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[GroupPlacementViewServiceTransport]] - _transport_registry["grpc"] = GroupPlacementViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[GroupPlacementViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class GroupPlacementViewServiceClient( - metaclass=GroupPlacementViewServiceClientMeta -): - """Service to fetch Group Placement views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GroupPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - GroupPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> GroupPlacementViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - GroupPlacementViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def group_placement_view_path( - customer_id: str, ad_group_id: str, base64_placement: str, - ) -> str: - """Return a fully-qualified group_placement_view string.""" - return "customers/{customer_id}/groupPlacementViews/{ad_group_id}~{base64_placement}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - base64_placement=base64_placement, - ) - - @staticmethod - def parse_group_placement_view_path(path: str) -> Dict[str, str]: - """Parse a group_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/groupPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, GroupPlacementViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the group placement view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.GroupPlacementViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, GroupPlacementViewServiceTransport): - # transport is a GroupPlacementViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = GroupPlacementViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_group_placement_view( - self, - request: group_placement_view_service.GetGroupPlacementViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> group_placement_view.GroupPlacementView: - r"""Returns the requested Group Placement view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetGroupPlacementViewRequest`): - The request object. Request message for - [GroupPlacementViewService.GetGroupPlacementView][google.ads.googleads.v6.services.GroupPlacementViewService.GetGroupPlacementView]. - resource_name (:class:`str`): - Required. The resource name of the - Group Placement view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.GroupPlacementView: - A group placement view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a group_placement_view_service.GetGroupPlacementViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, group_placement_view_service.GetGroupPlacementViewRequest - ): - request = group_placement_view_service.GetGroupPlacementViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_group_placement_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("GroupPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/group_placement_view_service/transports/__init__.py deleted file mode 100644 index 8ce120204..000000000 --- a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import GroupPlacementViewServiceTransport -from .grpc import GroupPlacementViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[GroupPlacementViewServiceTransport]] -_transport_registry["grpc"] = GroupPlacementViewServiceGrpcTransport - - -__all__ = ( - "GroupPlacementViewServiceTransport", - "GroupPlacementViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/base.py b/google/ads/googleads/v6/services/services/group_placement_view_service/transports/base.py deleted file mode 100644 index bd539e81c..000000000 --- a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import group_placement_view -from google.ads.googleads.v6.services.types import group_placement_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class GroupPlacementViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for GroupPlacementViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_group_placement_view: gapic_v1.method.wrap_method( - self.get_group_placement_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_group_placement_view( - self, - ) -> typing.Callable[ - [group_placement_view_service.GetGroupPlacementViewRequest], - group_placement_view.GroupPlacementView, - ]: - raise NotImplementedError - - -__all__ = ("GroupPlacementViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/group_placement_view_service/transports/grpc.py deleted file mode 100644 index 0934f35d2..000000000 --- a/google/ads/googleads/v6/services/services/group_placement_view_service/transports/grpc.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import group_placement_view -from google.ads.googleads.v6.services.types import group_placement_view_service - -from .base import GroupPlacementViewServiceTransport, DEFAULT_CLIENT_INFO - - -class GroupPlacementViewServiceGrpcTransport( - GroupPlacementViewServiceTransport -): - """gRPC backend transport for GroupPlacementViewService. - - Service to fetch Group Placement views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_group_placement_view( - self, - ) -> Callable[ - [group_placement_view_service.GetGroupPlacementViewRequest], - group_placement_view.GroupPlacementView, - ]: - r"""Return a callable for the get group placement view method over gRPC. - - Returns the requested Group Placement view in full - detail. - - Returns: - Callable[[~.GetGroupPlacementViewRequest], - ~.GroupPlacementView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_group_placement_view" not in self._stubs: - self._stubs[ - "get_group_placement_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.GroupPlacementViewService/GetGroupPlacementView", - request_serializer=group_placement_view_service.GetGroupPlacementViewRequest.serialize, - response_deserializer=group_placement_view.GroupPlacementView.deserialize, - ) - return self._stubs["get_group_placement_view"] - - -__all__ = ("GroupPlacementViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/hotel_group_view_service/__init__.py b/google/ads/googleads/v6/services/services/hotel_group_view_service/__init__.py deleted file mode 100644 index 7920d9e06..000000000 --- a/google/ads/googleads/v6/services/services/hotel_group_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import HotelGroupViewServiceClient - -__all__ = ("HotelGroupViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/hotel_group_view_service/client.py b/google/ads/googleads/v6/services/services/hotel_group_view_service/client.py deleted file mode 100644 index 7df314f2f..000000000 --- a/google/ads/googleads/v6/services/services/hotel_group_view_service/client.py +++ /dev/null @@ -1,440 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_group_view -from google.ads.googleads.v6.services.types import hotel_group_view_service - -from .transports.base import HotelGroupViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import HotelGroupViewServiceGrpcTransport - - -class HotelGroupViewServiceClientMeta(type): - """Metaclass for the HotelGroupViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[HotelGroupViewServiceTransport]] - _transport_registry["grpc"] = HotelGroupViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[HotelGroupViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class HotelGroupViewServiceClient(metaclass=HotelGroupViewServiceClientMeta): - """Service to manage Hotel Group Views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - HotelGroupViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - HotelGroupViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> HotelGroupViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - HotelGroupViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def hotel_group_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified hotel_group_view string.""" - return "customers/{customer_id}/hotelGroupViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_hotel_group_view_path(path: str) -> Dict[str, str]: - """Parse a hotel_group_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/hotelGroupViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, HotelGroupViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the hotel group view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.HotelGroupViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, HotelGroupViewServiceTransport): - # transport is a HotelGroupViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = HotelGroupViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_hotel_group_view( - self, - request: hotel_group_view_service.GetHotelGroupViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> hotel_group_view.HotelGroupView: - r"""Returns the requested Hotel Group View in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetHotelGroupViewRequest`): - The request object. Request message for - [HotelGroupViewService.GetHotelGroupView][google.ads.googleads.v6.services.HotelGroupViewService.GetHotelGroupView]. - resource_name (:class:`str`): - Required. Resource name of the Hotel - Group View to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.HotelGroupView: - A hotel group view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a hotel_group_view_service.GetHotelGroupViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, hotel_group_view_service.GetHotelGroupViewRequest - ): - request = hotel_group_view_service.GetHotelGroupViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_hotel_group_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("HotelGroupViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/__init__.py deleted file mode 100644 index d3ff990c4..000000000 --- a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import HotelGroupViewServiceTransport -from .grpc import HotelGroupViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[HotelGroupViewServiceTransport]] -_transport_registry["grpc"] = HotelGroupViewServiceGrpcTransport - - -__all__ = ( - "HotelGroupViewServiceTransport", - "HotelGroupViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/base.py b/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/base.py deleted file mode 100644 index a22046359..000000000 --- a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_group_view -from google.ads.googleads.v6.services.types import hotel_group_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class HotelGroupViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for HotelGroupViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_hotel_group_view: gapic_v1.method.wrap_method( - self.get_hotel_group_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_hotel_group_view( - self, - ) -> typing.Callable[ - [hotel_group_view_service.GetHotelGroupViewRequest], - hotel_group_view.HotelGroupView, - ]: - raise NotImplementedError - - -__all__ = ("HotelGroupViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/grpc.py deleted file mode 100644 index f0663f179..000000000 --- a/google/ads/googleads/v6/services/services/hotel_group_view_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_group_view -from google.ads.googleads.v6.services.types import hotel_group_view_service - -from .base import HotelGroupViewServiceTransport, DEFAULT_CLIENT_INFO - - -class HotelGroupViewServiceGrpcTransport(HotelGroupViewServiceTransport): - """gRPC backend transport for HotelGroupViewService. - - Service to manage Hotel Group Views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_hotel_group_view( - self, - ) -> Callable[ - [hotel_group_view_service.GetHotelGroupViewRequest], - hotel_group_view.HotelGroupView, - ]: - r"""Return a callable for the get hotel group view method over gRPC. - - Returns the requested Hotel Group View in full - detail. - - Returns: - Callable[[~.GetHotelGroupViewRequest], - ~.HotelGroupView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_hotel_group_view" not in self._stubs: - self._stubs["get_hotel_group_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.HotelGroupViewService/GetHotelGroupView", - request_serializer=hotel_group_view_service.GetHotelGroupViewRequest.serialize, - response_deserializer=hotel_group_view.HotelGroupView.deserialize, - ) - return self._stubs["get_hotel_group_view"] - - -__all__ = ("HotelGroupViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/hotel_performance_view_service/__init__.py b/google/ads/googleads/v6/services/services/hotel_performance_view_service/__init__.py deleted file mode 100644 index 1c375c270..000000000 --- a/google/ads/googleads/v6/services/services/hotel_performance_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import HotelPerformanceViewServiceClient - -__all__ = ("HotelPerformanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/hotel_performance_view_service/client.py b/google/ads/googleads/v6/services/services/hotel_performance_view_service/client.py deleted file mode 100644 index 736d763a0..000000000 --- a/google/ads/googleads/v6/services/services/hotel_performance_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_performance_view -from google.ads.googleads.v6.services.types import ( - hotel_performance_view_service, -) - -from .transports.base import ( - HotelPerformanceViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import HotelPerformanceViewServiceGrpcTransport - - -class HotelPerformanceViewServiceClientMeta(type): - """Metaclass for the HotelPerformanceViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[HotelPerformanceViewServiceTransport]] - _transport_registry["grpc"] = HotelPerformanceViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[HotelPerformanceViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class HotelPerformanceViewServiceClient( - metaclass=HotelPerformanceViewServiceClientMeta -): - """Service to manage Hotel Performance Views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - HotelPerformanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - HotelPerformanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> HotelPerformanceViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - HotelPerformanceViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def hotel_performance_view_path(customer_id: str,) -> str: - """Return a fully-qualified hotel_performance_view string.""" - return "customers/{customer_id}/hotelPerformanceView".format( - customer_id=customer_id, - ) - - @staticmethod - def parse_hotel_performance_view_path(path: str) -> Dict[str, str]: - """Parse a hotel_performance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/hotelPerformanceView$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, HotelPerformanceViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the hotel performance view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.HotelPerformanceViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, HotelPerformanceViewServiceTransport): - # transport is a HotelPerformanceViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = HotelPerformanceViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_hotel_performance_view( - self, - request: hotel_performance_view_service.GetHotelPerformanceViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> hotel_performance_view.HotelPerformanceView: - r"""Returns the requested Hotel Performance View in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetHotelPerformanceViewRequest`): - The request object. Request message for - [HotelPerformanceViewService.GetHotelPerformanceView][google.ads.googleads.v6.services.HotelPerformanceViewService.GetHotelPerformanceView]. - resource_name (:class:`str`): - Required. Resource name of the Hotel - Performance View to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.HotelPerformanceView: - A hotel performance view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a hotel_performance_view_service.GetHotelPerformanceViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - hotel_performance_view_service.GetHotelPerformanceViewRequest, - ): - request = hotel_performance_view_service.GetHotelPerformanceViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_hotel_performance_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("HotelPerformanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/__init__.py deleted file mode 100644 index b9a898f35..000000000 --- a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import HotelPerformanceViewServiceTransport -from .grpc import HotelPerformanceViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[HotelPerformanceViewServiceTransport]] -_transport_registry["grpc"] = HotelPerformanceViewServiceGrpcTransport - - -__all__ = ( - "HotelPerformanceViewServiceTransport", - "HotelPerformanceViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/base.py b/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/base.py deleted file mode 100644 index 98b1a0337..000000000 --- a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_performance_view -from google.ads.googleads.v6.services.types import ( - hotel_performance_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class HotelPerformanceViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for HotelPerformanceViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_hotel_performance_view: gapic_v1.method.wrap_method( - self.get_hotel_performance_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_hotel_performance_view( - self, - ) -> typing.Callable[ - [hotel_performance_view_service.GetHotelPerformanceViewRequest], - hotel_performance_view.HotelPerformanceView, - ]: - raise NotImplementedError - - -__all__ = ("HotelPerformanceViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/grpc.py deleted file mode 100644 index b95b1b993..000000000 --- a/google/ads/googleads/v6/services/services/hotel_performance_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import hotel_performance_view -from google.ads.googleads.v6.services.types import ( - hotel_performance_view_service, -) - -from .base import HotelPerformanceViewServiceTransport, DEFAULT_CLIENT_INFO - - -class HotelPerformanceViewServiceGrpcTransport( - HotelPerformanceViewServiceTransport -): - """gRPC backend transport for HotelPerformanceViewService. - - Service to manage Hotel Performance Views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_hotel_performance_view( - self, - ) -> Callable[ - [hotel_performance_view_service.GetHotelPerformanceViewRequest], - hotel_performance_view.HotelPerformanceView, - ]: - r"""Return a callable for the get hotel performance view method over gRPC. - - Returns the requested Hotel Performance View in full - detail. - - Returns: - Callable[[~.GetHotelPerformanceViewRequest], - ~.HotelPerformanceView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_hotel_performance_view" not in self._stubs: - self._stubs[ - "get_hotel_performance_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.HotelPerformanceViewService/GetHotelPerformanceView", - request_serializer=hotel_performance_view_service.GetHotelPerformanceViewRequest.serialize, - response_deserializer=hotel_performance_view.HotelPerformanceView.deserialize, - ) - return self._stubs["get_hotel_performance_view"] - - -__all__ = ("HotelPerformanceViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/income_range_view_service/__init__.py b/google/ads/googleads/v6/services/services/income_range_view_service/__init__.py deleted file mode 100644 index 1d64b639c..000000000 --- a/google/ads/googleads/v6/services/services/income_range_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import IncomeRangeViewServiceClient - -__all__ = ("IncomeRangeViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/income_range_view_service/client.py b/google/ads/googleads/v6/services/services/income_range_view_service/client.py deleted file mode 100644 index 9f4cd7c07..000000000 --- a/google/ads/googleads/v6/services/services/income_range_view_service/client.py +++ /dev/null @@ -1,445 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import income_range_view -from google.ads.googleads.v6.services.types import income_range_view_service - -from .transports.base import ( - IncomeRangeViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import IncomeRangeViewServiceGrpcTransport - - -class IncomeRangeViewServiceClientMeta(type): - """Metaclass for the IncomeRangeViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[IncomeRangeViewServiceTransport]] - _transport_registry["grpc"] = IncomeRangeViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[IncomeRangeViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class IncomeRangeViewServiceClient(metaclass=IncomeRangeViewServiceClientMeta): - """Service to manage income range views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - IncomeRangeViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - IncomeRangeViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> IncomeRangeViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - IncomeRangeViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def income_range_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified income_range_view string.""" - return "customers/{customer_id}/incomeRangeViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_income_range_view_path(path: str) -> Dict[str, str]: - """Parse a income_range_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/incomeRangeViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, IncomeRangeViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the income range view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.IncomeRangeViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, IncomeRangeViewServiceTransport): - # transport is a IncomeRangeViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = IncomeRangeViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_income_range_view( - self, - request: income_range_view_service.GetIncomeRangeViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> income_range_view.IncomeRangeView: - r"""Returns the requested income range view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetIncomeRangeViewRequest`): - The request object. Request message for - [IncomeRangeViewService.GetIncomeRangeView][google.ads.googleads.v6.services.IncomeRangeViewService.GetIncomeRangeView]. - resource_name (:class:`str`): - Required. The resource name of the - income range view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.IncomeRangeView: - An income range view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a income_range_view_service.GetIncomeRangeViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, income_range_view_service.GetIncomeRangeViewRequest - ): - request = income_range_view_service.GetIncomeRangeViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_income_range_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("IncomeRangeViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/income_range_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/income_range_view_service/transports/__init__.py deleted file mode 100644 index bfd7f3d3d..000000000 --- a/google/ads/googleads/v6/services/services/income_range_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import IncomeRangeViewServiceTransport -from .grpc import IncomeRangeViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[IncomeRangeViewServiceTransport]] -_transport_registry["grpc"] = IncomeRangeViewServiceGrpcTransport - - -__all__ = ( - "IncomeRangeViewServiceTransport", - "IncomeRangeViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/income_range_view_service/transports/base.py b/google/ads/googleads/v6/services/services/income_range_view_service/transports/base.py deleted file mode 100644 index 095a7ecba..000000000 --- a/google/ads/googleads/v6/services/services/income_range_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import income_range_view -from google.ads.googleads.v6.services.types import income_range_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class IncomeRangeViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for IncomeRangeViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_income_range_view: gapic_v1.method.wrap_method( - self.get_income_range_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_income_range_view( - self, - ) -> typing.Callable[ - [income_range_view_service.GetIncomeRangeViewRequest], - income_range_view.IncomeRangeView, - ]: - raise NotImplementedError - - -__all__ = ("IncomeRangeViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/income_range_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/income_range_view_service/transports/grpc.py deleted file mode 100644 index 3e555fdcb..000000000 --- a/google/ads/googleads/v6/services/services/income_range_view_service/transports/grpc.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import income_range_view -from google.ads.googleads.v6.services.types import income_range_view_service - -from .base import IncomeRangeViewServiceTransport, DEFAULT_CLIENT_INFO - - -class IncomeRangeViewServiceGrpcTransport(IncomeRangeViewServiceTransport): - """gRPC backend transport for IncomeRangeViewService. - - Service to manage income range views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_income_range_view( - self, - ) -> Callable[ - [income_range_view_service.GetIncomeRangeViewRequest], - income_range_view.IncomeRangeView, - ]: - r"""Return a callable for the get income range view method over gRPC. - - Returns the requested income range view in full - detail. - - Returns: - Callable[[~.GetIncomeRangeViewRequest], - ~.IncomeRangeView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_income_range_view" not in self._stubs: - self._stubs[ - "get_income_range_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.IncomeRangeViewService/GetIncomeRangeView", - request_serializer=income_range_view_service.GetIncomeRangeViewRequest.serialize, - response_deserializer=income_range_view.IncomeRangeView.deserialize, - ) - return self._stubs["get_income_range_view"] - - -__all__ = ("IncomeRangeViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/invoice_service/__init__.py b/google/ads/googleads/v6/services/services/invoice_service/__init__.py deleted file mode 100644 index e36fe967b..000000000 --- a/google/ads/googleads/v6/services/services/invoice_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import InvoiceServiceClient - -__all__ = ("InvoiceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/invoice_service/client.py b/google/ads/googleads/v6/services/services/invoice_service/client.py deleted file mode 100644 index 4c6f55c8c..000000000 --- a/google/ads/googleads/v6/services/services/invoice_service/client.py +++ /dev/null @@ -1,473 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.enums.types import month_of_year -from google.ads.googleads.v6.services.types import invoice_service - -from .transports.base import InvoiceServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import InvoiceServiceGrpcTransport - - -class InvoiceServiceClientMeta(type): - """Metaclass for the InvoiceService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[InvoiceServiceTransport]] - _transport_registry["grpc"] = InvoiceServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[InvoiceServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class InvoiceServiceClient(metaclass=InvoiceServiceClientMeta): - """A service to fetch invoices issued for a billing setup during - a given month. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - InvoiceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - InvoiceServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> InvoiceServiceTransport: - """Return the transport used by the client instance. - - Returns: - InvoiceServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def invoice_path(customer_id: str, invoice_id: str,) -> str: - """Return a fully-qualified invoice string.""" - return "customers/{customer_id}/invoices/{invoice_id}".format( - customer_id=customer_id, invoice_id=invoice_id, - ) - - @staticmethod - def parse_invoice_path(path: str) -> Dict[str, str]: - """Parse a invoice path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/invoices/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, InvoiceServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the invoice service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.InvoiceServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, InvoiceServiceTransport): - # transport is a InvoiceServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = InvoiceServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def list_invoices( - self, - request: invoice_service.ListInvoicesRequest = None, - *, - customer_id: str = None, - billing_setup: str = None, - issue_year: str = None, - issue_month: month_of_year.MonthOfYearEnum.MonthOfYear = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> invoice_service.ListInvoicesResponse: - r"""Returns all invoices associated with a billing setup, - for a given month. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListInvoicesRequest`): - The request object. Request message for fetching the - invoices of a given billing setup that were issued - during a given month. - customer_id (:class:`str`): - Required. The ID of the customer to - fetch invoices for. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - billing_setup (:class:`str`): - Required. The billing setup resource name of the - requested invoices. - - ``customers/{customer_id}/billingSetups/{billing_setup_id}`` - - This corresponds to the ``billing_setup`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - issue_year (:class:`str`): - Required. The issue year to retrieve - invoices, in yyyy format. Only invoices - issued in 2019 or later can be - retrieved. - - This corresponds to the ``issue_year`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - issue_month (:class:`google.ads.googleads.v6.enums.types.MonthOfYearEnum.MonthOfYear`): - Required. The issue month to retrieve - invoices. - - This corresponds to the ``issue_month`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListInvoicesResponse: - Response message for - [InvoiceService.ListInvoices][google.ads.googleads.v6.services.InvoiceService.ListInvoices]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, billing_setup, issue_year, issue_month] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a invoice_service.ListInvoicesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, invoice_service.ListInvoicesRequest): - request = invoice_service.ListInvoicesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if billing_setup is not None: - request.billing_setup = billing_setup - if issue_year is not None: - request.issue_year = issue_year - if issue_month is not None: - request.issue_month = issue_month - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_invoices] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("InvoiceServiceClient",) diff --git a/google/ads/googleads/v6/services/services/invoice_service/transports/__init__.py b/google/ads/googleads/v6/services/services/invoice_service/transports/__init__.py deleted file mode 100644 index 747c01be3..000000000 --- a/google/ads/googleads/v6/services/services/invoice_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import InvoiceServiceTransport -from .grpc import InvoiceServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[InvoiceServiceTransport]] -_transport_registry["grpc"] = InvoiceServiceGrpcTransport - - -__all__ = ( - "InvoiceServiceTransport", - "InvoiceServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/invoice_service/transports/base.py b/google/ads/googleads/v6/services/services/invoice_service/transports/base.py deleted file mode 100644 index 7f254e3a4..000000000 --- a/google/ads/googleads/v6/services/services/invoice_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import invoice_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class InvoiceServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for InvoiceService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.list_invoices: gapic_v1.method.wrap_method( - self.list_invoices, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def list_invoices( - self, - ) -> typing.Callable[ - [invoice_service.ListInvoicesRequest], - invoice_service.ListInvoicesResponse, - ]: - raise NotImplementedError - - -__all__ = ("InvoiceServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/invoice_service/transports/grpc.py b/google/ads/googleads/v6/services/services/invoice_service/transports/grpc.py deleted file mode 100644 index b92223307..000000000 --- a/google/ads/googleads/v6/services/services/invoice_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import invoice_service - -from .base import InvoiceServiceTransport, DEFAULT_CLIENT_INFO - - -class InvoiceServiceGrpcTransport(InvoiceServiceTransport): - """gRPC backend transport for InvoiceService. - - A service to fetch invoices issued for a billing setup during - a given month. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def list_invoices( - self, - ) -> Callable[ - [invoice_service.ListInvoicesRequest], - invoice_service.ListInvoicesResponse, - ]: - r"""Return a callable for the list invoices method over gRPC. - - Returns all invoices associated with a billing setup, - for a given month. - - Returns: - Callable[[~.ListInvoicesRequest], - ~.ListInvoicesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_invoices" not in self._stubs: - self._stubs["list_invoices"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.InvoiceService/ListInvoices", - request_serializer=invoice_service.ListInvoicesRequest.serialize, - response_deserializer=invoice_service.ListInvoicesResponse.deserialize, - ) - return self._stubs["list_invoices"] - - -__all__ = ("InvoiceServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/__init__.py deleted file mode 100644 index b88284516..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanAdGroupKeywordServiceClient - -__all__ = ("KeywordPlanAdGroupKeywordServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/client.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/client.py deleted file mode 100644 index 19eb0dac4..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/client.py +++ /dev/null @@ -1,582 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_ad_group_keyword_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - KeywordPlanAdGroupKeywordServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import KeywordPlanAdGroupKeywordServiceGrpcTransport - - -class KeywordPlanAdGroupKeywordServiceClientMeta(type): - """Metaclass for the KeywordPlanAdGroupKeywordService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordPlanAdGroupKeywordServiceTransport]] - _transport_registry["grpc"] = KeywordPlanAdGroupKeywordServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordPlanAdGroupKeywordServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordPlanAdGroupKeywordServiceClient( - metaclass=KeywordPlanAdGroupKeywordServiceClientMeta -): - """Service to manage Keyword Plan ad group keywords. - KeywordPlanAdGroup is required to add ad group keywords. - Positive and negative keywords are supported. A maximum of - 10,000 positive keywords are allowed per keyword plan. A maximum - of 1,000 negative keywords are allower per keyword plan. This - includes campaign negative keywords and ad group negative - keywords. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanAdGroupKeywordServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanAdGroupKeywordServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordPlanAdGroupKeywordServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordPlanAdGroupKeywordServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def keyword_plan_ad_group_path( - customer_id: str, keyword_plan_ad_group_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group string.""" - return "customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_id=keyword_plan_ad_group_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_ad_group_keyword_path( - customer_id: str, keyword_plan_ad_group_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group_keyword string.""" - return "customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_keyword_id=keyword_plan_ad_group_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroupKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, KeywordPlanAdGroupKeywordServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword plan ad group keyword service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordPlanAdGroupKeywordServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanAdGroupKeywordServiceTransport): - # transport is a KeywordPlanAdGroupKeywordServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordPlanAdGroupKeywordServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_keyword_plan_ad_group_keyword( - self, - request: keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword: - r"""Returns the requested Keyword Plan ad group keyword - in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordPlanAdGroupKeywordRequest`): - The request object. Request message for - [KeywordPlanAdGroupKeywordService.GetKeywordPlanAdGroupKeyword][google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService.GetKeywordPlanAdGroupKeyword]. - resource_name (:class:`str`): - Required. The resource name of the ad - group keyword to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.KeywordPlanAdGroupKeyword: - A Keyword Plan ad group keyword. - Max number of keyword plan keywords per - plan: 10000. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest, - ): - request = keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_keyword_plan_ad_group_keyword - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_keyword_plan_ad_group_keywords( - self, - request: keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - keyword_plan_ad_group_keyword_service.KeywordPlanAdGroupKeywordOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsResponse: - r"""Creates, updates, or removes Keyword Plan ad group - keywords. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupKeywordsRequest`): - The request object. Request message for - [KeywordPlanAdGroupKeywordService.MutateKeywordPlanAdGroupKeywords][google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService.MutateKeywordPlanAdGroupKeywords]. - customer_id (:class:`str`): - Required. The ID of the customer - whose Keyword Plan ad group keywords are - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.KeywordPlanAdGroupKeywordOperation]`): - Required. The list of operations to - perform on individual Keyword Plan ad - group keywords. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupKeywordsResponse: - Response message for a Keyword Plan - ad group keyword mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest, - ): - request = keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_keyword_plan_ad_group_keywords - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordPlanAdGroupKeywordServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/__init__.py deleted file mode 100644 index 4a5bae7e6..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanAdGroupKeywordServiceTransport -from .grpc import KeywordPlanAdGroupKeywordServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanAdGroupKeywordServiceTransport]] -_transport_registry["grpc"] = KeywordPlanAdGroupKeywordServiceGrpcTransport - - -__all__ = ( - "KeywordPlanAdGroupKeywordServiceTransport", - "KeywordPlanAdGroupKeywordServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/base.py deleted file mode 100644 index 703a6a5f7..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/base.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_ad_group_keyword_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanAdGroupKeywordServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanAdGroupKeywordService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_plan_ad_group_keyword: gapic_v1.method.wrap_method( - self.get_keyword_plan_ad_group_keyword, - default_timeout=None, - client_info=client_info, - ), - self.mutate_keyword_plan_ad_group_keywords: gapic_v1.method.wrap_method( - self.mutate_keyword_plan_ad_group_keywords, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_plan_ad_group_keyword( - self, - ) -> typing.Callable[ - [ - keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest - ], - keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword, - ]: - raise NotImplementedError - - @property - def mutate_keyword_plan_ad_group_keywords( - self, - ) -> typing.Callable[ - [ - keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest - ], - keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanAdGroupKeywordServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/grpc.py deleted file mode 100644 index 51fe43ab4..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_keyword_service/transports/grpc.py +++ /dev/null @@ -1,297 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_ad_group_keyword_service, -) - -from .base import KeywordPlanAdGroupKeywordServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordPlanAdGroupKeywordServiceGrpcTransport( - KeywordPlanAdGroupKeywordServiceTransport -): - """gRPC backend transport for KeywordPlanAdGroupKeywordService. - - Service to manage Keyword Plan ad group keywords. - KeywordPlanAdGroup is required to add ad group keywords. - Positive and negative keywords are supported. A maximum of - 10,000 positive keywords are allowed per keyword plan. A maximum - of 1,000 negative keywords are allower per keyword plan. This - includes campaign negative keywords and ad group negative - keywords. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_plan_ad_group_keyword( - self, - ) -> Callable[ - [ - keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest - ], - keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword, - ]: - r"""Return a callable for the get keyword plan ad group - keyword method over gRPC. - - Returns the requested Keyword Plan ad group keyword - in full detail. - - Returns: - Callable[[~.GetKeywordPlanAdGroupKeywordRequest], - ~.KeywordPlanAdGroupKeyword]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_plan_ad_group_keyword" not in self._stubs: - self._stubs[ - "get_keyword_plan_ad_group_keyword" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService/GetKeywordPlanAdGroupKeyword", - request_serializer=keyword_plan_ad_group_keyword_service.GetKeywordPlanAdGroupKeywordRequest.serialize, - response_deserializer=keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword.deserialize, - ) - return self._stubs["get_keyword_plan_ad_group_keyword"] - - @property - def mutate_keyword_plan_ad_group_keywords( - self, - ) -> Callable[ - [ - keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest - ], - keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsResponse, - ]: - r"""Return a callable for the mutate keyword plan ad group - keywords method over gRPC. - - Creates, updates, or removes Keyword Plan ad group - keywords. Operation statuses are returned. - - Returns: - Callable[[~.MutateKeywordPlanAdGroupKeywordsRequest], - ~.MutateKeywordPlanAdGroupKeywordsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_keyword_plan_ad_group_keywords" not in self._stubs: - self._stubs[ - "mutate_keyword_plan_ad_group_keywords" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService/MutateKeywordPlanAdGroupKeywords", - request_serializer=keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsRequest.serialize, - response_deserializer=keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordsResponse.deserialize, - ) - return self._stubs["mutate_keyword_plan_ad_group_keywords"] - - -__all__ = ("KeywordPlanAdGroupKeywordServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/__init__.py deleted file mode 100644 index f71bbf7a4..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanAdGroupServiceClient - -__all__ = ("KeywordPlanAdGroupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/client.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/client.py deleted file mode 100644 index 8b1c91e7b..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/client.py +++ /dev/null @@ -1,568 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan_ad_group -from google.ads.googleads.v6.services.types import keyword_plan_ad_group_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - KeywordPlanAdGroupServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import KeywordPlanAdGroupServiceGrpcTransport - - -class KeywordPlanAdGroupServiceClientMeta(type): - """Metaclass for the KeywordPlanAdGroupService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordPlanAdGroupServiceTransport]] - _transport_registry["grpc"] = KeywordPlanAdGroupServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordPlanAdGroupServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordPlanAdGroupServiceClient( - metaclass=KeywordPlanAdGroupServiceClientMeta -): - """Service to manage Keyword Plan ad groups.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanAdGroupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanAdGroupServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordPlanAdGroupServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordPlanAdGroupServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def keyword_plan_ad_group_path( - customer_id: str, keyword_plan_ad_group_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_ad_group string.""" - return "customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}".format( - customer_id=customer_id, - keyword_plan_ad_group_id=keyword_plan_ad_group_id, - ) - - @staticmethod - def parse_keyword_plan_ad_group_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanAdGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_path( - customer_id: str, keyword_plan_campaign_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign string.""" - return "customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}".format( - customer_id=customer_id, - keyword_plan_campaign_id=keyword_plan_campaign_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, KeywordPlanAdGroupServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword plan ad group service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordPlanAdGroupServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanAdGroupServiceTransport): - # transport is a KeywordPlanAdGroupServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordPlanAdGroupServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_keyword_plan_ad_group( - self, - request: keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_ad_group.KeywordPlanAdGroup: - r"""Returns the requested Keyword Plan ad group in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordPlanAdGroupRequest`): - The request object. Request message for - [KeywordPlanAdGroupService.GetKeywordPlanAdGroup][google.ads.googleads.v6.services.KeywordPlanAdGroupService.GetKeywordPlanAdGroup]. - resource_name (:class:`str`): - Required. The resource name of the - Keyword Plan ad group to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.KeywordPlanAdGroup: - A Keyword Planner ad group. - Max number of keyword plan ad groups per - plan: 200. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest - ): - request = keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_keyword_plan_ad_group - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_keyword_plan_ad_groups( - self, - request: keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - keyword_plan_ad_group_service.KeywordPlanAdGroupOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsResponse: - r"""Creates, updates, or removes Keyword Plan ad groups. - Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupsRequest`): - The request object. Request message for - [KeywordPlanAdGroupService.MutateKeywordPlanAdGroups][google.ads.googleads.v6.services.KeywordPlanAdGroupService.MutateKeywordPlanAdGroups]. - customer_id (:class:`str`): - Required. The ID of the customer - whose Keyword Plan ad groups are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.KeywordPlanAdGroupOperation]`): - Required. The list of operations to - perform on individual Keyword Plan ad - groups. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupsResponse: - Response message for a Keyword Plan - ad group mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest, - ): - request = keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_keyword_plan_ad_groups - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordPlanAdGroupServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/__init__.py deleted file mode 100644 index a3688622a..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanAdGroupServiceTransport -from .grpc import KeywordPlanAdGroupServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanAdGroupServiceTransport]] -_transport_registry["grpc"] = KeywordPlanAdGroupServiceGrpcTransport - - -__all__ = ( - "KeywordPlanAdGroupServiceTransport", - "KeywordPlanAdGroupServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/base.py deleted file mode 100644 index 24476a6ba..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan_ad_group -from google.ads.googleads.v6.services.types import keyword_plan_ad_group_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanAdGroupServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanAdGroupService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_plan_ad_group: gapic_v1.method.wrap_method( - self.get_keyword_plan_ad_group, - default_timeout=None, - client_info=client_info, - ), - self.mutate_keyword_plan_ad_groups: gapic_v1.method.wrap_method( - self.mutate_keyword_plan_ad_groups, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_plan_ad_group( - self, - ) -> typing.Callable[ - [keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest], - keyword_plan_ad_group.KeywordPlanAdGroup, - ]: - raise NotImplementedError - - @property - def mutate_keyword_plan_ad_groups( - self, - ) -> typing.Callable[ - [keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest], - keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanAdGroupServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/grpc.py deleted file mode 100644 index b94fba4e4..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_ad_group_service/transports/grpc.py +++ /dev/null @@ -1,281 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan_ad_group -from google.ads.googleads.v6.services.types import keyword_plan_ad_group_service - -from .base import KeywordPlanAdGroupServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordPlanAdGroupServiceGrpcTransport( - KeywordPlanAdGroupServiceTransport -): - """gRPC backend transport for KeywordPlanAdGroupService. - - Service to manage Keyword Plan ad groups. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_plan_ad_group( - self, - ) -> Callable[ - [keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest], - keyword_plan_ad_group.KeywordPlanAdGroup, - ]: - r"""Return a callable for the get keyword plan ad group method over gRPC. - - Returns the requested Keyword Plan ad group in full - detail. - - Returns: - Callable[[~.GetKeywordPlanAdGroupRequest], - ~.KeywordPlanAdGroup]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_plan_ad_group" not in self._stubs: - self._stubs[ - "get_keyword_plan_ad_group" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanAdGroupService/GetKeywordPlanAdGroup", - request_serializer=keyword_plan_ad_group_service.GetKeywordPlanAdGroupRequest.serialize, - response_deserializer=keyword_plan_ad_group.KeywordPlanAdGroup.deserialize, - ) - return self._stubs["get_keyword_plan_ad_group"] - - @property - def mutate_keyword_plan_ad_groups( - self, - ) -> Callable[ - [keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest], - keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsResponse, - ]: - r"""Return a callable for the mutate keyword plan ad groups method over gRPC. - - Creates, updates, or removes Keyword Plan ad groups. - Operation statuses are returned. - - Returns: - Callable[[~.MutateKeywordPlanAdGroupsRequest], - ~.MutateKeywordPlanAdGroupsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_keyword_plan_ad_groups" not in self._stubs: - self._stubs[ - "mutate_keyword_plan_ad_groups" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanAdGroupService/MutateKeywordPlanAdGroups", - request_serializer=keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsRequest.serialize, - response_deserializer=keyword_plan_ad_group_service.MutateKeywordPlanAdGroupsResponse.deserialize, - ) - return self._stubs["mutate_keyword_plan_ad_groups"] - - -__all__ = ("KeywordPlanAdGroupServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/__init__.py deleted file mode 100644 index 9830ef1bd..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanCampaignKeywordServiceClient - -__all__ = ("KeywordPlanCampaignKeywordServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/client.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/client.py deleted file mode 100644 index bf8921ba1..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/client.py +++ /dev/null @@ -1,579 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_campaign_keyword_service, -) -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - KeywordPlanCampaignKeywordServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import KeywordPlanCampaignKeywordServiceGrpcTransport - - -class KeywordPlanCampaignKeywordServiceClientMeta(type): - """Metaclass for the KeywordPlanCampaignKeywordService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordPlanCampaignKeywordServiceTransport]] - _transport_registry["grpc"] = KeywordPlanCampaignKeywordServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordPlanCampaignKeywordServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordPlanCampaignKeywordServiceClient( - metaclass=KeywordPlanCampaignKeywordServiceClientMeta -): - """Service to manage Keyword Plan campaign keywords. - KeywordPlanCampaign is required to add the campaign keywords. - Only negative keywords are supported. A maximum of 1000 negative - keywords are allowed per plan. This includes both campaign - negative keywords and ad group negative keywords. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanCampaignKeywordServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanCampaignKeywordServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordPlanCampaignKeywordServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordPlanCampaignKeywordServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def keyword_plan_campaign_path( - customer_id: str, keyword_plan_campaign_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign string.""" - return "customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}".format( - customer_id=customer_id, - keyword_plan_campaign_id=keyword_plan_campaign_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def keyword_plan_campaign_keyword_path( - customer_id: str, keyword_plan_campaign_keyword_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign_keyword string.""" - return "customers/{customer_id}/keywordPlanCampaignKeywords/{keyword_plan_campaign_keyword_id}".format( - customer_id=customer_id, - keyword_plan_campaign_keyword_id=keyword_plan_campaign_keyword_id, - ) - - @staticmethod - def parse_keyword_plan_campaign_keyword_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign_keyword path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaignKeywords/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, KeywordPlanCampaignKeywordServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword plan campaign keyword service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordPlanCampaignKeywordServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanCampaignKeywordServiceTransport): - # transport is a KeywordPlanCampaignKeywordServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordPlanCampaignKeywordServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_keyword_plan_campaign_keyword( - self, - request: keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword: - r"""Returns the requested plan in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordPlanCampaignKeywordRequest`): - The request object. Request message for - [KeywordPlanCampaignKeywordService.GetKeywordPlanCampaignKeyword][google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService.GetKeywordPlanCampaignKeyword]. - resource_name (:class:`str`): - Required. The resource name of the - plan to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.KeywordPlanCampaignKeyword: - A Keyword Plan Campaign keyword. - Only negative keywords are supported for - Campaign Keyword. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest, - ): - request = keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_keyword_plan_campaign_keyword - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_keyword_plan_campaign_keywords( - self, - request: keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - keyword_plan_campaign_keyword_service.KeywordPlanCampaignKeywordOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsResponse: - r"""Creates, updates, or removes Keyword Plan campaign - keywords. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignKeywordsRequest`): - The request object. Request message for - [KeywordPlanCampaignKeywordService.MutateKeywordPlanCampaignKeywords][google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService.MutateKeywordPlanCampaignKeywords]. - customer_id (:class:`str`): - Required. The ID of the customer - whose campaign keywords are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignKeywordOperation]`): - Required. The list of operations to - perform on individual Keyword Plan - campaign keywords. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignKeywordsResponse: - Response message for a Keyword Plan - campaign keyword mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest, - ): - request = keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_keyword_plan_campaign_keywords - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordPlanCampaignKeywordServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/__init__.py deleted file mode 100644 index 55a8df12c..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanCampaignKeywordServiceTransport -from .grpc import KeywordPlanCampaignKeywordServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanCampaignKeywordServiceTransport]] -_transport_registry["grpc"] = KeywordPlanCampaignKeywordServiceGrpcTransport - - -__all__ = ( - "KeywordPlanCampaignKeywordServiceTransport", - "KeywordPlanCampaignKeywordServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/base.py deleted file mode 100644 index 03353801c..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/base.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_campaign_keyword_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanCampaignKeywordServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanCampaignKeywordService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_plan_campaign_keyword: gapic_v1.method.wrap_method( - self.get_keyword_plan_campaign_keyword, - default_timeout=None, - client_info=client_info, - ), - self.mutate_keyword_plan_campaign_keywords: gapic_v1.method.wrap_method( - self.mutate_keyword_plan_campaign_keywords, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_plan_campaign_keyword( - self, - ) -> typing.Callable[ - [ - keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest - ], - keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword, - ]: - raise NotImplementedError - - @property - def mutate_keyword_plan_campaign_keywords( - self, - ) -> typing.Callable[ - [ - keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest - ], - keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanCampaignKeywordServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/grpc.py deleted file mode 100644 index 4082b5fe1..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_keyword_service/transports/grpc.py +++ /dev/null @@ -1,297 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign_keyword, -) -from google.ads.googleads.v6.services.types import ( - keyword_plan_campaign_keyword_service, -) - -from .base import ( - KeywordPlanCampaignKeywordServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class KeywordPlanCampaignKeywordServiceGrpcTransport( - KeywordPlanCampaignKeywordServiceTransport -): - """gRPC backend transport for KeywordPlanCampaignKeywordService. - - Service to manage Keyword Plan campaign keywords. - KeywordPlanCampaign is required to add the campaign keywords. - Only negative keywords are supported. A maximum of 1000 negative - keywords are allowed per plan. This includes both campaign - negative keywords and ad group negative keywords. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_plan_campaign_keyword( - self, - ) -> Callable[ - [ - keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest - ], - keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword, - ]: - r"""Return a callable for the get keyword plan campaign - keyword method over gRPC. - - Returns the requested plan in full detail. - - Returns: - Callable[[~.GetKeywordPlanCampaignKeywordRequest], - ~.KeywordPlanCampaignKeyword]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_plan_campaign_keyword" not in self._stubs: - self._stubs[ - "get_keyword_plan_campaign_keyword" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService/GetKeywordPlanCampaignKeyword", - request_serializer=keyword_plan_campaign_keyword_service.GetKeywordPlanCampaignKeywordRequest.serialize, - response_deserializer=keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword.deserialize, - ) - return self._stubs["get_keyword_plan_campaign_keyword"] - - @property - def mutate_keyword_plan_campaign_keywords( - self, - ) -> Callable[ - [ - keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest - ], - keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsResponse, - ]: - r"""Return a callable for the mutate keyword plan campaign - keywords method over gRPC. - - Creates, updates, or removes Keyword Plan campaign - keywords. Operation statuses are returned. - - Returns: - Callable[[~.MutateKeywordPlanCampaignKeywordsRequest], - ~.MutateKeywordPlanCampaignKeywordsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_keyword_plan_campaign_keywords" not in self._stubs: - self._stubs[ - "mutate_keyword_plan_campaign_keywords" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService/MutateKeywordPlanCampaignKeywords", - request_serializer=keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsRequest.serialize, - response_deserializer=keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordsResponse.deserialize, - ) - return self._stubs["mutate_keyword_plan_campaign_keywords"] - - -__all__ = ("KeywordPlanCampaignKeywordServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/__init__.py deleted file mode 100644 index 5ff083c48..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanCampaignServiceClient - -__all__ = ("KeywordPlanCampaignServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/__init__.py deleted file mode 100644 index c333a62e8..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanCampaignServiceTransport -from .grpc import KeywordPlanCampaignServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanCampaignServiceTransport]] -_transport_registry["grpc"] = KeywordPlanCampaignServiceGrpcTransport - - -__all__ = ( - "KeywordPlanCampaignServiceTransport", - "KeywordPlanCampaignServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/base.py deleted file mode 100644 index 2a95a745b..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan_campaign -from google.ads.googleads.v6.services.types import keyword_plan_campaign_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanCampaignServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanCampaignService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_plan_campaign: gapic_v1.method.wrap_method( - self.get_keyword_plan_campaign, - default_timeout=None, - client_info=client_info, - ), - self.mutate_keyword_plan_campaigns: gapic_v1.method.wrap_method( - self.mutate_keyword_plan_campaigns, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_plan_campaign( - self, - ) -> typing.Callable[ - [keyword_plan_campaign_service.GetKeywordPlanCampaignRequest], - keyword_plan_campaign.KeywordPlanCampaign, - ]: - raise NotImplementedError - - @property - def mutate_keyword_plan_campaigns( - self, - ) -> typing.Callable[ - [keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest], - keyword_plan_campaign_service.MutateKeywordPlanCampaignsResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanCampaignServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/grpc.py deleted file mode 100644 index b19ee392c..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/transports/grpc.py +++ /dev/null @@ -1,281 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan_campaign -from google.ads.googleads.v6.services.types import keyword_plan_campaign_service - -from .base import KeywordPlanCampaignServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordPlanCampaignServiceGrpcTransport( - KeywordPlanCampaignServiceTransport -): - """gRPC backend transport for KeywordPlanCampaignService. - - Service to manage Keyword Plan campaigns. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_plan_campaign( - self, - ) -> Callable[ - [keyword_plan_campaign_service.GetKeywordPlanCampaignRequest], - keyword_plan_campaign.KeywordPlanCampaign, - ]: - r"""Return a callable for the get keyword plan campaign method over gRPC. - - Returns the requested Keyword Plan campaign in full - detail. - - Returns: - Callable[[~.GetKeywordPlanCampaignRequest], - ~.KeywordPlanCampaign]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_plan_campaign" not in self._stubs: - self._stubs[ - "get_keyword_plan_campaign" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanCampaignService/GetKeywordPlanCampaign", - request_serializer=keyword_plan_campaign_service.GetKeywordPlanCampaignRequest.serialize, - response_deserializer=keyword_plan_campaign.KeywordPlanCampaign.deserialize, - ) - return self._stubs["get_keyword_plan_campaign"] - - @property - def mutate_keyword_plan_campaigns( - self, - ) -> Callable[ - [keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest], - keyword_plan_campaign_service.MutateKeywordPlanCampaignsResponse, - ]: - r"""Return a callable for the mutate keyword plan campaigns method over gRPC. - - Creates, updates, or removes Keyword Plan campaigns. - Operation statuses are returned. - - Returns: - Callable[[~.MutateKeywordPlanCampaignsRequest], - ~.MutateKeywordPlanCampaignsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_keyword_plan_campaigns" not in self._stubs: - self._stubs[ - "mutate_keyword_plan_campaigns" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanCampaignService/MutateKeywordPlanCampaigns", - request_serializer=keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest.serialize, - response_deserializer=keyword_plan_campaign_service.MutateKeywordPlanCampaignsResponse.deserialize, - ) - return self._stubs["mutate_keyword_plan_campaigns"] - - -__all__ = ("KeywordPlanCampaignServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/__init__.py deleted file mode 100644 index cff6fa4f9..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanIdeaServiceClient - -__all__ = ("KeywordPlanIdeaServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/client.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/client.py deleted file mode 100644 index 1110377ae..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/client.py +++ /dev/null @@ -1,416 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.services.keyword_plan_idea_service import ( - pagers, -) -from google.ads.googleads.v6.services.types import keyword_plan_idea_service - -from .transports.base import ( - KeywordPlanIdeaServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import KeywordPlanIdeaServiceGrpcTransport - - -class KeywordPlanIdeaServiceClientMeta(type): - """Metaclass for the KeywordPlanIdeaService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordPlanIdeaServiceTransport]] - _transport_registry["grpc"] = KeywordPlanIdeaServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordPlanIdeaServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordPlanIdeaServiceClient(metaclass=KeywordPlanIdeaServiceClientMeta): - """Service to generate keyword ideas.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanIdeaServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanIdeaServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordPlanIdeaServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordPlanIdeaServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, KeywordPlanIdeaServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword plan idea service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordPlanIdeaServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanIdeaServiceTransport): - # transport is a KeywordPlanIdeaServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordPlanIdeaServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def generate_keyword_ideas( - self, - request: keyword_plan_idea_service.GenerateKeywordIdeasRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.GenerateKeywordIdeasPager: - r"""Returns a list of keyword ideas. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateKeywordIdeasRequest`): - The request object. Request message for - [KeywordPlanIdeaService.GenerateKeywordIdeas][google.ads.googleads.v6.services.KeywordPlanIdeaService.GenerateKeywordIdeas]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.services.keyword_plan_idea_service.pagers.GenerateKeywordIdeasPager: - Response message for - [KeywordPlanIdeaService.GenerateKeywordIdeas][google.ads.googleads.v6.services.KeywordPlanIdeaService.GenerateKeywordIdeas]. - - Iterating over this object will yield results and - resolve additional pages automatically. - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_idea_service.GenerateKeywordIdeasRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_idea_service.GenerateKeywordIdeasRequest - ): - request = keyword_plan_idea_service.GenerateKeywordIdeasRequest( - request - ) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_keyword_ideas - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.GenerateKeywordIdeasPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordPlanIdeaServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/pagers.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/pagers.py deleted file mode 100644 index c960e3a8e..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/pagers.py +++ /dev/null @@ -1,91 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from typing import Any, Callable, Iterable, Sequence, Tuple - -from google.ads.googleads.v6.services.types import keyword_plan_idea_service - - -class GenerateKeywordIdeasPager: - """A pager for iterating through ``generate_keyword_ideas`` requests. - - This class thinly wraps an initial - :class:`google.ads.googleads.v6.services.types.GenerateKeywordIdeaResponse` object, and - provides an ``__iter__`` method to iterate through its - ``results`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``GenerateKeywordIdeas`` requests and continue to iterate - through the ``results`` field on the - corresponding responses. - - All the usual :class:`google.ads.googleads.v6.services.types.GenerateKeywordIdeaResponse` - attributes are available on the pager. If multiple requests are made, only - the most recent response is retained, and thus used for attribute lookup. - """ - - def __init__( - self, - method: Callable[ - ..., keyword_plan_idea_service.GenerateKeywordIdeaResponse - ], - request: keyword_plan_idea_service.GenerateKeywordIdeasRequest, - response: keyword_plan_idea_service.GenerateKeywordIdeaResponse, - metadata: Sequence[Tuple[str, str]] = (), - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (:class:`google.ads.googleads.v6.services.types.GenerateKeywordIdeasRequest`): - The initial request object. - response (:class:`google.ads.googleads.v6.services.types.GenerateKeywordIdeaResponse`): - The initial response object. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - """ - self._method = method - self._request = keyword_plan_idea_service.GenerateKeywordIdeasRequest( - request - ) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages( - self, - ) -> Iterable[keyword_plan_idea_service.GenerateKeywordIdeaResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = self._method( - self._request, metadata=self._metadata - ) - yield self._response - - def __iter__( - self, - ) -> Iterable[keyword_plan_idea_service.GenerateKeywordIdeaResult]: - for page in self.pages: - yield from page.results - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/__init__.py deleted file mode 100644 index 8e1b00256..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanIdeaServiceTransport -from .grpc import KeywordPlanIdeaServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanIdeaServiceTransport]] -_transport_registry["grpc"] = KeywordPlanIdeaServiceGrpcTransport - - -__all__ = ( - "KeywordPlanIdeaServiceTransport", - "KeywordPlanIdeaServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/base.py deleted file mode 100644 index c96e2ddf9..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import keyword_plan_idea_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanIdeaServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanIdeaService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.generate_keyword_ideas: gapic_v1.method.wrap_method( - self.generate_keyword_ideas, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def generate_keyword_ideas( - self, - ) -> typing.Callable[ - [keyword_plan_idea_service.GenerateKeywordIdeasRequest], - keyword_plan_idea_service.GenerateKeywordIdeaResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanIdeaServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/grpc.py deleted file mode 100644 index 0fad1d4b7..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_idea_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import keyword_plan_idea_service - -from .base import KeywordPlanIdeaServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordPlanIdeaServiceGrpcTransport(KeywordPlanIdeaServiceTransport): - """gRPC backend transport for KeywordPlanIdeaService. - - Service to generate keyword ideas. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def generate_keyword_ideas( - self, - ) -> Callable[ - [keyword_plan_idea_service.GenerateKeywordIdeasRequest], - keyword_plan_idea_service.GenerateKeywordIdeaResponse, - ]: - r"""Return a callable for the generate keyword ideas method over gRPC. - - Returns a list of keyword ideas. - - Returns: - Callable[[~.GenerateKeywordIdeasRequest], - ~.GenerateKeywordIdeaResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_keyword_ideas" not in self._stubs: - self._stubs[ - "generate_keyword_ideas" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanIdeaService/GenerateKeywordIdeas", - request_serializer=keyword_plan_idea_service.GenerateKeywordIdeasRequest.serialize, - response_deserializer=keyword_plan_idea_service.GenerateKeywordIdeaResponse.deserialize, - ) - return self._stubs["generate_keyword_ideas"] - - -__all__ = ("KeywordPlanIdeaServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_service/__init__.py deleted file mode 100644 index 2db55a33f..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordPlanServiceClient - -__all__ = ("KeywordPlanServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_service/client.py b/google/ads/googleads/v6/services/services/keyword_plan_service/client.py deleted file mode 100644 index c5d75dcb2..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_service/client.py +++ /dev/null @@ -1,873 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan -from google.ads.googleads.v6.services.types import keyword_plan_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import KeywordPlanServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import KeywordPlanServiceGrpcTransport - - -class KeywordPlanServiceClientMeta(type): - """Metaclass for the KeywordPlanService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordPlanServiceTransport]] - _transport_registry["grpc"] = KeywordPlanServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordPlanServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordPlanServiceClient(metaclass=KeywordPlanServiceClientMeta): - """Service to manage keyword plans.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordPlanServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordPlanServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordPlanServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def keyword_plan_path(customer_id: str, keyword_plan_id: str,) -> str: - """Return a fully-qualified keyword_plan string.""" - return "customers/{customer_id}/keywordPlans/{keyword_plan_id}".format( - customer_id=customer_id, keyword_plan_id=keyword_plan_id, - ) - - @staticmethod - def parse_keyword_plan_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordPlans/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, KeywordPlanServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword plan service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordPlanServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanServiceTransport): - # transport is a KeywordPlanServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordPlanServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_keyword_plan( - self, - request: keyword_plan_service.GetKeywordPlanRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan.KeywordPlan: - r"""Returns the requested plan in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordPlanRequest`): - The request object. Request message for - [KeywordPlanService.GetKeywordPlan][google.ads.googleads.v6.services.KeywordPlanService.GetKeywordPlan]. - resource_name (:class:`str`): - Required. The resource name of the - plan to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.KeywordPlan: - A Keyword Planner plan. - Max number of saved keyword plans: - 10000. - It's possible to remove plans if limit - is reached. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.GetKeywordPlanRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, keyword_plan_service.GetKeywordPlanRequest): - request = keyword_plan_service.GetKeywordPlanRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_keyword_plan] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_keyword_plans( - self, - request: keyword_plan_service.MutateKeywordPlansRequest = None, - *, - customer_id: str = None, - operations: Sequence[keyword_plan_service.KeywordPlanOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_service.MutateKeywordPlansResponse: - r"""Creates, updates, or removes keyword plans. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateKeywordPlansRequest`): - The request object. Request message for - [KeywordPlanService.MutateKeywordPlans][google.ads.googleads.v6.services.KeywordPlanService.MutateKeywordPlans]. - customer_id (:class:`str`): - Required. The ID of the customer - whose keyword plans are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.KeywordPlanOperation]`): - Required. The list of operations to - perform on individual keyword plans. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateKeywordPlansResponse: - Response message for a keyword plan - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.MutateKeywordPlansRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_service.MutateKeywordPlansRequest - ): - request = keyword_plan_service.MutateKeywordPlansRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_keyword_plans - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_forecast_curve( - self, - request: keyword_plan_service.GenerateForecastCurveRequest = None, - *, - keyword_plan: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_service.GenerateForecastCurveResponse: - r"""Returns the requested Keyword Plan forecast curve. - Only the bidding strategy is considered for generating - forecast curve. The bidding strategy value specified in - the plan is ignored. - To generate a forecast at a value specified in the plan, - use KeywordPlanService.GenerateForecastMetrics. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateForecastCurveRequest`): - The request object. Request message for - [KeywordPlanService.GenerateForecastCurve][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastCurve]. - keyword_plan (:class:`str`): - Required. The resource name of the - keyword plan to be forecasted. - - This corresponds to the ``keyword_plan`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateForecastCurveResponse: - Response message for - [KeywordPlanService.GenerateForecastCurve][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastCurve]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([keyword_plan]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.GenerateForecastCurveRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_service.GenerateForecastCurveRequest - ): - request = keyword_plan_service.GenerateForecastCurveRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if keyword_plan is not None: - request.keyword_plan = keyword_plan - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_forecast_curve - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("keyword_plan", request.keyword_plan),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_forecast_time_series( - self, - request: keyword_plan_service.GenerateForecastTimeSeriesRequest = None, - *, - keyword_plan: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_service.GenerateForecastTimeSeriesResponse: - r"""Returns a forecast in the form of a time series for - the Keyword Plan over the next 52 weeks. - (1) Forecasts closer to the current date are generally - more accurate than further out. - - (2) The forecast reflects seasonal trends using current - and prior traffic patterns. The forecast period of the - plan is ignored. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateForecastTimeSeriesRequest`): - The request object. Request message for - [KeywordPlanService.GenerateForecastTimeSeries][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastTimeSeries]. - keyword_plan (:class:`str`): - Required. The resource name of the - keyword plan to be forecasted. - - This corresponds to the ``keyword_plan`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateForecastTimeSeriesResponse: - Response message for - [KeywordPlanService.GenerateForecastTimeSeries][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastTimeSeries]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([keyword_plan]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.GenerateForecastTimeSeriesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_service.GenerateForecastTimeSeriesRequest - ): - request = keyword_plan_service.GenerateForecastTimeSeriesRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if keyword_plan is not None: - request.keyword_plan = keyword_plan - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_forecast_time_series - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("keyword_plan", request.keyword_plan),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_forecast_metrics( - self, - request: keyword_plan_service.GenerateForecastMetricsRequest = None, - *, - keyword_plan: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_service.GenerateForecastMetricsResponse: - r"""Returns the requested Keyword Plan forecasts. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateForecastMetricsRequest`): - The request object. Request message for - [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastMetrics]. - keyword_plan (:class:`str`): - Required. The resource name of the - keyword plan to be forecasted. - - This corresponds to the ``keyword_plan`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateForecastMetricsResponse: - Response message for - [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastMetrics]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([keyword_plan]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.GenerateForecastMetricsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_service.GenerateForecastMetricsRequest - ): - request = keyword_plan_service.GenerateForecastMetricsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if keyword_plan is not None: - request.keyword_plan = keyword_plan - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_forecast_metrics - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("keyword_plan", request.keyword_plan),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_historical_metrics( - self, - request: keyword_plan_service.GenerateHistoricalMetricsRequest = None, - *, - keyword_plan: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_service.GenerateHistoricalMetricsResponse: - r"""Returns the requested Keyword Plan historical - metrics. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateHistoricalMetricsRequest`): - The request object. Request message for - [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateHistoricalMetrics]. - keyword_plan (:class:`str`): - Required. The resource name of the - keyword plan of which historical metrics - are requested. - - This corresponds to the ``keyword_plan`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateHistoricalMetricsResponse: - Response message for - [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateHistoricalMetrics]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([keyword_plan]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_service.GenerateHistoricalMetricsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, keyword_plan_service.GenerateHistoricalMetricsRequest - ): - request = keyword_plan_service.GenerateHistoricalMetricsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if keyword_plan is not None: - request.keyword_plan = keyword_plan - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_historical_metrics - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("keyword_plan", request.keyword_plan),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordPlanServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_plan_service/transports/__init__.py deleted file mode 100644 index 6cb3ac1e0..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordPlanServiceTransport -from .grpc import KeywordPlanServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordPlanServiceTransport]] -_transport_registry["grpc"] = KeywordPlanServiceGrpcTransport - - -__all__ = ( - "KeywordPlanServiceTransport", - "KeywordPlanServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_plan_service/transports/base.py deleted file mode 100644 index f2dfc1f21..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/base.py +++ /dev/null @@ -1,171 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan -from google.ads.googleads.v6.services.types import keyword_plan_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordPlanServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordPlanService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_plan: gapic_v1.method.wrap_method( - self.get_keyword_plan, - default_timeout=None, - client_info=client_info, - ), - self.mutate_keyword_plans: gapic_v1.method.wrap_method( - self.mutate_keyword_plans, - default_timeout=None, - client_info=client_info, - ), - self.generate_forecast_curve: gapic_v1.method.wrap_method( - self.generate_forecast_curve, - default_timeout=None, - client_info=client_info, - ), - self.generate_forecast_time_series: gapic_v1.method.wrap_method( - self.generate_forecast_time_series, - default_timeout=None, - client_info=client_info, - ), - self.generate_forecast_metrics: gapic_v1.method.wrap_method( - self.generate_forecast_metrics, - default_timeout=None, - client_info=client_info, - ), - self.generate_historical_metrics: gapic_v1.method.wrap_method( - self.generate_historical_metrics, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_plan( - self, - ) -> typing.Callable[ - [keyword_plan_service.GetKeywordPlanRequest], keyword_plan.KeywordPlan - ]: - raise NotImplementedError - - @property - def mutate_keyword_plans( - self, - ) -> typing.Callable[ - [keyword_plan_service.MutateKeywordPlansRequest], - keyword_plan_service.MutateKeywordPlansResponse, - ]: - raise NotImplementedError - - @property - def generate_forecast_curve( - self, - ) -> typing.Callable[ - [keyword_plan_service.GenerateForecastCurveRequest], - keyword_plan_service.GenerateForecastCurveResponse, - ]: - raise NotImplementedError - - @property - def generate_forecast_time_series( - self, - ) -> typing.Callable[ - [keyword_plan_service.GenerateForecastTimeSeriesRequest], - keyword_plan_service.GenerateForecastTimeSeriesResponse, - ]: - raise NotImplementedError - - @property - def generate_forecast_metrics( - self, - ) -> typing.Callable[ - [keyword_plan_service.GenerateForecastMetricsRequest], - keyword_plan_service.GenerateForecastMetricsResponse, - ]: - raise NotImplementedError - - @property - def generate_historical_metrics( - self, - ) -> typing.Callable[ - [keyword_plan_service.GenerateHistoricalMetricsRequest], - keyword_plan_service.GenerateHistoricalMetricsResponse, - ]: - raise NotImplementedError - - -__all__ = ("KeywordPlanServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_plan_service/transports/grpc.py deleted file mode 100644 index 70de91c14..000000000 --- a/google/ads/googleads/v6/services/services/keyword_plan_service/transports/grpc.py +++ /dev/null @@ -1,410 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_plan -from google.ads.googleads.v6.services.types import keyword_plan_service - -from .base import KeywordPlanServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordPlanServiceGrpcTransport(KeywordPlanServiceTransport): - """gRPC backend transport for KeywordPlanService. - - Service to manage keyword plans. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_plan( - self, - ) -> Callable[ - [keyword_plan_service.GetKeywordPlanRequest], keyword_plan.KeywordPlan - ]: - r"""Return a callable for the get keyword plan method over gRPC. - - Returns the requested plan in full detail. - - Returns: - Callable[[~.GetKeywordPlanRequest], - ~.KeywordPlan]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_plan" not in self._stubs: - self._stubs["get_keyword_plan"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/GetKeywordPlan", - request_serializer=keyword_plan_service.GetKeywordPlanRequest.serialize, - response_deserializer=keyword_plan.KeywordPlan.deserialize, - ) - return self._stubs["get_keyword_plan"] - - @property - def mutate_keyword_plans( - self, - ) -> Callable[ - [keyword_plan_service.MutateKeywordPlansRequest], - keyword_plan_service.MutateKeywordPlansResponse, - ]: - r"""Return a callable for the mutate keyword plans method over gRPC. - - Creates, updates, or removes keyword plans. Operation - statuses are returned. - - Returns: - Callable[[~.MutateKeywordPlansRequest], - ~.MutateKeywordPlansResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_keyword_plans" not in self._stubs: - self._stubs["mutate_keyword_plans"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/MutateKeywordPlans", - request_serializer=keyword_plan_service.MutateKeywordPlansRequest.serialize, - response_deserializer=keyword_plan_service.MutateKeywordPlansResponse.deserialize, - ) - return self._stubs["mutate_keyword_plans"] - - @property - def generate_forecast_curve( - self, - ) -> Callable[ - [keyword_plan_service.GenerateForecastCurveRequest], - keyword_plan_service.GenerateForecastCurveResponse, - ]: - r"""Return a callable for the generate forecast curve method over gRPC. - - Returns the requested Keyword Plan forecast curve. - Only the bidding strategy is considered for generating - forecast curve. The bidding strategy value specified in - the plan is ignored. - To generate a forecast at a value specified in the plan, - use KeywordPlanService.GenerateForecastMetrics. - - Returns: - Callable[[~.GenerateForecastCurveRequest], - ~.GenerateForecastCurveResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_forecast_curve" not in self._stubs: - self._stubs[ - "generate_forecast_curve" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/GenerateForecastCurve", - request_serializer=keyword_plan_service.GenerateForecastCurveRequest.serialize, - response_deserializer=keyword_plan_service.GenerateForecastCurveResponse.deserialize, - ) - return self._stubs["generate_forecast_curve"] - - @property - def generate_forecast_time_series( - self, - ) -> Callable[ - [keyword_plan_service.GenerateForecastTimeSeriesRequest], - keyword_plan_service.GenerateForecastTimeSeriesResponse, - ]: - r"""Return a callable for the generate forecast time series method over gRPC. - - Returns a forecast in the form of a time series for - the Keyword Plan over the next 52 weeks. - (1) Forecasts closer to the current date are generally - more accurate than further out. - - (2) The forecast reflects seasonal trends using current - and prior traffic patterns. The forecast period of the - plan is ignored. - - Returns: - Callable[[~.GenerateForecastTimeSeriesRequest], - ~.GenerateForecastTimeSeriesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_forecast_time_series" not in self._stubs: - self._stubs[ - "generate_forecast_time_series" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/GenerateForecastTimeSeries", - request_serializer=keyword_plan_service.GenerateForecastTimeSeriesRequest.serialize, - response_deserializer=keyword_plan_service.GenerateForecastTimeSeriesResponse.deserialize, - ) - return self._stubs["generate_forecast_time_series"] - - @property - def generate_forecast_metrics( - self, - ) -> Callable[ - [keyword_plan_service.GenerateForecastMetricsRequest], - keyword_plan_service.GenerateForecastMetricsResponse, - ]: - r"""Return a callable for the generate forecast metrics method over gRPC. - - Returns the requested Keyword Plan forecasts. - - Returns: - Callable[[~.GenerateForecastMetricsRequest], - ~.GenerateForecastMetricsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_forecast_metrics" not in self._stubs: - self._stubs[ - "generate_forecast_metrics" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/GenerateForecastMetrics", - request_serializer=keyword_plan_service.GenerateForecastMetricsRequest.serialize, - response_deserializer=keyword_plan_service.GenerateForecastMetricsResponse.deserialize, - ) - return self._stubs["generate_forecast_metrics"] - - @property - def generate_historical_metrics( - self, - ) -> Callable[ - [keyword_plan_service.GenerateHistoricalMetricsRequest], - keyword_plan_service.GenerateHistoricalMetricsResponse, - ]: - r"""Return a callable for the generate historical metrics method over gRPC. - - Returns the requested Keyword Plan historical - metrics. - - Returns: - Callable[[~.GenerateHistoricalMetricsRequest], - ~.GenerateHistoricalMetricsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_historical_metrics" not in self._stubs: - self._stubs[ - "generate_historical_metrics" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordPlanService/GenerateHistoricalMetrics", - request_serializer=keyword_plan_service.GenerateHistoricalMetricsRequest.serialize, - response_deserializer=keyword_plan_service.GenerateHistoricalMetricsResponse.deserialize, - ) - return self._stubs["generate_historical_metrics"] - - -__all__ = ("KeywordPlanServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_view_service/__init__.py b/google/ads/googleads/v6/services/services/keyword_view_service/__init__.py deleted file mode 100644 index ee5fe66f0..000000000 --- a/google/ads/googleads/v6/services/services/keyword_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import KeywordViewServiceClient - -__all__ = ("KeywordViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_view_service/client.py b/google/ads/googleads/v6/services/services/keyword_view_service/client.py deleted file mode 100644 index 21ba2af65..000000000 --- a/google/ads/googleads/v6/services/services/keyword_view_service/client.py +++ /dev/null @@ -1,435 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_view -from google.ads.googleads.v6.services.types import keyword_view_service - -from .transports.base import KeywordViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import KeywordViewServiceGrpcTransport - - -class KeywordViewServiceClientMeta(type): - """Metaclass for the KeywordViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[KeywordViewServiceTransport]] - _transport_registry["grpc"] = KeywordViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[KeywordViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class KeywordViewServiceClient(metaclass=KeywordViewServiceClientMeta): - """Service to manage keyword views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - KeywordViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> KeywordViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - KeywordViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def keyword_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified keyword_view string.""" - return "customers/{customer_id}/keywordViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_keyword_view_path(path: str) -> Dict[str, str]: - """Parse a keyword_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/keywordViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, KeywordViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the keyword view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.KeywordViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordViewServiceTransport): - # transport is a KeywordViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = KeywordViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_keyword_view( - self, - request: keyword_view_service.GetKeywordViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_view.KeywordView: - r"""Returns the requested keyword view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordViewRequest`): - The request object. Request message for - [KeywordViewService.GetKeywordView][google.ads.googleads.v6.services.KeywordViewService.GetKeywordView]. - resource_name (:class:`str`): - Required. The resource name of the - keyword view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.KeywordView: - A keyword view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a keyword_view_service.GetKeywordViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, keyword_view_service.GetKeywordViewRequest): - request = keyword_view_service.GetKeywordViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_keyword_view] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("KeywordViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/keyword_view_service/transports/__init__.py deleted file mode 100644 index 3979a014e..000000000 --- a/google/ads/googleads/v6/services/services/keyword_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import KeywordViewServiceTransport -from .grpc import KeywordViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[KeywordViewServiceTransport]] -_transport_registry["grpc"] = KeywordViewServiceGrpcTransport - - -__all__ = ( - "KeywordViewServiceTransport", - "KeywordViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/keyword_view_service/transports/base.py b/google/ads/googleads/v6/services/services/keyword_view_service/transports/base.py deleted file mode 100644 index d81e2cc66..000000000 --- a/google/ads/googleads/v6/services/services/keyword_view_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_view -from google.ads.googleads.v6.services.types import keyword_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class KeywordViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for KeywordViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_keyword_view: gapic_v1.method.wrap_method( - self.get_keyword_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_keyword_view( - self, - ) -> typing.Callable[ - [keyword_view_service.GetKeywordViewRequest], keyword_view.KeywordView - ]: - raise NotImplementedError - - -__all__ = ("KeywordViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/keyword_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/keyword_view_service/transports/grpc.py deleted file mode 100644 index fcae15339..000000000 --- a/google/ads/googleads/v6/services/services/keyword_view_service/transports/grpc.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import keyword_view -from google.ads.googleads.v6.services.types import keyword_view_service - -from .base import KeywordViewServiceTransport, DEFAULT_CLIENT_INFO - - -class KeywordViewServiceGrpcTransport(KeywordViewServiceTransport): - """gRPC backend transport for KeywordViewService. - - Service to manage keyword views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_keyword_view( - self, - ) -> Callable[ - [keyword_view_service.GetKeywordViewRequest], keyword_view.KeywordView - ]: - r"""Return a callable for the get keyword view method over gRPC. - - Returns the requested keyword view in full detail. - - Returns: - Callable[[~.GetKeywordViewRequest], - ~.KeywordView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_keyword_view" not in self._stubs: - self._stubs["get_keyword_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.KeywordViewService/GetKeywordView", - request_serializer=keyword_view_service.GetKeywordViewRequest.serialize, - response_deserializer=keyword_view.KeywordView.deserialize, - ) - return self._stubs["get_keyword_view"] - - -__all__ = ("KeywordViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/label_service/__init__.py b/google/ads/googleads/v6/services/services/label_service/__init__.py deleted file mode 100644 index c9ef9bf7c..000000000 --- a/google/ads/googleads/v6/services/services/label_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import LabelServiceClient - -__all__ = ("LabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/label_service/client.py b/google/ads/googleads/v6/services/services/label_service/client.py deleted file mode 100644 index d948d49e4..000000000 --- a/google/ads/googleads/v6/services/services/label_service/client.py +++ /dev/null @@ -1,517 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import label -from google.ads.googleads.v6.services.types import label_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import LabelServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import LabelServiceGrpcTransport - - -class LabelServiceClientMeta(type): - """Metaclass for the LabelService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[LabelServiceTransport]] - _transport_registry["grpc"] = LabelServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[LabelServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class LabelServiceClient(metaclass=LabelServiceClientMeta): - """Service to manage labels.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LabelServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> LabelServiceTransport: - """Return the transport used by the client instance. - - Returns: - LabelServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def label_path(customer_id: str, label_id: str,) -> str: - """Return a fully-qualified label string.""" - return "customers/{customer_id}/labels/{label_id}".format( - customer_id=customer_id, label_id=label_id, - ) - - @staticmethod - def parse_label_path(path: str) -> Dict[str, str]: - """Parse a label path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/labels/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, LabelServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the label service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.LabelServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, LabelServiceTransport): - # transport is a LabelServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = LabelServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_label( - self, - request: label_service.GetLabelRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> label.Label: - r"""Returns the requested label in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetLabelRequest`): - The request object. Request message for - [LabelService.GetLabel][google.ads.googleads.v6.services.LabelService.GetLabel]. - resource_name (:class:`str`): - Required. The resource name of the - label to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Label: - A label. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a label_service.GetLabelRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, label_service.GetLabelRequest): - request = label_service.GetLabelRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_label] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_labels( - self, - request: label_service.MutateLabelsRequest = None, - *, - customer_id: str = None, - operations: Sequence[label_service.LabelOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> label_service.MutateLabelsResponse: - r"""Creates, updates, or removes labels. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateLabelsRequest`): - The request object. Request message for - [LabelService.MutateLabels][google.ads.googleads.v6.services.LabelService.MutateLabels]. - customer_id (:class:`str`): - Required. ID of the customer whose - labels are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.LabelOperation]`): - Required. The list of operations to - perform on labels. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateLabelsResponse: - Response message for a labels mutate. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a label_service.MutateLabelsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, label_service.MutateLabelsRequest): - request = label_service.MutateLabelsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.mutate_labels] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("LabelServiceClient",) diff --git a/google/ads/googleads/v6/services/services/label_service/transports/__init__.py b/google/ads/googleads/v6/services/services/label_service/transports/__init__.py deleted file mode 100644 index 6135a8ac8..000000000 --- a/google/ads/googleads/v6/services/services/label_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import LabelServiceTransport -from .grpc import LabelServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[LabelServiceTransport]] -_transport_registry["grpc"] = LabelServiceGrpcTransport - - -__all__ = ( - "LabelServiceTransport", - "LabelServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/label_service/transports/base.py b/google/ads/googleads/v6/services/services/label_service/transports/base.py deleted file mode 100644 index d3d2d518c..000000000 --- a/google/ads/googleads/v6/services/services/label_service/transports/base.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import label -from google.ads.googleads.v6.services.types import label_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class LabelServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for LabelService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_label: gapic_v1.method.wrap_method( - self.get_label, default_timeout=None, client_info=client_info, - ), - self.mutate_labels: gapic_v1.method.wrap_method( - self.mutate_labels, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_label( - self, - ) -> typing.Callable[[label_service.GetLabelRequest], label.Label]: - raise NotImplementedError - - @property - def mutate_labels( - self, - ) -> typing.Callable[ - [label_service.MutateLabelsRequest], label_service.MutateLabelsResponse - ]: - raise NotImplementedError - - -__all__ = ("LabelServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/label_service/transports/grpc.py b/google/ads/googleads/v6/services/services/label_service/transports/grpc.py deleted file mode 100644 index 47430a170..000000000 --- a/google/ads/googleads/v6/services/services/label_service/transports/grpc.py +++ /dev/null @@ -1,270 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import label -from google.ads.googleads.v6.services.types import label_service - -from .base import LabelServiceTransport, DEFAULT_CLIENT_INFO - - -class LabelServiceGrpcTransport(LabelServiceTransport): - """gRPC backend transport for LabelService. - - Service to manage labels. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_label( - self, - ) -> Callable[[label_service.GetLabelRequest], label.Label]: - r"""Return a callable for the get label method over gRPC. - - Returns the requested label in full detail. - - Returns: - Callable[[~.GetLabelRequest], - ~.Label]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_label" not in self._stubs: - self._stubs["get_label"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.LabelService/GetLabel", - request_serializer=label_service.GetLabelRequest.serialize, - response_deserializer=label.Label.deserialize, - ) - return self._stubs["get_label"] - - @property - def mutate_labels( - self, - ) -> Callable[ - [label_service.MutateLabelsRequest], label_service.MutateLabelsResponse - ]: - r"""Return a callable for the mutate labels method over gRPC. - - Creates, updates, or removes labels. Operation - statuses are returned. - - Returns: - Callable[[~.MutateLabelsRequest], - ~.MutateLabelsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_labels" not in self._stubs: - self._stubs["mutate_labels"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.LabelService/MutateLabels", - request_serializer=label_service.MutateLabelsRequest.serialize, - response_deserializer=label_service.MutateLabelsResponse.deserialize, - ) - return self._stubs["mutate_labels"] - - -__all__ = ("LabelServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/landing_page_view_service/__init__.py b/google/ads/googleads/v6/services/services/landing_page_view_service/__init__.py deleted file mode 100644 index fc971ec0f..000000000 --- a/google/ads/googleads/v6/services/services/landing_page_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import LandingPageViewServiceClient - -__all__ = ("LandingPageViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/landing_page_view_service/client.py b/google/ads/googleads/v6/services/services/landing_page_view_service/client.py deleted file mode 100644 index c95f70032..000000000 --- a/google/ads/googleads/v6/services/services/landing_page_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import landing_page_view -from google.ads.googleads.v6.services.types import landing_page_view_service - -from .transports.base import ( - LandingPageViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import LandingPageViewServiceGrpcTransport - - -class LandingPageViewServiceClientMeta(type): - """Metaclass for the LandingPageViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[LandingPageViewServiceTransport]] - _transport_registry["grpc"] = LandingPageViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[LandingPageViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class LandingPageViewServiceClient(metaclass=LandingPageViewServiceClientMeta): - """Service to fetch landing page views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LandingPageViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LandingPageViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> LandingPageViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - LandingPageViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def landing_page_view_path( - customer_id: str, unexpanded_final_url_fingerprint: str, - ) -> str: - """Return a fully-qualified landing_page_view string.""" - return "customers/{customer_id}/landingPageViews/{unexpanded_final_url_fingerprint}".format( - customer_id=customer_id, - unexpanded_final_url_fingerprint=unexpanded_final_url_fingerprint, - ) - - @staticmethod - def parse_landing_page_view_path(path: str) -> Dict[str, str]: - """Parse a landing_page_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/landingPageViews/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, LandingPageViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the landing page view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.LandingPageViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, LandingPageViewServiceTransport): - # transport is a LandingPageViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = LandingPageViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_landing_page_view( - self, - request: landing_page_view_service.GetLandingPageViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> landing_page_view.LandingPageView: - r"""Returns the requested landing page view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetLandingPageViewRequest`): - The request object. Request message for - [LandingPageViewService.GetLandingPageView][google.ads.googleads.v6.services.LandingPageViewService.GetLandingPageView]. - resource_name (:class:`str`): - Required. The resource name of the - landing page view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.LandingPageView: - A landing page view with metrics - aggregated at the unexpanded final URL - level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a landing_page_view_service.GetLandingPageViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, landing_page_view_service.GetLandingPageViewRequest - ): - request = landing_page_view_service.GetLandingPageViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_landing_page_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("LandingPageViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/landing_page_view_service/transports/__init__.py deleted file mode 100644 index 2ccd3c40b..000000000 --- a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import LandingPageViewServiceTransport -from .grpc import LandingPageViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[LandingPageViewServiceTransport]] -_transport_registry["grpc"] = LandingPageViewServiceGrpcTransport - - -__all__ = ( - "LandingPageViewServiceTransport", - "LandingPageViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/base.py b/google/ads/googleads/v6/services/services/landing_page_view_service/transports/base.py deleted file mode 100644 index 069051e43..000000000 --- a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import landing_page_view -from google.ads.googleads.v6.services.types import landing_page_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class LandingPageViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for LandingPageViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_landing_page_view: gapic_v1.method.wrap_method( - self.get_landing_page_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_landing_page_view( - self, - ) -> typing.Callable[ - [landing_page_view_service.GetLandingPageViewRequest], - landing_page_view.LandingPageView, - ]: - raise NotImplementedError - - -__all__ = ("LandingPageViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/landing_page_view_service/transports/grpc.py deleted file mode 100644 index 23302697b..000000000 --- a/google/ads/googleads/v6/services/services/landing_page_view_service/transports/grpc.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import landing_page_view -from google.ads.googleads.v6.services.types import landing_page_view_service - -from .base import LandingPageViewServiceTransport, DEFAULT_CLIENT_INFO - - -class LandingPageViewServiceGrpcTransport(LandingPageViewServiceTransport): - """gRPC backend transport for LandingPageViewService. - - Service to fetch landing page views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_landing_page_view( - self, - ) -> Callable[ - [landing_page_view_service.GetLandingPageViewRequest], - landing_page_view.LandingPageView, - ]: - r"""Return a callable for the get landing page view method over gRPC. - - Returns the requested landing page view in full - detail. - - Returns: - Callable[[~.GetLandingPageViewRequest], - ~.LandingPageView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_landing_page_view" not in self._stubs: - self._stubs[ - "get_landing_page_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.LandingPageViewService/GetLandingPageView", - request_serializer=landing_page_view_service.GetLandingPageViewRequest.serialize, - response_deserializer=landing_page_view.LandingPageView.deserialize, - ) - return self._stubs["get_landing_page_view"] - - -__all__ = ("LandingPageViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/language_constant_service/__init__.py b/google/ads/googleads/v6/services/services/language_constant_service/__init__.py deleted file mode 100644 index 1228a5250..000000000 --- a/google/ads/googleads/v6/services/services/language_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import LanguageConstantServiceClient - -__all__ = ("LanguageConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/language_constant_service/client.py b/google/ads/googleads/v6/services/services/language_constant_service/client.py deleted file mode 100644 index 1a59b0db0..000000000 --- a/google/ads/googleads/v6/services/services/language_constant_service/client.py +++ /dev/null @@ -1,439 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import language_constant -from google.ads.googleads.v6.services.types import language_constant_service - -from .transports.base import ( - LanguageConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import LanguageConstantServiceGrpcTransport - - -class LanguageConstantServiceClientMeta(type): - """Metaclass for the LanguageConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[LanguageConstantServiceTransport]] - _transport_registry["grpc"] = LanguageConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[LanguageConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class LanguageConstantServiceClient( - metaclass=LanguageConstantServiceClientMeta -): - """Service to fetch language constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LanguageConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LanguageConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> LanguageConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - LanguageConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def language_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified language_constant string.""" - return "languageConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_language_constant_path(path: str) -> Dict[str, str]: - """Parse a language_constant path into its component segments.""" - m = re.match(r"^languageConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, LanguageConstantServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the language constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.LanguageConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, LanguageConstantServiceTransport): - # transport is a LanguageConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = LanguageConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_language_constant( - self, - request: language_constant_service.GetLanguageConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> language_constant.LanguageConstant: - r"""Returns the requested language constant. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetLanguageConstantRequest`): - The request object. Request message for - [LanguageConstantService.GetLanguageConstant][google.ads.googleads.v6.services.LanguageConstantService.GetLanguageConstant]. - resource_name (:class:`str`): - Required. Resource name of the - language constant to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.LanguageConstant: - A language. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a language_constant_service.GetLanguageConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, language_constant_service.GetLanguageConstantRequest - ): - request = language_constant_service.GetLanguageConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_language_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("LanguageConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/language_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/language_constant_service/transports/__init__.py deleted file mode 100644 index f9a5ceef5..000000000 --- a/google/ads/googleads/v6/services/services/language_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import LanguageConstantServiceTransport -from .grpc import LanguageConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[LanguageConstantServiceTransport]] -_transport_registry["grpc"] = LanguageConstantServiceGrpcTransport - - -__all__ = ( - "LanguageConstantServiceTransport", - "LanguageConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/language_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/language_constant_service/transports/base.py deleted file mode 100644 index 26512c566..000000000 --- a/google/ads/googleads/v6/services/services/language_constant_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import language_constant -from google.ads.googleads.v6.services.types import language_constant_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class LanguageConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for LanguageConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_language_constant: gapic_v1.method.wrap_method( - self.get_language_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_language_constant( - self, - ) -> typing.Callable[ - [language_constant_service.GetLanguageConstantRequest], - language_constant.LanguageConstant, - ]: - raise NotImplementedError - - -__all__ = ("LanguageConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/language_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/language_constant_service/transports/grpc.py deleted file mode 100644 index b70bb20fc..000000000 --- a/google/ads/googleads/v6/services/services/language_constant_service/transports/grpc.py +++ /dev/null @@ -1,246 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import language_constant -from google.ads.googleads.v6.services.types import language_constant_service - -from .base import LanguageConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class LanguageConstantServiceGrpcTransport(LanguageConstantServiceTransport): - """gRPC backend transport for LanguageConstantService. - - Service to fetch language constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_language_constant( - self, - ) -> Callable[ - [language_constant_service.GetLanguageConstantRequest], - language_constant.LanguageConstant, - ]: - r"""Return a callable for the get language constant method over gRPC. - - Returns the requested language constant. - - Returns: - Callable[[~.GetLanguageConstantRequest], - ~.LanguageConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_language_constant" not in self._stubs: - self._stubs[ - "get_language_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.LanguageConstantService/GetLanguageConstant", - request_serializer=language_constant_service.GetLanguageConstantRequest.serialize, - response_deserializer=language_constant.LanguageConstant.deserialize, - ) - return self._stubs["get_language_constant"] - - -__all__ = ("LanguageConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/location_view_service/__init__.py b/google/ads/googleads/v6/services/services/location_view_service/__init__.py deleted file mode 100644 index bb0ad937c..000000000 --- a/google/ads/googleads/v6/services/services/location_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import LocationViewServiceClient - -__all__ = ("LocationViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/location_view_service/client.py b/google/ads/googleads/v6/services/services/location_view_service/client.py deleted file mode 100644 index 37062f20e..000000000 --- a/google/ads/googleads/v6/services/services/location_view_service/client.py +++ /dev/null @@ -1,442 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import location_view -from google.ads.googleads.v6.services.types import location_view_service - -from .transports.base import LocationViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import LocationViewServiceGrpcTransport - - -class LocationViewServiceClientMeta(type): - """Metaclass for the LocationViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[LocationViewServiceTransport]] - _transport_registry["grpc"] = LocationViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[LocationViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class LocationViewServiceClient(metaclass=LocationViewServiceClientMeta): - """Service to fetch location views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LocationViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - LocationViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> LocationViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - LocationViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def location_view_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified location_view string.""" - return "customers/{customer_id}/locationViews/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_location_view_path(path: str) -> Dict[str, str]: - """Parse a location_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/locationViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, LocationViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the location view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.LocationViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, LocationViewServiceTransport): - # transport is a LocationViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = LocationViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_location_view( - self, - request: location_view_service.GetLocationViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> location_view.LocationView: - r"""Returns the requested location view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetLocationViewRequest`): - The request object. Request message for - [LocationViewService.GetLocationView][google.ads.googleads.v6.services.LocationViewService.GetLocationView]. - resource_name (:class:`str`): - Required. The resource name of the - location view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.LocationView: - A location view summarizes the - performance of campaigns by Location - criteria. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a location_view_service.GetLocationViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, location_view_service.GetLocationViewRequest - ): - request = location_view_service.GetLocationViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_location_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("LocationViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/location_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/location_view_service/transports/__init__.py deleted file mode 100644 index 856be5c7d..000000000 --- a/google/ads/googleads/v6/services/services/location_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import LocationViewServiceTransport -from .grpc import LocationViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[LocationViewServiceTransport]] -_transport_registry["grpc"] = LocationViewServiceGrpcTransport - - -__all__ = ( - "LocationViewServiceTransport", - "LocationViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/location_view_service/transports/base.py b/google/ads/googleads/v6/services/services/location_view_service/transports/base.py deleted file mode 100644 index 02b0b6c00..000000000 --- a/google/ads/googleads/v6/services/services/location_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import location_view -from google.ads.googleads.v6.services.types import location_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class LocationViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for LocationViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_location_view: gapic_v1.method.wrap_method( - self.get_location_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_location_view( - self, - ) -> typing.Callable[ - [location_view_service.GetLocationViewRequest], - location_view.LocationView, - ]: - raise NotImplementedError - - -__all__ = ("LocationViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/location_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/location_view_service/transports/grpc.py deleted file mode 100644 index 51618c370..000000000 --- a/google/ads/googleads/v6/services/services/location_view_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import location_view -from google.ads.googleads.v6.services.types import location_view_service - -from .base import LocationViewServiceTransport, DEFAULT_CLIENT_INFO - - -class LocationViewServiceGrpcTransport(LocationViewServiceTransport): - """gRPC backend transport for LocationViewService. - - Service to fetch location views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_location_view( - self, - ) -> Callable[ - [location_view_service.GetLocationViewRequest], - location_view.LocationView, - ]: - r"""Return a callable for the get location view method over gRPC. - - Returns the requested location view in full detail. - - Returns: - Callable[[~.GetLocationViewRequest], - ~.LocationView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_location_view" not in self._stubs: - self._stubs["get_location_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.LocationViewService/GetLocationView", - request_serializer=location_view_service.GetLocationViewRequest.serialize, - response_deserializer=location_view.LocationView.deserialize, - ) - return self._stubs["get_location_view"] - - -__all__ = ("LocationViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/managed_placement_view_service/__init__.py b/google/ads/googleads/v6/services/services/managed_placement_view_service/__init__.py deleted file mode 100644 index c2246c88e..000000000 --- a/google/ads/googleads/v6/services/services/managed_placement_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ManagedPlacementViewServiceClient - -__all__ = ("ManagedPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/managed_placement_view_service/client.py b/google/ads/googleads/v6/services/services/managed_placement_view_service/client.py deleted file mode 100644 index 8eafc0baa..000000000 --- a/google/ads/googleads/v6/services/services/managed_placement_view_service/client.py +++ /dev/null @@ -1,452 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import managed_placement_view -from google.ads.googleads.v6.services.types import ( - managed_placement_view_service, -) - -from .transports.base import ( - ManagedPlacementViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ManagedPlacementViewServiceGrpcTransport - - -class ManagedPlacementViewServiceClientMeta(type): - """Metaclass for the ManagedPlacementViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ManagedPlacementViewServiceTransport]] - _transport_registry["grpc"] = ManagedPlacementViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ManagedPlacementViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ManagedPlacementViewServiceClient( - metaclass=ManagedPlacementViewServiceClientMeta -): - """Service to manage Managed Placement views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ManagedPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ManagedPlacementViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ManagedPlacementViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ManagedPlacementViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def managed_placement_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified managed_placement_view string.""" - return "customers/{customer_id}/managedPlacementViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_managed_placement_view_path(path: str) -> Dict[str, str]: - """Parse a managed_placement_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/managedPlacementViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ManagedPlacementViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the managed placement view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ManagedPlacementViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ManagedPlacementViewServiceTransport): - # transport is a ManagedPlacementViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ManagedPlacementViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_managed_placement_view( - self, - request: managed_placement_view_service.GetManagedPlacementViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> managed_placement_view.ManagedPlacementView: - r"""Returns the requested Managed Placement view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetManagedPlacementViewRequest`): - The request object. Request message for - [ManagedPlacementViewService.GetManagedPlacementView][google.ads.googleads.v6.services.ManagedPlacementViewService.GetManagedPlacementView]. - resource_name (:class:`str`): - Required. The resource name of the - Managed Placement View to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ManagedPlacementView: - A managed placement view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a managed_placement_view_service.GetManagedPlacementViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - managed_placement_view_service.GetManagedPlacementViewRequest, - ): - request = managed_placement_view_service.GetManagedPlacementViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_managed_placement_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ManagedPlacementViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/__init__.py deleted file mode 100644 index 3eb838593..000000000 --- a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ManagedPlacementViewServiceTransport -from .grpc import ManagedPlacementViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ManagedPlacementViewServiceTransport]] -_transport_registry["grpc"] = ManagedPlacementViewServiceGrpcTransport - - -__all__ = ( - "ManagedPlacementViewServiceTransport", - "ManagedPlacementViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/base.py b/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/base.py deleted file mode 100644 index d45f70650..000000000 --- a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import managed_placement_view -from google.ads.googleads.v6.services.types import ( - managed_placement_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ManagedPlacementViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ManagedPlacementViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_managed_placement_view: gapic_v1.method.wrap_method( - self.get_managed_placement_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_managed_placement_view( - self, - ) -> typing.Callable[ - [managed_placement_view_service.GetManagedPlacementViewRequest], - managed_placement_view.ManagedPlacementView, - ]: - raise NotImplementedError - - -__all__ = ("ManagedPlacementViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/grpc.py deleted file mode 100644 index c86dfde02..000000000 --- a/google/ads/googleads/v6/services/services/managed_placement_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import managed_placement_view -from google.ads.googleads.v6.services.types import ( - managed_placement_view_service, -) - -from .base import ManagedPlacementViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ManagedPlacementViewServiceGrpcTransport( - ManagedPlacementViewServiceTransport -): - """gRPC backend transport for ManagedPlacementViewService. - - Service to manage Managed Placement views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_managed_placement_view( - self, - ) -> Callable[ - [managed_placement_view_service.GetManagedPlacementViewRequest], - managed_placement_view.ManagedPlacementView, - ]: - r"""Return a callable for the get managed placement view method over gRPC. - - Returns the requested Managed Placement view in full - detail. - - Returns: - Callable[[~.GetManagedPlacementViewRequest], - ~.ManagedPlacementView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_managed_placement_view" not in self._stubs: - self._stubs[ - "get_managed_placement_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ManagedPlacementViewService/GetManagedPlacementView", - request_serializer=managed_placement_view_service.GetManagedPlacementViewRequest.serialize, - response_deserializer=managed_placement_view.ManagedPlacementView.deserialize, - ) - return self._stubs["get_managed_placement_view"] - - -__all__ = ("ManagedPlacementViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/media_file_service/__init__.py b/google/ads/googleads/v6/services/services/media_file_service/__init__.py deleted file mode 100644 index ad6f3f2a4..000000000 --- a/google/ads/googleads/v6/services/services/media_file_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import MediaFileServiceClient - -__all__ = ("MediaFileServiceClient",) diff --git a/google/ads/googleads/v6/services/services/media_file_service/client.py b/google/ads/googleads/v6/services/services/media_file_service/client.py deleted file mode 100644 index dc39222ae..000000000 --- a/google/ads/googleads/v6/services/services/media_file_service/client.py +++ /dev/null @@ -1,521 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import media_file -from google.ads.googleads.v6.services.types import media_file_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import MediaFileServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import MediaFileServiceGrpcTransport - - -class MediaFileServiceClientMeta(type): - """Metaclass for the MediaFileService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[MediaFileServiceTransport]] - _transport_registry["grpc"] = MediaFileServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[MediaFileServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class MediaFileServiceClient(metaclass=MediaFileServiceClientMeta): - """Service to manage media files.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MediaFileServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MediaFileServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> MediaFileServiceTransport: - """Return the transport used by the client instance. - - Returns: - MediaFileServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def media_file_path(customer_id: str, media_file_id: str,) -> str: - """Return a fully-qualified media_file string.""" - return "customers/{customer_id}/mediaFiles/{media_file_id}".format( - customer_id=customer_id, media_file_id=media_file_id, - ) - - @staticmethod - def parse_media_file_path(path: str) -> Dict[str, str]: - """Parse a media_file path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/mediaFiles/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, MediaFileServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the media file service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.MediaFileServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, MediaFileServiceTransport): - # transport is a MediaFileServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = MediaFileServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_media_file( - self, - request: media_file_service.GetMediaFileRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> media_file.MediaFile: - r"""Returns the requested media file in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetMediaFileRequest`): - The request object. Request message for - [MediaFileService.GetMediaFile][google.ads.googleads.v6.services.MediaFileService.GetMediaFile] - resource_name (:class:`str`): - Required. The resource name of the - media file to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.MediaFile: - A media file. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a media_file_service.GetMediaFileRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, media_file_service.GetMediaFileRequest): - request = media_file_service.GetMediaFileRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_media_file] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_media_files( - self, - request: media_file_service.MutateMediaFilesRequest = None, - *, - customer_id: str = None, - operations: Sequence[media_file_service.MediaFileOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> media_file_service.MutateMediaFilesResponse: - r"""Creates media files. Operation statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateMediaFilesRequest`): - The request object. Request message for - [MediaFileService.MutateMediaFiles][google.ads.googleads.v6.services.MediaFileService.MutateMediaFiles] - customer_id (:class:`str`): - Required. The ID of the customer - whose media files are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.MediaFileOperation]`): - Required. The list of operations to - perform on individual media file. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateMediaFilesResponse: - Response message for a media file - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a media_file_service.MutateMediaFilesRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, media_file_service.MutateMediaFilesRequest): - request = media_file_service.MutateMediaFilesRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_media_files - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("MediaFileServiceClient",) diff --git a/google/ads/googleads/v6/services/services/media_file_service/transports/__init__.py b/google/ads/googleads/v6/services/services/media_file_service/transports/__init__.py deleted file mode 100644 index 0468e352e..000000000 --- a/google/ads/googleads/v6/services/services/media_file_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import MediaFileServiceTransport -from .grpc import MediaFileServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[MediaFileServiceTransport]] -_transport_registry["grpc"] = MediaFileServiceGrpcTransport - - -__all__ = ( - "MediaFileServiceTransport", - "MediaFileServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/media_file_service/transports/base.py b/google/ads/googleads/v6/services/services/media_file_service/transports/base.py deleted file mode 100644 index fc362fa13..000000000 --- a/google/ads/googleads/v6/services/services/media_file_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import media_file -from google.ads.googleads.v6.services.types import media_file_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class MediaFileServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for MediaFileService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_media_file: gapic_v1.method.wrap_method( - self.get_media_file, - default_timeout=None, - client_info=client_info, - ), - self.mutate_media_files: gapic_v1.method.wrap_method( - self.mutate_media_files, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_media_file( - self, - ) -> typing.Callable[ - [media_file_service.GetMediaFileRequest], media_file.MediaFile - ]: - raise NotImplementedError - - @property - def mutate_media_files( - self, - ) -> typing.Callable[ - [media_file_service.MutateMediaFilesRequest], - media_file_service.MutateMediaFilesResponse, - ]: - raise NotImplementedError - - -__all__ = ("MediaFileServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/media_file_service/transports/grpc.py b/google/ads/googleads/v6/services/services/media_file_service/transports/grpc.py deleted file mode 100644 index 14e50b28a..000000000 --- a/google/ads/googleads/v6/services/services/media_file_service/transports/grpc.py +++ /dev/null @@ -1,272 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import media_file -from google.ads.googleads.v6.services.types import media_file_service - -from .base import MediaFileServiceTransport, DEFAULT_CLIENT_INFO - - -class MediaFileServiceGrpcTransport(MediaFileServiceTransport): - """gRPC backend transport for MediaFileService. - - Service to manage media files. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_media_file( - self, - ) -> Callable[ - [media_file_service.GetMediaFileRequest], media_file.MediaFile - ]: - r"""Return a callable for the get media file method over gRPC. - - Returns the requested media file in full detail. - - Returns: - Callable[[~.GetMediaFileRequest], - ~.MediaFile]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_media_file" not in self._stubs: - self._stubs["get_media_file"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MediaFileService/GetMediaFile", - request_serializer=media_file_service.GetMediaFileRequest.serialize, - response_deserializer=media_file.MediaFile.deserialize, - ) - return self._stubs["get_media_file"] - - @property - def mutate_media_files( - self, - ) -> Callable[ - [media_file_service.MutateMediaFilesRequest], - media_file_service.MutateMediaFilesResponse, - ]: - r"""Return a callable for the mutate media files method over gRPC. - - Creates media files. Operation statuses are returned. - - Returns: - Callable[[~.MutateMediaFilesRequest], - ~.MutateMediaFilesResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_media_files" not in self._stubs: - self._stubs["mutate_media_files"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MediaFileService/MutateMediaFiles", - request_serializer=media_file_service.MutateMediaFilesRequest.serialize, - response_deserializer=media_file_service.MutateMediaFilesResponse.deserialize, - ) - return self._stubs["mutate_media_files"] - - -__all__ = ("MediaFileServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/merchant_center_link_service/__init__.py b/google/ads/googleads/v6/services/services/merchant_center_link_service/__init__.py deleted file mode 100644 index cd8473675..000000000 --- a/google/ads/googleads/v6/services/services/merchant_center_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import MerchantCenterLinkServiceClient - -__all__ = ("MerchantCenterLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/merchant_center_link_service/client.py b/google/ads/googleads/v6/services/services/merchant_center_link_service/client.py deleted file mode 100644 index ec4478de0..000000000 --- a/google/ads/googleads/v6/services/services/merchant_center_link_service/client.py +++ /dev/null @@ -1,628 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import merchant_center_link -from google.ads.googleads.v6.services.types import merchant_center_link_service - -from .transports.base import ( - MerchantCenterLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import MerchantCenterLinkServiceGrpcTransport - - -class MerchantCenterLinkServiceClientMeta(type): - """Metaclass for the MerchantCenterLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[MerchantCenterLinkServiceTransport]] - _transport_registry["grpc"] = MerchantCenterLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[MerchantCenterLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class MerchantCenterLinkServiceClient( - metaclass=MerchantCenterLinkServiceClientMeta -): - """This service allows management of links between Google Ads - and Google Merchant Center. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MerchantCenterLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MerchantCenterLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> MerchantCenterLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - MerchantCenterLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def merchant_center_link_path( - customer_id: str, merchant_center_id: str, - ) -> str: - """Return a fully-qualified merchant_center_link string.""" - return "customers/{customer_id}/merchantCenterLinks/{merchant_center_id}".format( - customer_id=customer_id, merchant_center_id=merchant_center_id, - ) - - @staticmethod - def parse_merchant_center_link_path(path: str) -> Dict[str, str]: - """Parse a merchant_center_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/merchantCenterLinks/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, MerchantCenterLinkServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the merchant center link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.MerchantCenterLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, MerchantCenterLinkServiceTransport): - # transport is a MerchantCenterLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = MerchantCenterLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def list_merchant_center_links( - self, - request: merchant_center_link_service.ListMerchantCenterLinksRequest = None, - *, - customer_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> merchant_center_link_service.ListMerchantCenterLinksResponse: - r"""Returns Merchant Center links available for this - customer. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListMerchantCenterLinksRequest`): - The request object. Request message for - [MerchantCenterLinkService.ListMerchantCenterLinks][google.ads.googleads.v6.services.MerchantCenterLinkService.ListMerchantCenterLinks]. - customer_id (:class:`str`): - Required. The ID of the customer onto - which to apply the Merchant Center link - list operation. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListMerchantCenterLinksResponse: - Response message for - [MerchantCenterLinkService.ListMerchantCenterLinks][google.ads.googleads.v6.services.MerchantCenterLinkService.ListMerchantCenterLinks]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a merchant_center_link_service.ListMerchantCenterLinksRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, merchant_center_link_service.ListMerchantCenterLinksRequest - ): - request = merchant_center_link_service.ListMerchantCenterLinksRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_merchant_center_links - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def get_merchant_center_link( - self, - request: merchant_center_link_service.GetMerchantCenterLinkRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> merchant_center_link.MerchantCenterLink: - r"""Returns the Merchant Center link in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetMerchantCenterLinkRequest`): - The request object. Request message for - [MerchantCenterLinkService.GetMerchantCenterLink][google.ads.googleads.v6.services.MerchantCenterLinkService.GetMerchantCenterLink]. - resource_name (:class:`str`): - Required. Resource name of the - Merchant Center link. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.MerchantCenterLink: - A data sharing connection, proposed - or in use, between a Google Ads Customer - and a Merchant Center account. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a merchant_center_link_service.GetMerchantCenterLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, merchant_center_link_service.GetMerchantCenterLinkRequest - ): - request = merchant_center_link_service.GetMerchantCenterLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_merchant_center_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_merchant_center_link( - self, - request: merchant_center_link_service.MutateMerchantCenterLinkRequest = None, - *, - customer_id: str = None, - operation: merchant_center_link_service.MerchantCenterLinkOperation = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> merchant_center_link_service.MutateMerchantCenterLinkResponse: - r"""Updates status or removes a Merchant Center link. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateMerchantCenterLinkRequest`): - The request object. Request message for - [MerchantCenterLinkService.MutateMerchantCenterLink][google.ads.googleads.v6.services.MerchantCenterLinkService.MutateMerchantCenterLink]. - customer_id (:class:`str`): - Required. The ID of the customer - being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operation (:class:`google.ads.googleads.v6.services.types.MerchantCenterLinkOperation`): - Required. The operation to perform on - the link - - This corresponds to the ``operation`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateMerchantCenterLinkResponse: - Response message for Merchant Center - link mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operation]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a merchant_center_link_service.MutateMerchantCenterLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - merchant_center_link_service.MutateMerchantCenterLinkRequest, - ): - request = merchant_center_link_service.MutateMerchantCenterLinkRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operation is not None: - request.operation = operation - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_merchant_center_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("MerchantCenterLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/__init__.py deleted file mode 100644 index a9001f21d..000000000 --- a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import MerchantCenterLinkServiceTransport -from .grpc import MerchantCenterLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[MerchantCenterLinkServiceTransport]] -_transport_registry["grpc"] = MerchantCenterLinkServiceGrpcTransport - - -__all__ = ( - "MerchantCenterLinkServiceTransport", - "MerchantCenterLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/base.py b/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/base.py deleted file mode 100644 index ea654214b..000000000 --- a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/base.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import merchant_center_link -from google.ads.googleads.v6.services.types import merchant_center_link_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class MerchantCenterLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for MerchantCenterLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.list_merchant_center_links: gapic_v1.method.wrap_method( - self.list_merchant_center_links, - default_timeout=None, - client_info=client_info, - ), - self.get_merchant_center_link: gapic_v1.method.wrap_method( - self.get_merchant_center_link, - default_timeout=None, - client_info=client_info, - ), - self.mutate_merchant_center_link: gapic_v1.method.wrap_method( - self.mutate_merchant_center_link, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def list_merchant_center_links( - self, - ) -> typing.Callable[ - [merchant_center_link_service.ListMerchantCenterLinksRequest], - merchant_center_link_service.ListMerchantCenterLinksResponse, - ]: - raise NotImplementedError - - @property - def get_merchant_center_link( - self, - ) -> typing.Callable[ - [merchant_center_link_service.GetMerchantCenterLinkRequest], - merchant_center_link.MerchantCenterLink, - ]: - raise NotImplementedError - - @property - def mutate_merchant_center_link( - self, - ) -> typing.Callable[ - [merchant_center_link_service.MutateMerchantCenterLinkRequest], - merchant_center_link_service.MutateMerchantCenterLinkResponse, - ]: - raise NotImplementedError - - -__all__ = ("MerchantCenterLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/grpc.py deleted file mode 100644 index 70da9cc6a..000000000 --- a/google/ads/googleads/v6/services/services/merchant_center_link_service/transports/grpc.py +++ /dev/null @@ -1,312 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import merchant_center_link -from google.ads.googleads.v6.services.types import merchant_center_link_service - -from .base import MerchantCenterLinkServiceTransport, DEFAULT_CLIENT_INFO - - -class MerchantCenterLinkServiceGrpcTransport( - MerchantCenterLinkServiceTransport -): - """gRPC backend transport for MerchantCenterLinkService. - - This service allows management of links between Google Ads - and Google Merchant Center. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def list_merchant_center_links( - self, - ) -> Callable[ - [merchant_center_link_service.ListMerchantCenterLinksRequest], - merchant_center_link_service.ListMerchantCenterLinksResponse, - ]: - r"""Return a callable for the list merchant center links method over gRPC. - - Returns Merchant Center links available for this - customer. - - Returns: - Callable[[~.ListMerchantCenterLinksRequest], - ~.ListMerchantCenterLinksResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_merchant_center_links" not in self._stubs: - self._stubs[ - "list_merchant_center_links" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MerchantCenterLinkService/ListMerchantCenterLinks", - request_serializer=merchant_center_link_service.ListMerchantCenterLinksRequest.serialize, - response_deserializer=merchant_center_link_service.ListMerchantCenterLinksResponse.deserialize, - ) - return self._stubs["list_merchant_center_links"] - - @property - def get_merchant_center_link( - self, - ) -> Callable[ - [merchant_center_link_service.GetMerchantCenterLinkRequest], - merchant_center_link.MerchantCenterLink, - ]: - r"""Return a callable for the get merchant center link method over gRPC. - - Returns the Merchant Center link in full detail. - - Returns: - Callable[[~.GetMerchantCenterLinkRequest], - ~.MerchantCenterLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_merchant_center_link" not in self._stubs: - self._stubs[ - "get_merchant_center_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MerchantCenterLinkService/GetMerchantCenterLink", - request_serializer=merchant_center_link_service.GetMerchantCenterLinkRequest.serialize, - response_deserializer=merchant_center_link.MerchantCenterLink.deserialize, - ) - return self._stubs["get_merchant_center_link"] - - @property - def mutate_merchant_center_link( - self, - ) -> Callable[ - [merchant_center_link_service.MutateMerchantCenterLinkRequest], - merchant_center_link_service.MutateMerchantCenterLinkResponse, - ]: - r"""Return a callable for the mutate merchant center link method over gRPC. - - Updates status or removes a Merchant Center link. - - Returns: - Callable[[~.MutateMerchantCenterLinkRequest], - ~.MutateMerchantCenterLinkResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_merchant_center_link" not in self._stubs: - self._stubs[ - "mutate_merchant_center_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MerchantCenterLinkService/MutateMerchantCenterLink", - request_serializer=merchant_center_link_service.MutateMerchantCenterLinkRequest.serialize, - response_deserializer=merchant_center_link_service.MutateMerchantCenterLinkResponse.deserialize, - ) - return self._stubs["mutate_merchant_center_link"] - - -__all__ = ("MerchantCenterLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/__init__.py b/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/__init__.py deleted file mode 100644 index 4a2bb9c22..000000000 --- a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import MobileAppCategoryConstantServiceClient - -__all__ = ("MobileAppCategoryConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/client.py b/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/client.py deleted file mode 100644 index 6e8705fc2..000000000 --- a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/client.py +++ /dev/null @@ -1,449 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_app_category_constant -from google.ads.googleads.v6.services.types import ( - mobile_app_category_constant_service, -) - -from .transports.base import ( - MobileAppCategoryConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import MobileAppCategoryConstantServiceGrpcTransport - - -class MobileAppCategoryConstantServiceClientMeta(type): - """Metaclass for the MobileAppCategoryConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[MobileAppCategoryConstantServiceTransport]] - _transport_registry["grpc"] = MobileAppCategoryConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[MobileAppCategoryConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class MobileAppCategoryConstantServiceClient( - metaclass=MobileAppCategoryConstantServiceClientMeta -): - """Service to fetch mobile app category constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MobileAppCategoryConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MobileAppCategoryConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> MobileAppCategoryConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - MobileAppCategoryConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def mobile_app_category_constant_path(mobile_app_category_id: str,) -> str: - """Return a fully-qualified mobile_app_category_constant string.""" - return "mobileAppCategoryConstants/{mobile_app_category_id}".format( - mobile_app_category_id=mobile_app_category_id, - ) - - @staticmethod - def parse_mobile_app_category_constant_path(path: str) -> Dict[str, str]: - """Parse a mobile_app_category_constant path into its component segments.""" - m = re.match( - r"^mobileAppCategoryConstants/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, MobileAppCategoryConstantServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the mobile app category constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.MobileAppCategoryConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, MobileAppCategoryConstantServiceTransport): - # transport is a MobileAppCategoryConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = MobileAppCategoryConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_mobile_app_category_constant( - self, - request: mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> mobile_app_category_constant.MobileAppCategoryConstant: - r"""Returns the requested mobile app category constant. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetMobileAppCategoryConstantRequest`): - The request object. Request message for - [MobileAppCategoryConstantService.GetMobileAppCategoryConstant][google.ads.googleads.v6.services.MobileAppCategoryConstantService.GetMobileAppCategoryConstant]. - resource_name (:class:`str`): - Required. Resource name of the mobile - app category constant to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.MobileAppCategoryConstant: - A mobile application category - constant. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest, - ): - request = mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_mobile_app_category_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("MobileAppCategoryConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/__init__.py deleted file mode 100644 index acc915b68..000000000 --- a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import MobileAppCategoryConstantServiceTransport -from .grpc import MobileAppCategoryConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[MobileAppCategoryConstantServiceTransport]] -_transport_registry["grpc"] = MobileAppCategoryConstantServiceGrpcTransport - - -__all__ = ( - "MobileAppCategoryConstantServiceTransport", - "MobileAppCategoryConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/base.py deleted file mode 100644 index 4fbb08c18..000000000 --- a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/base.py +++ /dev/null @@ -1,106 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_app_category_constant -from google.ads.googleads.v6.services.types import ( - mobile_app_category_constant_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class MobileAppCategoryConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for MobileAppCategoryConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_mobile_app_category_constant: gapic_v1.method.wrap_method( - self.get_mobile_app_category_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_mobile_app_category_constant( - self, - ) -> typing.Callable[ - [ - mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest - ], - mobile_app_category_constant.MobileAppCategoryConstant, - ]: - raise NotImplementedError - - -__all__ = ("MobileAppCategoryConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/grpc.py deleted file mode 100644 index 1604b4086..000000000 --- a/google/ads/googleads/v6/services/services/mobile_app_category_constant_service/transports/grpc.py +++ /dev/null @@ -1,253 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_app_category_constant -from google.ads.googleads.v6.services.types import ( - mobile_app_category_constant_service, -) - -from .base import MobileAppCategoryConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class MobileAppCategoryConstantServiceGrpcTransport( - MobileAppCategoryConstantServiceTransport -): - """gRPC backend transport for MobileAppCategoryConstantService. - - Service to fetch mobile app category constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_mobile_app_category_constant( - self, - ) -> Callable[ - [ - mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest - ], - mobile_app_category_constant.MobileAppCategoryConstant, - ]: - r"""Return a callable for the get mobile app category - constant method over gRPC. - - Returns the requested mobile app category constant. - - Returns: - Callable[[~.GetMobileAppCategoryConstantRequest], - ~.MobileAppCategoryConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_mobile_app_category_constant" not in self._stubs: - self._stubs[ - "get_mobile_app_category_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MobileAppCategoryConstantService/GetMobileAppCategoryConstant", - request_serializer=mobile_app_category_constant_service.GetMobileAppCategoryConstantRequest.serialize, - response_deserializer=mobile_app_category_constant.MobileAppCategoryConstant.deserialize, - ) - return self._stubs["get_mobile_app_category_constant"] - - -__all__ = ("MobileAppCategoryConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/mobile_device_constant_service/__init__.py b/google/ads/googleads/v6/services/services/mobile_device_constant_service/__init__.py deleted file mode 100644 index 2c5c42865..000000000 --- a/google/ads/googleads/v6/services/services/mobile_device_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import MobileDeviceConstantServiceClient - -__all__ = ("MobileDeviceConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/mobile_device_constant_service/client.py b/google/ads/googleads/v6/services/services/mobile_device_constant_service/client.py deleted file mode 100644 index ea9691f1e..000000000 --- a/google/ads/googleads/v6/services/services/mobile_device_constant_service/client.py +++ /dev/null @@ -1,445 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_device_constant -from google.ads.googleads.v6.services.types import ( - mobile_device_constant_service, -) - -from .transports.base import ( - MobileDeviceConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import MobileDeviceConstantServiceGrpcTransport - - -class MobileDeviceConstantServiceClientMeta(type): - """Metaclass for the MobileDeviceConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[MobileDeviceConstantServiceTransport]] - _transport_registry["grpc"] = MobileDeviceConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[MobileDeviceConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class MobileDeviceConstantServiceClient( - metaclass=MobileDeviceConstantServiceClientMeta -): - """Service to fetch mobile device constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MobileDeviceConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - MobileDeviceConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> MobileDeviceConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - MobileDeviceConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def mobile_device_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified mobile_device_constant string.""" - return "mobileDeviceConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_mobile_device_constant_path(path: str) -> Dict[str, str]: - """Parse a mobile_device_constant path into its component segments.""" - m = re.match(r"^mobileDeviceConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, MobileDeviceConstantServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the mobile device constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.MobileDeviceConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, MobileDeviceConstantServiceTransport): - # transport is a MobileDeviceConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = MobileDeviceConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_mobile_device_constant( - self, - request: mobile_device_constant_service.GetMobileDeviceConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> mobile_device_constant.MobileDeviceConstant: - r"""Returns the requested mobile device constant in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetMobileDeviceConstantRequest`): - The request object. Request message for - [MobileDeviceConstantService.GetMobileDeviceConstant][google.ads.googleads.v6.services.MobileDeviceConstantService.GetMobileDeviceConstant]. - resource_name (:class:`str`): - Required. Resource name of the mobile - device to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.MobileDeviceConstant: - A mobile device constant. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a mobile_device_constant_service.GetMobileDeviceConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - mobile_device_constant_service.GetMobileDeviceConstantRequest, - ): - request = mobile_device_constant_service.GetMobileDeviceConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_mobile_device_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("MobileDeviceConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/__init__.py deleted file mode 100644 index 8e1632f75..000000000 --- a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import MobileDeviceConstantServiceTransport -from .grpc import MobileDeviceConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[MobileDeviceConstantServiceTransport]] -_transport_registry["grpc"] = MobileDeviceConstantServiceGrpcTransport - - -__all__ = ( - "MobileDeviceConstantServiceTransport", - "MobileDeviceConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/base.py deleted file mode 100644 index fcb073b7a..000000000 --- a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_device_constant -from google.ads.googleads.v6.services.types import ( - mobile_device_constant_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class MobileDeviceConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for MobileDeviceConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_mobile_device_constant: gapic_v1.method.wrap_method( - self.get_mobile_device_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_mobile_device_constant( - self, - ) -> typing.Callable[ - [mobile_device_constant_service.GetMobileDeviceConstantRequest], - mobile_device_constant.MobileDeviceConstant, - ]: - raise NotImplementedError - - -__all__ = ("MobileDeviceConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/grpc.py deleted file mode 100644 index 7d2238e6a..000000000 --- a/google/ads/googleads/v6/services/services/mobile_device_constant_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import mobile_device_constant -from google.ads.googleads.v6.services.types import ( - mobile_device_constant_service, -) - -from .base import MobileDeviceConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class MobileDeviceConstantServiceGrpcTransport( - MobileDeviceConstantServiceTransport -): - """gRPC backend transport for MobileDeviceConstantService. - - Service to fetch mobile device constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_mobile_device_constant( - self, - ) -> Callable[ - [mobile_device_constant_service.GetMobileDeviceConstantRequest], - mobile_device_constant.MobileDeviceConstant, - ]: - r"""Return a callable for the get mobile device constant method over gRPC. - - Returns the requested mobile device constant in full - detail. - - Returns: - Callable[[~.GetMobileDeviceConstantRequest], - ~.MobileDeviceConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_mobile_device_constant" not in self._stubs: - self._stubs[ - "get_mobile_device_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.MobileDeviceConstantService/GetMobileDeviceConstant", - request_serializer=mobile_device_constant_service.GetMobileDeviceConstantRequest.serialize, - response_deserializer=mobile_device_constant.MobileDeviceConstant.deserialize, - ) - return self._stubs["get_mobile_device_constant"] - - -__all__ = ("MobileDeviceConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/offline_user_data_job_service/__init__.py b/google/ads/googleads/v6/services/services/offline_user_data_job_service/__init__.py deleted file mode 100644 index a2ee63b4c..000000000 --- a/google/ads/googleads/v6/services/services/offline_user_data_job_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import OfflineUserDataJobServiceClient - -__all__ = ("OfflineUserDataJobServiceClient",) diff --git a/google/ads/googleads/v6/services/services/offline_user_data_job_service/client.py b/google/ads/googleads/v6/services/services/offline_user_data_job_service/client.py deleted file mode 100644 index 03d3b6f7b..000000000 --- a/google/ads/googleads/v6/services/services/offline_user_data_job_service/client.py +++ /dev/null @@ -1,753 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import offline_user_data_job -from google.ads.googleads.v6.services.types import offline_user_data_job_service -from google.api_core import operation # type: ignore -from google.api_core import operation_async # type: ignore -from google.protobuf import empty_pb2 as empty # type: ignore -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - OfflineUserDataJobServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import OfflineUserDataJobServiceGrpcTransport - - -class OfflineUserDataJobServiceClientMeta(type): - """Metaclass for the OfflineUserDataJobService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[OfflineUserDataJobServiceTransport]] - _transport_registry["grpc"] = OfflineUserDataJobServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[OfflineUserDataJobServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class OfflineUserDataJobServiceClient( - metaclass=OfflineUserDataJobServiceClientMeta -): - """Service to manage offline user data jobs.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - OfflineUserDataJobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - OfflineUserDataJobServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> OfflineUserDataJobServiceTransport: - """Return the transport used by the client instance. - - Returns: - OfflineUserDataJobServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def offline_user_data_job_path( - customer_id: str, offline_user_data_update_id: str, - ) -> str: - """Return a fully-qualified offline_user_data_job string.""" - return "customers/{customer_id}/offlineUserDataJobs/{offline_user_data_update_id}".format( - customer_id=customer_id, - offline_user_data_update_id=offline_user_data_update_id, - ) - - @staticmethod - def parse_offline_user_data_job_path(path: str) -> Dict[str, str]: - """Parse a offline_user_data_job path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/offlineUserDataJobs/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, OfflineUserDataJobServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the offline user data job service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.OfflineUserDataJobServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, OfflineUserDataJobServiceTransport): - # transport is a OfflineUserDataJobServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = OfflineUserDataJobServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def create_offline_user_data_job( - self, - request: offline_user_data_job_service.CreateOfflineUserDataJobRequest = None, - *, - customer_id: str = None, - job: offline_user_data_job.OfflineUserDataJob = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> offline_user_data_job_service.CreateOfflineUserDataJobResponse: - r"""Creates an offline user data job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.CreateOfflineUserDataJobRequest`): - The request object. Request message for - [OfflineUserDataJobService.CreateOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.CreateOfflineUserDataJob]. - customer_id (:class:`str`): - Required. The ID of the customer for - which to create an offline user data - job. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - job (:class:`google.ads.googleads.v6.resources.types.OfflineUserDataJob`): - Required. The offline user data job - to be created. - - This corresponds to the ``job`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.CreateOfflineUserDataJobResponse: - Response message for - [OfflineUserDataJobService.CreateOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.CreateOfflineUserDataJob]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, job]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a offline_user_data_job_service.CreateOfflineUserDataJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - offline_user_data_job_service.CreateOfflineUserDataJobRequest, - ): - request = offline_user_data_job_service.CreateOfflineUserDataJobRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if job is not None: - request.job = job - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_offline_user_data_job - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def get_offline_user_data_job( - self, - request: offline_user_data_job_service.GetOfflineUserDataJobRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> offline_user_data_job.OfflineUserDataJob: - r"""Returns the offline user data job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetOfflineUserDataJobRequest`): - The request object. Request message for - [OfflineUserDataJobService.GetOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.GetOfflineUserDataJob]. - resource_name (:class:`str`): - Required. The resource name of the - OfflineUserDataJob to get. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.OfflineUserDataJob: - A job containing offline user data of - store visitors, or user list members - that will be processed asynchronously. - The uploaded data isn't readable and the - processing results of the job can only - be read using - OfflineUserDataJobService.GetOfflineUserDataJob. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a offline_user_data_job_service.GetOfflineUserDataJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, offline_user_data_job_service.GetOfflineUserDataJobRequest - ): - request = offline_user_data_job_service.GetOfflineUserDataJobRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_offline_user_data_job - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def add_offline_user_data_job_operations( - self, - request: offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest = None, - *, - resource_name: str = None, - operations: Sequence[ - offline_user_data_job_service.OfflineUserDataJobOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> offline_user_data_job_service.AddOfflineUserDataJobOperationsResponse: - r"""Adds operations to the offline user data job. - - Args: - request (:class:`google.ads.googleads.v6.services.types.AddOfflineUserDataJobOperationsRequest`): - The request object. Request message for - [OfflineUserDataJobService.AddOfflineUserDataJobOperations][google.ads.googleads.v6.services.OfflineUserDataJobService.AddOfflineUserDataJobOperations]. - resource_name (:class:`str`): - Required. The resource name of the - OfflineUserDataJob. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.OfflineUserDataJobOperation]`): - Required. The list of operations to - be done. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.AddOfflineUserDataJobOperationsResponse: - Response message for - [OfflineUserDataJobService.AddOfflineUserDataJobOperations][google.ads.googleads.v6.services.OfflineUserDataJobService.AddOfflineUserDataJobOperations]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest, - ): - request = offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.add_offline_user_data_job_operations - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def run_offline_user_data_job( - self, - request: offline_user_data_job_service.RunOfflineUserDataJobRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operation.Operation: - r"""Runs the offline user data job. - When finished, the long running operation will contain - the processing result or failure information, if any. - - Args: - request (:class:`google.ads.googleads.v6.services.types.RunOfflineUserDataJobRequest`): - The request object. Request message for - [OfflineUserDataJobService.RunOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.RunOfflineUserDataJob]. - resource_name (:class:`str`): - Required. The resource name of the - OfflineUserDataJob to run. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.api_core.operation.Operation: - An object representing a long-running operation. - - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } - - The JSON representation for Empty is empty JSON - object {}. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a offline_user_data_job_service.RunOfflineUserDataJobRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, offline_user_data_job_service.RunOfflineUserDataJobRequest - ): - request = offline_user_data_job_service.RunOfflineUserDataJobRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.run_offline_user_data_job - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Wrap the response in an operation future. - response = operation.from_gapic( - response, - self._transport.operations_client, - empty.Empty, - metadata_type=empty.Empty, - ) - - # Done; return the response. - return response - - -__all__ = ("OfflineUserDataJobServiceClient",) diff --git a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/__init__.py b/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/__init__.py deleted file mode 100644 index 958401b06..000000000 --- a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import OfflineUserDataJobServiceTransport -from .grpc import OfflineUserDataJobServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[OfflineUserDataJobServiceTransport]] -_transport_registry["grpc"] = OfflineUserDataJobServiceGrpcTransport - - -__all__ = ( - "OfflineUserDataJobServiceTransport", - "OfflineUserDataJobServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/base.py b/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/base.py deleted file mode 100644 index 783759dd8..000000000 --- a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/base.py +++ /dev/null @@ -1,151 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import offline_user_data_job -from google.ads.googleads.v6.services.types import offline_user_data_job_service -from google.longrunning import operations_pb2 as operations # type: ignore - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class OfflineUserDataJobServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for OfflineUserDataJobService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.create_offline_user_data_job: gapic_v1.method.wrap_method( - self.create_offline_user_data_job, - default_timeout=None, - client_info=client_info, - ), - self.get_offline_user_data_job: gapic_v1.method.wrap_method( - self.get_offline_user_data_job, - default_timeout=None, - client_info=client_info, - ), - self.add_offline_user_data_job_operations: gapic_v1.method.wrap_method( - self.add_offline_user_data_job_operations, - default_timeout=None, - client_info=client_info, - ), - self.run_offline_user_data_job: gapic_v1.method.wrap_method( - self.run_offline_user_data_job, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Return the client designed to process long-running operations.""" - raise NotImplementedError - - @property - def create_offline_user_data_job( - self, - ) -> typing.Callable[ - [offline_user_data_job_service.CreateOfflineUserDataJobRequest], - offline_user_data_job_service.CreateOfflineUserDataJobResponse, - ]: - raise NotImplementedError - - @property - def get_offline_user_data_job( - self, - ) -> typing.Callable[ - [offline_user_data_job_service.GetOfflineUserDataJobRequest], - offline_user_data_job.OfflineUserDataJob, - ]: - raise NotImplementedError - - @property - def add_offline_user_data_job_operations( - self, - ) -> typing.Callable[ - [offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest], - offline_user_data_job_service.AddOfflineUserDataJobOperationsResponse, - ]: - raise NotImplementedError - - @property - def run_offline_user_data_job( - self, - ) -> typing.Callable[ - [offline_user_data_job_service.RunOfflineUserDataJobRequest], - operations.Operation, - ]: - raise NotImplementedError - - -__all__ = ("OfflineUserDataJobServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/grpc.py b/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/grpc.py deleted file mode 100644 index ce6ff5099..000000000 --- a/google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/grpc.py +++ /dev/null @@ -1,362 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import offline_user_data_job -from google.ads.googleads.v6.services.types import offline_user_data_job_service -from google.longrunning import operations_pb2 as operations # type: ignore - -from .base import OfflineUserDataJobServiceTransport, DEFAULT_CLIENT_INFO - - -class OfflineUserDataJobServiceGrpcTransport( - OfflineUserDataJobServiceTransport -): - """gRPC backend transport for OfflineUserDataJobService. - - Service to manage offline user data jobs. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def operations_client(self) -> operations_v1.OperationsClient: - """Create the client designed to process long-running operations. - - This property caches on the instance; repeated calls return the same - client. - """ - # Sanity check: Only create a new client if we do not already have one. - if "operations_client" not in self.__dict__: - self.__dict__["operations_client"] = operations_v1.OperationsClient( - self.grpc_channel - ) - - # Return the client from cache. - return self.__dict__["operations_client"] - - @property - def create_offline_user_data_job( - self, - ) -> Callable[ - [offline_user_data_job_service.CreateOfflineUserDataJobRequest], - offline_user_data_job_service.CreateOfflineUserDataJobResponse, - ]: - r"""Return a callable for the create offline user data job method over gRPC. - - Creates an offline user data job. - - Returns: - Callable[[~.CreateOfflineUserDataJobRequest], - ~.CreateOfflineUserDataJobResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "create_offline_user_data_job" not in self._stubs: - self._stubs[ - "create_offline_user_data_job" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.OfflineUserDataJobService/CreateOfflineUserDataJob", - request_serializer=offline_user_data_job_service.CreateOfflineUserDataJobRequest.serialize, - response_deserializer=offline_user_data_job_service.CreateOfflineUserDataJobResponse.deserialize, - ) - return self._stubs["create_offline_user_data_job"] - - @property - def get_offline_user_data_job( - self, - ) -> Callable[ - [offline_user_data_job_service.GetOfflineUserDataJobRequest], - offline_user_data_job.OfflineUserDataJob, - ]: - r"""Return a callable for the get offline user data job method over gRPC. - - Returns the offline user data job. - - Returns: - Callable[[~.GetOfflineUserDataJobRequest], - ~.OfflineUserDataJob]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_offline_user_data_job" not in self._stubs: - self._stubs[ - "get_offline_user_data_job" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.OfflineUserDataJobService/GetOfflineUserDataJob", - request_serializer=offline_user_data_job_service.GetOfflineUserDataJobRequest.serialize, - response_deserializer=offline_user_data_job.OfflineUserDataJob.deserialize, - ) - return self._stubs["get_offline_user_data_job"] - - @property - def add_offline_user_data_job_operations( - self, - ) -> Callable[ - [offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest], - offline_user_data_job_service.AddOfflineUserDataJobOperationsResponse, - ]: - r"""Return a callable for the add offline user data job - operations method over gRPC. - - Adds operations to the offline user data job. - - Returns: - Callable[[~.AddOfflineUserDataJobOperationsRequest], - ~.AddOfflineUserDataJobOperationsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "add_offline_user_data_job_operations" not in self._stubs: - self._stubs[ - "add_offline_user_data_job_operations" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.OfflineUserDataJobService/AddOfflineUserDataJobOperations", - request_serializer=offline_user_data_job_service.AddOfflineUserDataJobOperationsRequest.serialize, - response_deserializer=offline_user_data_job_service.AddOfflineUserDataJobOperationsResponse.deserialize, - ) - return self._stubs["add_offline_user_data_job_operations"] - - @property - def run_offline_user_data_job( - self, - ) -> Callable[ - [offline_user_data_job_service.RunOfflineUserDataJobRequest], - operations.Operation, - ]: - r"""Return a callable for the run offline user data job method over gRPC. - - Runs the offline user data job. - When finished, the long running operation will contain - the processing result or failure information, if any. - - Returns: - Callable[[~.RunOfflineUserDataJobRequest], - ~.Operation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "run_offline_user_data_job" not in self._stubs: - self._stubs[ - "run_offline_user_data_job" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.OfflineUserDataJobService/RunOfflineUserDataJob", - request_serializer=offline_user_data_job_service.RunOfflineUserDataJobRequest.serialize, - response_deserializer=operations.Operation.FromString, - ) - return self._stubs["run_offline_user_data_job"] - - -__all__ = ("OfflineUserDataJobServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/__init__.py b/google/ads/googleads/v6/services/services/operating_system_version_constant_service/__init__.py deleted file mode 100644 index ab00107f9..000000000 --- a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import OperatingSystemVersionConstantServiceClient - -__all__ = ("OperatingSystemVersionConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/client.py b/google/ads/googleads/v6/services/services/operating_system_version_constant_service/client.py deleted file mode 100644 index 8aa8f5fb4..000000000 --- a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/client.py +++ /dev/null @@ -1,458 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - operating_system_version_constant, -) -from google.ads.googleads.v6.services.types import ( - operating_system_version_constant_service, -) - -from .transports.base import ( - OperatingSystemVersionConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import OperatingSystemVersionConstantServiceGrpcTransport - - -class OperatingSystemVersionConstantServiceClientMeta(type): - """Metaclass for the OperatingSystemVersionConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[OperatingSystemVersionConstantServiceTransport]] - _transport_registry[ - "grpc" - ] = OperatingSystemVersionConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[OperatingSystemVersionConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class OperatingSystemVersionConstantServiceClient( - metaclass=OperatingSystemVersionConstantServiceClientMeta -): - """Service to fetch Operating System Version constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - OperatingSystemVersionConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - OperatingSystemVersionConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> OperatingSystemVersionConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - OperatingSystemVersionConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def operating_system_version_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified operating_system_version_constant string.""" - return "operatingSystemVersionConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_operating_system_version_constant_path( - path: str, - ) -> Dict[str, str]: - """Parse a operating_system_version_constant path into its component segments.""" - m = re.match( - r"^operatingSystemVersionConstants/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, OperatingSystemVersionConstantServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the operating system version constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.OperatingSystemVersionConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance( - transport, OperatingSystemVersionConstantServiceTransport - ): - # transport is a OperatingSystemVersionConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = OperatingSystemVersionConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_operating_system_version_constant( - self, - request: operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> operating_system_version_constant.OperatingSystemVersionConstant: - r"""Returns the requested OS version constant in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetOperatingSystemVersionConstantRequest`): - The request object. Request message for - [OperatingSystemVersionConstantService.GetOperatingSystemVersionConstant][google.ads.googleads.v6.services.OperatingSystemVersionConstantService.GetOperatingSystemVersionConstant]. - resource_name (:class:`str`): - Required. Resource name of the OS - version to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.OperatingSystemVersionConstant: - A mobile operating system version or a range of versions, depending on - operator_type. List of available mobile platforms at - https://developers.google.com/adwords/api/docs/appendix/codes-formats#mobile-platforms - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest, - ): - request = operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_operating_system_version_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("OperatingSystemVersionConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/__init__.py deleted file mode 100644 index 7049449c4..000000000 --- a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import OperatingSystemVersionConstantServiceTransport -from .grpc import OperatingSystemVersionConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[OperatingSystemVersionConstantServiceTransport]] -_transport_registry["grpc"] = OperatingSystemVersionConstantServiceGrpcTransport - - -__all__ = ( - "OperatingSystemVersionConstantServiceTransport", - "OperatingSystemVersionConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/base.py deleted file mode 100644 index ceeeea2cf..000000000 --- a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - operating_system_version_constant, -) -from google.ads.googleads.v6.services.types import ( - operating_system_version_constant_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class OperatingSystemVersionConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for OperatingSystemVersionConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_operating_system_version_constant: gapic_v1.method.wrap_method( - self.get_operating_system_version_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_operating_system_version_constant( - self, - ) -> typing.Callable[ - [ - operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest - ], - operating_system_version_constant.OperatingSystemVersionConstant, - ]: - raise NotImplementedError - - -__all__ = ("OperatingSystemVersionConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/grpc.py deleted file mode 100644 index 68e423678..000000000 --- a/google/ads/googleads/v6/services/services/operating_system_version_constant_service/transports/grpc.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - operating_system_version_constant, -) -from google.ads.googleads.v6.services.types import ( - operating_system_version_constant_service, -) - -from .base import ( - OperatingSystemVersionConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class OperatingSystemVersionConstantServiceGrpcTransport( - OperatingSystemVersionConstantServiceTransport -): - """gRPC backend transport for OperatingSystemVersionConstantService. - - Service to fetch Operating System Version constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_operating_system_version_constant( - self, - ) -> Callable[ - [ - operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest - ], - operating_system_version_constant.OperatingSystemVersionConstant, - ]: - r"""Return a callable for the get operating system version - constant method over gRPC. - - Returns the requested OS version constant in full - detail. - - Returns: - Callable[[~.GetOperatingSystemVersionConstantRequest], - ~.OperatingSystemVersionConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_operating_system_version_constant" not in self._stubs: - self._stubs[ - "get_operating_system_version_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.OperatingSystemVersionConstantService/GetOperatingSystemVersionConstant", - request_serializer=operating_system_version_constant_service.GetOperatingSystemVersionConstantRequest.serialize, - response_deserializer=operating_system_version_constant.OperatingSystemVersionConstant.deserialize, - ) - return self._stubs["get_operating_system_version_constant"] - - -__all__ = ("OperatingSystemVersionConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/__init__.py b/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/__init__.py deleted file mode 100644 index cfcf10d19..000000000 --- a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import PaidOrganicSearchTermViewServiceClient - -__all__ = ("PaidOrganicSearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/client.py b/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/client.py deleted file mode 100644 index 2f0ae4bcd..000000000 --- a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/client.py +++ /dev/null @@ -1,462 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - paid_organic_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - paid_organic_search_term_view_service, -) - -from .transports.base import ( - PaidOrganicSearchTermViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import PaidOrganicSearchTermViewServiceGrpcTransport - - -class PaidOrganicSearchTermViewServiceClientMeta(type): - """Metaclass for the PaidOrganicSearchTermViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[PaidOrganicSearchTermViewServiceTransport]] - _transport_registry["grpc"] = PaidOrganicSearchTermViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[PaidOrganicSearchTermViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class PaidOrganicSearchTermViewServiceClient( - metaclass=PaidOrganicSearchTermViewServiceClientMeta -): - """Service to fetch paid organic search term views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - PaidOrganicSearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - PaidOrganicSearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> PaidOrganicSearchTermViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - PaidOrganicSearchTermViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def paid_organic_search_term_view_path( - customer_id: str, - campaign_id: str, - ad_group_id: str, - base64_search_term: str, - ) -> str: - """Return a fully-qualified paid_organic_search_term_view string.""" - return "customers/{customer_id}/paidOrganicSearchTermViews/{campaign_id}~{ad_group_id}~{base64_search_term}".format( - customer_id=customer_id, - campaign_id=campaign_id, - ad_group_id=ad_group_id, - base64_search_term=base64_search_term, - ) - - @staticmethod - def parse_paid_organic_search_term_view_path(path: str) -> Dict[str, str]: - """Parse a paid_organic_search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/paidOrganicSearchTermViews/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, PaidOrganicSearchTermViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the paid organic search term view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.PaidOrganicSearchTermViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, PaidOrganicSearchTermViewServiceTransport): - # transport is a PaidOrganicSearchTermViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = PaidOrganicSearchTermViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_paid_organic_search_term_view( - self, - request: paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> paid_organic_search_term_view.PaidOrganicSearchTermView: - r"""Returns the requested paid organic search term view - in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetPaidOrganicSearchTermViewRequest`): - The request object. Request message for - [PaidOrganicSearchTermViewService.GetPaidOrganicSearchTermView][google.ads.googleads.v6.services.PaidOrganicSearchTermViewService.GetPaidOrganicSearchTermView]. - resource_name (:class:`str`): - Required. The resource name of the - paid organic search term view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.PaidOrganicSearchTermView: - A paid organic search term view - providing a view of search stats across - ads and organic listings aggregated by - search term at the ad group level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest, - ): - request = paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_paid_organic_search_term_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("PaidOrganicSearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/__init__.py deleted file mode 100644 index dfaccb904..000000000 --- a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import PaidOrganicSearchTermViewServiceTransport -from .grpc import PaidOrganicSearchTermViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[PaidOrganicSearchTermViewServiceTransport]] -_transport_registry["grpc"] = PaidOrganicSearchTermViewServiceGrpcTransport - - -__all__ = ( - "PaidOrganicSearchTermViewServiceTransport", - "PaidOrganicSearchTermViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/base.py b/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/base.py deleted file mode 100644 index ab6f0c940..000000000 --- a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - paid_organic_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - paid_organic_search_term_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class PaidOrganicSearchTermViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for PaidOrganicSearchTermViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_paid_organic_search_term_view: gapic_v1.method.wrap_method( - self.get_paid_organic_search_term_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_paid_organic_search_term_view( - self, - ) -> typing.Callable[ - [ - paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest - ], - paid_organic_search_term_view.PaidOrganicSearchTermView, - ]: - raise NotImplementedError - - -__all__ = ("PaidOrganicSearchTermViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/grpc.py deleted file mode 100644 index 2efe7d376..000000000 --- a/google/ads/googleads/v6/services/services/paid_organic_search_term_view_service/transports/grpc.py +++ /dev/null @@ -1,256 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - paid_organic_search_term_view, -) -from google.ads.googleads.v6.services.types import ( - paid_organic_search_term_view_service, -) - -from .base import PaidOrganicSearchTermViewServiceTransport, DEFAULT_CLIENT_INFO - - -class PaidOrganicSearchTermViewServiceGrpcTransport( - PaidOrganicSearchTermViewServiceTransport -): - """gRPC backend transport for PaidOrganicSearchTermViewService. - - Service to fetch paid organic search term views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_paid_organic_search_term_view( - self, - ) -> Callable[ - [ - paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest - ], - paid_organic_search_term_view.PaidOrganicSearchTermView, - ]: - r"""Return a callable for the get paid organic search term - view method over gRPC. - - Returns the requested paid organic search term view - in full detail. - - Returns: - Callable[[~.GetPaidOrganicSearchTermViewRequest], - ~.PaidOrganicSearchTermView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_paid_organic_search_term_view" not in self._stubs: - self._stubs[ - "get_paid_organic_search_term_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.PaidOrganicSearchTermViewService/GetPaidOrganicSearchTermView", - request_serializer=paid_organic_search_term_view_service.GetPaidOrganicSearchTermViewRequest.serialize, - response_deserializer=paid_organic_search_term_view.PaidOrganicSearchTermView.deserialize, - ) - return self._stubs["get_paid_organic_search_term_view"] - - -__all__ = ("PaidOrganicSearchTermViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/parental_status_view_service/__init__.py b/google/ads/googleads/v6/services/services/parental_status_view_service/__init__.py deleted file mode 100644 index 54086b702..000000000 --- a/google/ads/googleads/v6/services/services/parental_status_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ParentalStatusViewServiceClient - -__all__ = ("ParentalStatusViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/parental_status_view_service/client.py b/google/ads/googleads/v6/services/services/parental_status_view_service/client.py deleted file mode 100644 index 6cc5a9058..000000000 --- a/google/ads/googleads/v6/services/services/parental_status_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import parental_status_view -from google.ads.googleads.v6.services.types import parental_status_view_service - -from .transports.base import ( - ParentalStatusViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ParentalStatusViewServiceGrpcTransport - - -class ParentalStatusViewServiceClientMeta(type): - """Metaclass for the ParentalStatusViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ParentalStatusViewServiceTransport]] - _transport_registry["grpc"] = ParentalStatusViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ParentalStatusViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ParentalStatusViewServiceClient( - metaclass=ParentalStatusViewServiceClientMeta -): - """Service to manage parental status views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ParentalStatusViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ParentalStatusViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ParentalStatusViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ParentalStatusViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def parental_status_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified parental_status_view string.""" - return "customers/{customer_id}/parentalStatusViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_parental_status_view_path(path: str) -> Dict[str, str]: - """Parse a parental_status_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/parentalStatusViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ParentalStatusViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the parental status view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ParentalStatusViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ParentalStatusViewServiceTransport): - # transport is a ParentalStatusViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ParentalStatusViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_parental_status_view( - self, - request: parental_status_view_service.GetParentalStatusViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> parental_status_view.ParentalStatusView: - r"""Returns the requested parental status view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetParentalStatusViewRequest`): - The request object. Request message for - [ParentalStatusViewService.GetParentalStatusView][google.ads.googleads.v6.services.ParentalStatusViewService.GetParentalStatusView]. - resource_name (:class:`str`): - Required. The resource name of the - parental status view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ParentalStatusView: - A parental status view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a parental_status_view_service.GetParentalStatusViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, parental_status_view_service.GetParentalStatusViewRequest - ): - request = parental_status_view_service.GetParentalStatusViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_parental_status_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ParentalStatusViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/parental_status_view_service/transports/__init__.py deleted file mode 100644 index e34fe0f83..000000000 --- a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ParentalStatusViewServiceTransport -from .grpc import ParentalStatusViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ParentalStatusViewServiceTransport]] -_transport_registry["grpc"] = ParentalStatusViewServiceGrpcTransport - - -__all__ = ( - "ParentalStatusViewServiceTransport", - "ParentalStatusViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/base.py b/google/ads/googleads/v6/services/services/parental_status_view_service/transports/base.py deleted file mode 100644 index 67fa3d65a..000000000 --- a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import parental_status_view -from google.ads.googleads.v6.services.types import parental_status_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ParentalStatusViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ParentalStatusViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_parental_status_view: gapic_v1.method.wrap_method( - self.get_parental_status_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_parental_status_view( - self, - ) -> typing.Callable[ - [parental_status_view_service.GetParentalStatusViewRequest], - parental_status_view.ParentalStatusView, - ]: - raise NotImplementedError - - -__all__ = ("ParentalStatusViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/parental_status_view_service/transports/grpc.py deleted file mode 100644 index 2b063ae3c..000000000 --- a/google/ads/googleads/v6/services/services/parental_status_view_service/transports/grpc.py +++ /dev/null @@ -1,249 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import parental_status_view -from google.ads.googleads.v6.services.types import parental_status_view_service - -from .base import ParentalStatusViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ParentalStatusViewServiceGrpcTransport( - ParentalStatusViewServiceTransport -): - """gRPC backend transport for ParentalStatusViewService. - - Service to manage parental status views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_parental_status_view( - self, - ) -> Callable[ - [parental_status_view_service.GetParentalStatusViewRequest], - parental_status_view.ParentalStatusView, - ]: - r"""Return a callable for the get parental status view method over gRPC. - - Returns the requested parental status view in full - detail. - - Returns: - Callable[[~.GetParentalStatusViewRequest], - ~.ParentalStatusView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_parental_status_view" not in self._stubs: - self._stubs[ - "get_parental_status_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ParentalStatusViewService/GetParentalStatusView", - request_serializer=parental_status_view_service.GetParentalStatusViewRequest.serialize, - response_deserializer=parental_status_view.ParentalStatusView.deserialize, - ) - return self._stubs["get_parental_status_view"] - - -__all__ = ("ParentalStatusViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/payments_account_service/__init__.py b/google/ads/googleads/v6/services/services/payments_account_service/__init__.py deleted file mode 100644 index 973fdfaaa..000000000 --- a/google/ads/googleads/v6/services/services/payments_account_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import PaymentsAccountServiceClient - -__all__ = ("PaymentsAccountServiceClient",) diff --git a/google/ads/googleads/v6/services/services/payments_account_service/client.py b/google/ads/googleads/v6/services/services/payments_account_service/client.py deleted file mode 100644 index 4dfaace10..000000000 --- a/google/ads/googleads/v6/services/services/payments_account_service/client.py +++ /dev/null @@ -1,459 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.types import payments_account_service - -from .transports.base import ( - PaymentsAccountServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import PaymentsAccountServiceGrpcTransport - - -class PaymentsAccountServiceClientMeta(type): - """Metaclass for the PaymentsAccountService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[PaymentsAccountServiceTransport]] - _transport_registry["grpc"] = PaymentsAccountServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[PaymentsAccountServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class PaymentsAccountServiceClient(metaclass=PaymentsAccountServiceClientMeta): - """Service to provide payments accounts that can be used to set - up consolidated billing. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - PaymentsAccountServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - PaymentsAccountServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> PaymentsAccountServiceTransport: - """Return the transport used by the client instance. - - Returns: - PaymentsAccountServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def customer_path(customer_id: str,) -> str: - """Return a fully-qualified customer string.""" - return "customers/{customer_id}".format(customer_id=customer_id,) - - @staticmethod - def parse_customer_path(path: str) -> Dict[str, str]: - """Parse a customer path into its component segments.""" - m = re.match(r"^customers/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def payments_account_path( - customer_id: str, payments_account_id: str, - ) -> str: - """Return a fully-qualified payments_account string.""" - return "customers/{customer_id}/paymentsAccounts/{payments_account_id}".format( - customer_id=customer_id, payments_account_id=payments_account_id, - ) - - @staticmethod - def parse_payments_account_path(path: str) -> Dict[str, str]: - """Parse a payments_account path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/paymentsAccounts/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, PaymentsAccountServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the payments account service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.PaymentsAccountServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, PaymentsAccountServiceTransport): - # transport is a PaymentsAccountServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = PaymentsAccountServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def list_payments_accounts( - self, - request: payments_account_service.ListPaymentsAccountsRequest = None, - *, - customer_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> payments_account_service.ListPaymentsAccountsResponse: - r"""Returns all payments accounts associated with all - managers between the login customer ID and specified - serving customer in the hierarchy, inclusive. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListPaymentsAccountsRequest`): - The request object. Request message for fetching all - accessible payments accounts. - customer_id (:class:`str`): - Required. The ID of the customer to - apply the PaymentsAccount list operation - to. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListPaymentsAccountsResponse: - Response message for - [PaymentsAccountService.ListPaymentsAccounts][google.ads.googleads.v6.services.PaymentsAccountService.ListPaymentsAccounts]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a payments_account_service.ListPaymentsAccountsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, payments_account_service.ListPaymentsAccountsRequest - ): - request = payments_account_service.ListPaymentsAccountsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_payments_accounts - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("PaymentsAccountServiceClient",) diff --git a/google/ads/googleads/v6/services/services/payments_account_service/transports/__init__.py b/google/ads/googleads/v6/services/services/payments_account_service/transports/__init__.py deleted file mode 100644 index 588164956..000000000 --- a/google/ads/googleads/v6/services/services/payments_account_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import PaymentsAccountServiceTransport -from .grpc import PaymentsAccountServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[PaymentsAccountServiceTransport]] -_transport_registry["grpc"] = PaymentsAccountServiceGrpcTransport - - -__all__ = ( - "PaymentsAccountServiceTransport", - "PaymentsAccountServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/payments_account_service/transports/base.py b/google/ads/googleads/v6/services/services/payments_account_service/transports/base.py deleted file mode 100644 index 893692a7a..000000000 --- a/google/ads/googleads/v6/services/services/payments_account_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import payments_account_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class PaymentsAccountServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for PaymentsAccountService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.list_payments_accounts: gapic_v1.method.wrap_method( - self.list_payments_accounts, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def list_payments_accounts( - self, - ) -> typing.Callable[ - [payments_account_service.ListPaymentsAccountsRequest], - payments_account_service.ListPaymentsAccountsResponse, - ]: - raise NotImplementedError - - -__all__ = ("PaymentsAccountServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/payments_account_service/transports/grpc.py b/google/ads/googleads/v6/services/services/payments_account_service/transports/grpc.py deleted file mode 100644 index a76c9db54..000000000 --- a/google/ads/googleads/v6/services/services/payments_account_service/transports/grpc.py +++ /dev/null @@ -1,248 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import payments_account_service - -from .base import PaymentsAccountServiceTransport, DEFAULT_CLIENT_INFO - - -class PaymentsAccountServiceGrpcTransport(PaymentsAccountServiceTransport): - """gRPC backend transport for PaymentsAccountService. - - Service to provide payments accounts that can be used to set - up consolidated billing. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def list_payments_accounts( - self, - ) -> Callable[ - [payments_account_service.ListPaymentsAccountsRequest], - payments_account_service.ListPaymentsAccountsResponse, - ]: - r"""Return a callable for the list payments accounts method over gRPC. - - Returns all payments accounts associated with all - managers between the login customer ID and specified - serving customer in the hierarchy, inclusive. - - Returns: - Callable[[~.ListPaymentsAccountsRequest], - ~.ListPaymentsAccountsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_payments_accounts" not in self._stubs: - self._stubs[ - "list_payments_accounts" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.PaymentsAccountService/ListPaymentsAccounts", - request_serializer=payments_account_service.ListPaymentsAccountsRequest.serialize, - response_deserializer=payments_account_service.ListPaymentsAccountsResponse.deserialize, - ) - return self._stubs["list_payments_accounts"] - - -__all__ = ("PaymentsAccountServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/__init__.py b/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/__init__.py deleted file mode 100644 index 4baba467e..000000000 --- a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ProductBiddingCategoryConstantServiceClient - -__all__ = ("ProductBiddingCategoryConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/client.py b/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/client.py deleted file mode 100644 index cf85ae08f..000000000 --- a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/client.py +++ /dev/null @@ -1,458 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - product_bidding_category_constant, -) -from google.ads.googleads.v6.services.types import ( - product_bidding_category_constant_service, -) - -from .transports.base import ( - ProductBiddingCategoryConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ProductBiddingCategoryConstantServiceGrpcTransport - - -class ProductBiddingCategoryConstantServiceClientMeta(type): - """Metaclass for the ProductBiddingCategoryConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ProductBiddingCategoryConstantServiceTransport]] - _transport_registry[ - "grpc" - ] = ProductBiddingCategoryConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ProductBiddingCategoryConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ProductBiddingCategoryConstantServiceClient( - metaclass=ProductBiddingCategoryConstantServiceClientMeta -): - """Service to fetch Product Bidding Categories.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductBiddingCategoryConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductBiddingCategoryConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ProductBiddingCategoryConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - ProductBiddingCategoryConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def product_bidding_category_constant_path( - country_code: str, level: str, id: str, - ) -> str: - """Return a fully-qualified product_bidding_category_constant string.""" - return "productBiddingCategoryConstants/{country_code}~{level}~{id}".format( - country_code=country_code, level=level, id=id, - ) - - @staticmethod - def parse_product_bidding_category_constant_path( - path: str, - ) -> Dict[str, str]: - """Parse a product_bidding_category_constant path into its component segments.""" - m = re.match( - r"^productBiddingCategoryConstants/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ProductBiddingCategoryConstantServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the product bidding category constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ProductBiddingCategoryConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance( - transport, ProductBiddingCategoryConstantServiceTransport - ): - # transport is a ProductBiddingCategoryConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ProductBiddingCategoryConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_product_bidding_category_constant( - self, - request: product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> product_bidding_category_constant.ProductBiddingCategoryConstant: - r"""Returns the requested Product Bidding Category in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetProductBiddingCategoryConstantRequest`): - The request object. Request message for - [ProductBiddingCategoryConstantService.GetProductBiddingCategoryConstant][google.ads.googleads.v6.services.ProductBiddingCategoryConstantService.GetProductBiddingCategoryConstant]. - resource_name (:class:`str`): - Required. Resource name of the - Product Bidding Category to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ProductBiddingCategoryConstant: - A Product Bidding Category. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest, - ): - request = product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_product_bidding_category_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ProductBiddingCategoryConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/__init__.py deleted file mode 100644 index cf85671a2..000000000 --- a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ProductBiddingCategoryConstantServiceTransport -from .grpc import ProductBiddingCategoryConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ProductBiddingCategoryConstantServiceTransport]] -_transport_registry["grpc"] = ProductBiddingCategoryConstantServiceGrpcTransport - - -__all__ = ( - "ProductBiddingCategoryConstantServiceTransport", - "ProductBiddingCategoryConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/base.py deleted file mode 100644 index 58e76b874..000000000 --- a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/base.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - product_bidding_category_constant, -) -from google.ads.googleads.v6.services.types import ( - product_bidding_category_constant_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ProductBiddingCategoryConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ProductBiddingCategoryConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_product_bidding_category_constant: gapic_v1.method.wrap_method( - self.get_product_bidding_category_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_product_bidding_category_constant( - self, - ) -> typing.Callable[ - [ - product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest - ], - product_bidding_category_constant.ProductBiddingCategoryConstant, - ]: - raise NotImplementedError - - -__all__ = ("ProductBiddingCategoryConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/grpc.py deleted file mode 100644 index da3a8c9e4..000000000 --- a/google/ads/googleads/v6/services/services/product_bidding_category_constant_service/transports/grpc.py +++ /dev/null @@ -1,259 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - product_bidding_category_constant, -) -from google.ads.googleads.v6.services.types import ( - product_bidding_category_constant_service, -) - -from .base import ( - ProductBiddingCategoryConstantServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class ProductBiddingCategoryConstantServiceGrpcTransport( - ProductBiddingCategoryConstantServiceTransport -): - """gRPC backend transport for ProductBiddingCategoryConstantService. - - Service to fetch Product Bidding Categories. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_product_bidding_category_constant( - self, - ) -> Callable[ - [ - product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest - ], - product_bidding_category_constant.ProductBiddingCategoryConstant, - ]: - r"""Return a callable for the get product bidding category - constant method over gRPC. - - Returns the requested Product Bidding Category in - full detail. - - Returns: - Callable[[~.GetProductBiddingCategoryConstantRequest], - ~.ProductBiddingCategoryConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_product_bidding_category_constant" not in self._stubs: - self._stubs[ - "get_product_bidding_category_constant" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ProductBiddingCategoryConstantService/GetProductBiddingCategoryConstant", - request_serializer=product_bidding_category_constant_service.GetProductBiddingCategoryConstantRequest.serialize, - response_deserializer=product_bidding_category_constant.ProductBiddingCategoryConstant.deserialize, - ) - return self._stubs["get_product_bidding_category_constant"] - - -__all__ = ("ProductBiddingCategoryConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/product_group_view_service/__init__.py b/google/ads/googleads/v6/services/services/product_group_view_service/__init__.py deleted file mode 100644 index 9f590fcb4..000000000 --- a/google/ads/googleads/v6/services/services/product_group_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ProductGroupViewServiceClient - -__all__ = ("ProductGroupViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/product_group_view_service/client.py b/google/ads/googleads/v6/services/services/product_group_view_service/client.py deleted file mode 100644 index a5c260ed8..000000000 --- a/google/ads/googleads/v6/services/services/product_group_view_service/client.py +++ /dev/null @@ -1,447 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import product_group_view -from google.ads.googleads.v6.services.types import product_group_view_service - -from .transports.base import ( - ProductGroupViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ProductGroupViewServiceGrpcTransport - - -class ProductGroupViewServiceClientMeta(type): - """Metaclass for the ProductGroupViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ProductGroupViewServiceTransport]] - _transport_registry["grpc"] = ProductGroupViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ProductGroupViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ProductGroupViewServiceClient( - metaclass=ProductGroupViewServiceClientMeta -): - """Service to manage product group views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductGroupViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ProductGroupViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ProductGroupViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ProductGroupViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def product_group_view_path( - customer_id: str, adgroup_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified product_group_view string.""" - return "customers/{customer_id}/productGroupViews/{adgroup_id}~{criterion_id}".format( - customer_id=customer_id, - adgroup_id=adgroup_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_product_group_view_path(path: str) -> Dict[str, str]: - """Parse a product_group_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/productGroupViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ProductGroupViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the product group view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ProductGroupViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ProductGroupViewServiceTransport): - # transport is a ProductGroupViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ProductGroupViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_product_group_view( - self, - request: product_group_view_service.GetProductGroupViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> product_group_view.ProductGroupView: - r"""Returns the requested product group view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetProductGroupViewRequest`): - The request object. Request message for - [ProductGroupViewService.GetProductGroupView][google.ads.googleads.v6.services.ProductGroupViewService.GetProductGroupView]. - resource_name (:class:`str`): - Required. The resource name of the - product group view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ProductGroupView: - A product group view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a product_group_view_service.GetProductGroupViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, product_group_view_service.GetProductGroupViewRequest - ): - request = product_group_view_service.GetProductGroupViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_product_group_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ProductGroupViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/product_group_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/product_group_view_service/transports/__init__.py deleted file mode 100644 index 4d9cfd8cf..000000000 --- a/google/ads/googleads/v6/services/services/product_group_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ProductGroupViewServiceTransport -from .grpc import ProductGroupViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ProductGroupViewServiceTransport]] -_transport_registry["grpc"] = ProductGroupViewServiceGrpcTransport - - -__all__ = ( - "ProductGroupViewServiceTransport", - "ProductGroupViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/product_group_view_service/transports/base.py b/google/ads/googleads/v6/services/services/product_group_view_service/transports/base.py deleted file mode 100644 index a9ccb9367..000000000 --- a/google/ads/googleads/v6/services/services/product_group_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import product_group_view -from google.ads.googleads.v6.services.types import product_group_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ProductGroupViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ProductGroupViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_product_group_view: gapic_v1.method.wrap_method( - self.get_product_group_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_product_group_view( - self, - ) -> typing.Callable[ - [product_group_view_service.GetProductGroupViewRequest], - product_group_view.ProductGroupView, - ]: - raise NotImplementedError - - -__all__ = ("ProductGroupViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/product_group_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/product_group_view_service/transports/grpc.py deleted file mode 100644 index ba1e17dbe..000000000 --- a/google/ads/googleads/v6/services/services/product_group_view_service/transports/grpc.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import product_group_view -from google.ads.googleads.v6.services.types import product_group_view_service - -from .base import ProductGroupViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ProductGroupViewServiceGrpcTransport(ProductGroupViewServiceTransport): - """gRPC backend transport for ProductGroupViewService. - - Service to manage product group views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_product_group_view( - self, - ) -> Callable[ - [product_group_view_service.GetProductGroupViewRequest], - product_group_view.ProductGroupView, - ]: - r"""Return a callable for the get product group view method over gRPC. - - Returns the requested product group view in full - detail. - - Returns: - Callable[[~.GetProductGroupViewRequest], - ~.ProductGroupView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_product_group_view" not in self._stubs: - self._stubs[ - "get_product_group_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ProductGroupViewService/GetProductGroupView", - request_serializer=product_group_view_service.GetProductGroupViewRequest.serialize, - response_deserializer=product_group_view.ProductGroupView.deserialize, - ) - return self._stubs["get_product_group_view"] - - -__all__ = ("ProductGroupViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/reach_plan_service/__init__.py b/google/ads/googleads/v6/services/services/reach_plan_service/__init__.py deleted file mode 100644 index ed7f5f631..000000000 --- a/google/ads/googleads/v6/services/services/reach_plan_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ReachPlanServiceClient - -__all__ = ("ReachPlanServiceClient",) diff --git a/google/ads/googleads/v6/services/services/reach_plan_service/client.py b/google/ads/googleads/v6/services/services/reach_plan_service/client.py deleted file mode 100644 index eb0dd69ce..000000000 --- a/google/ads/googleads/v6/services/services/reach_plan_service/client.py +++ /dev/null @@ -1,687 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.types import reach_plan_service - -from .transports.base import ReachPlanServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import ReachPlanServiceGrpcTransport - - -class ReachPlanServiceClientMeta(type): - """Metaclass for the ReachPlanService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ReachPlanServiceTransport]] - _transport_registry["grpc"] = ReachPlanServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ReachPlanServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ReachPlanServiceClient(metaclass=ReachPlanServiceClientMeta): - """Reach Plan Service gives users information about audience - size that can be reached through advertisement on YouTube. In - particular, GenerateReachForecast provides estimated number of - people of specified demographics that can be reached by an ad in - a given market by a campaign of certain duration with a defined - budget. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ReachPlanServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ReachPlanServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ReachPlanServiceTransport: - """Return the transport used by the client instance. - - Returns: - ReachPlanServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, ReachPlanServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the reach plan service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ReachPlanServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ReachPlanServiceTransport): - # transport is a ReachPlanServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ReachPlanServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def list_plannable_locations( - self, - request: reach_plan_service.ListPlannableLocationsRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> reach_plan_service.ListPlannableLocationsResponse: - r"""Returns the list of plannable locations (for example, - countries & DMAs). - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListPlannableLocationsRequest`): - The request object. Request message for - [ReachPlanService.ListPlannableLocations][google.ads.googleads.v6.services.ReachPlanService.ListPlannableLocations]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListPlannableLocationsResponse: - The list of plannable locations. - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a reach_plan_service.ListPlannableLocationsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, reach_plan_service.ListPlannableLocationsRequest - ): - request = reach_plan_service.ListPlannableLocationsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_plannable_locations - ] - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def list_plannable_products( - self, - request: reach_plan_service.ListPlannableProductsRequest = None, - *, - plannable_location_id: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> reach_plan_service.ListPlannableProductsResponse: - r"""Returns the list of per-location plannable YouTube ad - formats with allowed targeting. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ListPlannableProductsRequest`): - The request object. Request to list available products - in a given location. - plannable_location_id (:class:`str`): - Required. The ID of the selected - location for planning. To list the - available plannable location ids use - ListPlannableLocations. - - This corresponds to the ``plannable_location_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ListPlannableProductsResponse: - A response with all available - products. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([plannable_location_id]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a reach_plan_service.ListPlannableProductsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, reach_plan_service.ListPlannableProductsRequest - ): - request = reach_plan_service.ListPlannableProductsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if plannable_location_id is not None: - request.plannable_location_id = plannable_location_id - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_plannable_products - ] - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_product_mix_ideas( - self, - request: reach_plan_service.GenerateProductMixIdeasRequest = None, - *, - customer_id: str = None, - plannable_location_id: str = None, - currency_code: str = None, - budget_micros: int = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> reach_plan_service.GenerateProductMixIdeasResponse: - r"""Generates a product mix ideas given a set of - preferences. This method helps the advertiser to obtain - a good mix of ad formats and budget allocations based on - its preferences. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateProductMixIdeasRequest`): - The request object. Request message for - [ReachPlanService.GenerateProductMixIdeas][google.ads.googleads.v6.services.ReachPlanService.GenerateProductMixIdeas]. - customer_id (:class:`str`): - Required. The ID of the customer. - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - plannable_location_id (:class:`str`): - Required. The ID of the location, - this is one of the ids returned by - ListPlannableLocations. - - This corresponds to the ``plannable_location_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - currency_code (:class:`str`): - Required. Currency code. - Three-character ISO 4217 currency code. - - This corresponds to the ``currency_code`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - budget_micros (:class:`int`): - Required. Total budget. - Amount in micros. One million is - equivalent to one unit. - - This corresponds to the ``budget_micros`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateProductMixIdeasResponse: - The suggested product mix. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, plannable_location_id, currency_code, budget_micros] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a reach_plan_service.GenerateProductMixIdeasRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, reach_plan_service.GenerateProductMixIdeasRequest - ): - request = reach_plan_service.GenerateProductMixIdeasRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if plannable_location_id is not None: - request.plannable_location_id = plannable_location_id - if currency_code is not None: - request.currency_code = currency_code - if budget_micros is not None: - request.budget_micros = budget_micros - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_product_mix_ideas - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def generate_reach_forecast( - self, - request: reach_plan_service.GenerateReachForecastRequest = None, - *, - customer_id: str = None, - campaign_duration: reach_plan_service.CampaignDuration = None, - planned_products: Sequence[reach_plan_service.PlannedProduct] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> reach_plan_service.GenerateReachForecastResponse: - r"""Generates a reach forecast for a given targeting / - product mix. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GenerateReachForecastRequest`): - The request object. Request message for - [ReachPlanService.GenerateReachForecast][google.ads.googleads.v6.services.ReachPlanService.GenerateReachForecast]. - customer_id (:class:`str`): - Required. The ID of the customer. - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - campaign_duration (:class:`google.ads.googleads.v6.services.types.CampaignDuration`): - Required. Campaign duration. - This corresponds to the ``campaign_duration`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - planned_products (:class:`Sequence[google.ads.googleads.v6.services.types.PlannedProduct]`): - Required. The products to be - forecast. The max number of allowed - planned products is 15. - - This corresponds to the ``planned_products`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.GenerateReachForecastResponse: - Response message containing the - generated reach curve. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any( - [customer_id, campaign_duration, planned_products] - ): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a reach_plan_service.GenerateReachForecastRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, reach_plan_service.GenerateReachForecastRequest - ): - request = reach_plan_service.GenerateReachForecastRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if campaign_duration is not None: - request.campaign_duration = campaign_duration - if planned_products is not None: - request.planned_products = planned_products - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.generate_reach_forecast - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ReachPlanServiceClient",) diff --git a/google/ads/googleads/v6/services/services/reach_plan_service/transports/__init__.py b/google/ads/googleads/v6/services/services/reach_plan_service/transports/__init__.py deleted file mode 100644 index 3c563edc1..000000000 --- a/google/ads/googleads/v6/services/services/reach_plan_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ReachPlanServiceTransport -from .grpc import ReachPlanServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ReachPlanServiceTransport]] -_transport_registry["grpc"] = ReachPlanServiceGrpcTransport - - -__all__ = ( - "ReachPlanServiceTransport", - "ReachPlanServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/reach_plan_service/transports/base.py b/google/ads/googleads/v6/services/services/reach_plan_service/transports/base.py deleted file mode 100644 index 686d91d9e..000000000 --- a/google/ads/googleads/v6/services/services/reach_plan_service/transports/base.py +++ /dev/null @@ -1,143 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import reach_plan_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ReachPlanServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ReachPlanService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.list_plannable_locations: gapic_v1.method.wrap_method( - self.list_plannable_locations, - default_timeout=None, - client_info=client_info, - ), - self.list_plannable_products: gapic_v1.method.wrap_method( - self.list_plannable_products, - default_timeout=None, - client_info=client_info, - ), - self.generate_product_mix_ideas: gapic_v1.method.wrap_method( - self.generate_product_mix_ideas, - default_timeout=None, - client_info=client_info, - ), - self.generate_reach_forecast: gapic_v1.method.wrap_method( - self.generate_reach_forecast, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def list_plannable_locations( - self, - ) -> typing.Callable[ - [reach_plan_service.ListPlannableLocationsRequest], - reach_plan_service.ListPlannableLocationsResponse, - ]: - raise NotImplementedError - - @property - def list_plannable_products( - self, - ) -> typing.Callable[ - [reach_plan_service.ListPlannableProductsRequest], - reach_plan_service.ListPlannableProductsResponse, - ]: - raise NotImplementedError - - @property - def generate_product_mix_ideas( - self, - ) -> typing.Callable[ - [reach_plan_service.GenerateProductMixIdeasRequest], - reach_plan_service.GenerateProductMixIdeasResponse, - ]: - raise NotImplementedError - - @property - def generate_reach_forecast( - self, - ) -> typing.Callable[ - [reach_plan_service.GenerateReachForecastRequest], - reach_plan_service.GenerateReachForecastResponse, - ]: - raise NotImplementedError - - -__all__ = ("ReachPlanServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/reach_plan_service/transports/grpc.py b/google/ads/googleads/v6/services/services/reach_plan_service/transports/grpc.py deleted file mode 100644 index 6e30fe349..000000000 --- a/google/ads/googleads/v6/services/services/reach_plan_service/transports/grpc.py +++ /dev/null @@ -1,349 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import reach_plan_service - -from .base import ReachPlanServiceTransport, DEFAULT_CLIENT_INFO - - -class ReachPlanServiceGrpcTransport(ReachPlanServiceTransport): - """gRPC backend transport for ReachPlanService. - - Reach Plan Service gives users information about audience - size that can be reached through advertisement on YouTube. In - particular, GenerateReachForecast provides estimated number of - people of specified demographics that can be reached by an ad in - a given market by a campaign of certain duration with a defined - budget. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def list_plannable_locations( - self, - ) -> Callable[ - [reach_plan_service.ListPlannableLocationsRequest], - reach_plan_service.ListPlannableLocationsResponse, - ]: - r"""Return a callable for the list plannable locations method over gRPC. - - Returns the list of plannable locations (for example, - countries & DMAs). - - Returns: - Callable[[~.ListPlannableLocationsRequest], - ~.ListPlannableLocationsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_plannable_locations" not in self._stubs: - self._stubs[ - "list_plannable_locations" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ReachPlanService/ListPlannableLocations", - request_serializer=reach_plan_service.ListPlannableLocationsRequest.serialize, - response_deserializer=reach_plan_service.ListPlannableLocationsResponse.deserialize, - ) - return self._stubs["list_plannable_locations"] - - @property - def list_plannable_products( - self, - ) -> Callable[ - [reach_plan_service.ListPlannableProductsRequest], - reach_plan_service.ListPlannableProductsResponse, - ]: - r"""Return a callable for the list plannable products method over gRPC. - - Returns the list of per-location plannable YouTube ad - formats with allowed targeting. - - Returns: - Callable[[~.ListPlannableProductsRequest], - ~.ListPlannableProductsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "list_plannable_products" not in self._stubs: - self._stubs[ - "list_plannable_products" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ReachPlanService/ListPlannableProducts", - request_serializer=reach_plan_service.ListPlannableProductsRequest.serialize, - response_deserializer=reach_plan_service.ListPlannableProductsResponse.deserialize, - ) - return self._stubs["list_plannable_products"] - - @property - def generate_product_mix_ideas( - self, - ) -> Callable[ - [reach_plan_service.GenerateProductMixIdeasRequest], - reach_plan_service.GenerateProductMixIdeasResponse, - ]: - r"""Return a callable for the generate product mix ideas method over gRPC. - - Generates a product mix ideas given a set of - preferences. This method helps the advertiser to obtain - a good mix of ad formats and budget allocations based on - its preferences. - - Returns: - Callable[[~.GenerateProductMixIdeasRequest], - ~.GenerateProductMixIdeasResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_product_mix_ideas" not in self._stubs: - self._stubs[ - "generate_product_mix_ideas" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ReachPlanService/GenerateProductMixIdeas", - request_serializer=reach_plan_service.GenerateProductMixIdeasRequest.serialize, - response_deserializer=reach_plan_service.GenerateProductMixIdeasResponse.deserialize, - ) - return self._stubs["generate_product_mix_ideas"] - - @property - def generate_reach_forecast( - self, - ) -> Callable[ - [reach_plan_service.GenerateReachForecastRequest], - reach_plan_service.GenerateReachForecastResponse, - ]: - r"""Return a callable for the generate reach forecast method over gRPC. - - Generates a reach forecast for a given targeting / - product mix. - - Returns: - Callable[[~.GenerateReachForecastRequest], - ~.GenerateReachForecastResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "generate_reach_forecast" not in self._stubs: - self._stubs[ - "generate_reach_forecast" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ReachPlanService/GenerateReachForecast", - request_serializer=reach_plan_service.GenerateReachForecastRequest.serialize, - response_deserializer=reach_plan_service.GenerateReachForecastResponse.deserialize, - ) - return self._stubs["generate_reach_forecast"] - - -__all__ = ("ReachPlanServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/recommendation_service/__init__.py b/google/ads/googleads/v6/services/services/recommendation_service/__init__.py deleted file mode 100644 index cc8b1fba9..000000000 --- a/google/ads/googleads/v6/services/services/recommendation_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import RecommendationServiceClient - -__all__ = ("RecommendationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/recommendation_service/client.py b/google/ads/googleads/v6/services/services/recommendation_service/client.py deleted file mode 100644 index bd1e4b637..000000000 --- a/google/ads/googleads/v6/services/services/recommendation_service/client.py +++ /dev/null @@ -1,692 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import recommendation -from google.ads.googleads.v6.services.types import recommendation_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import RecommendationServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import RecommendationServiceGrpcTransport - - -class RecommendationServiceClientMeta(type): - """Metaclass for the RecommendationService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[RecommendationServiceTransport]] - _transport_registry["grpc"] = RecommendationServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[RecommendationServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class RecommendationServiceClient(metaclass=RecommendationServiceClientMeta): - """Service to manage recommendations.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - RecommendationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - RecommendationServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> RecommendationServiceTransport: - """Return the transport used by the client instance. - - Returns: - RecommendationServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_path(customer_id: str, ad_id: str,) -> str: - """Return a fully-qualified ad string.""" - return "customers/{customer_id}/ads/{ad_id}".format( - customer_id=customer_id, ad_id=ad_id, - ) - - @staticmethod - def parse_ad_path(path: str) -> Dict[str, str]: - """Parse a ad path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/ads/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_budget_path(customer_id: str, campaign_budget_id: str,) -> str: - """Return a fully-qualified campaign_budget string.""" - return "customers/{customer_id}/campaignBudgets/{campaign_budget_id}".format( - customer_id=customer_id, campaign_budget_id=campaign_budget_id, - ) - - @staticmethod - def parse_campaign_budget_path(path: str) -> Dict[str, str]: - """Parse a campaign_budget path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaignBudgets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def recommendation_path(customer_id: str, recommendation_id: str,) -> str: - """Return a fully-qualified recommendation string.""" - return "customers/{customer_id}/recommendations/{recommendation_id}".format( - customer_id=customer_id, recommendation_id=recommendation_id, - ) - - @staticmethod - def parse_recommendation_path(path: str) -> Dict[str, str]: - """Parse a recommendation path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/recommendations/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, RecommendationServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the recommendation service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.RecommendationServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, RecommendationServiceTransport): - # transport is a RecommendationServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = RecommendationServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_recommendation( - self, - request: recommendation_service.GetRecommendationRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> recommendation.Recommendation: - r"""Returns the requested recommendation in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetRecommendationRequest`): - The request object. Request message for - [RecommendationService.GetRecommendation][google.ads.googleads.v6.services.RecommendationService.GetRecommendation]. - resource_name (:class:`str`): - Required. The resource name of the - recommendation to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Recommendation: - A recommendation. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a recommendation_service.GetRecommendationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, recommendation_service.GetRecommendationRequest - ): - request = recommendation_service.GetRecommendationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_recommendation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def apply_recommendation( - self, - request: recommendation_service.ApplyRecommendationRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - recommendation_service.ApplyRecommendationOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> recommendation_service.ApplyRecommendationResponse: - r"""Applies given recommendations with corresponding - apply parameters. - - Args: - request (:class:`google.ads.googleads.v6.services.types.ApplyRecommendationRequest`): - The request object. Request message for - [RecommendationService.ApplyRecommendation][google.ads.googleads.v6.services.RecommendationService.ApplyRecommendation]. - customer_id (:class:`str`): - Required. The ID of the customer with - the recommendation. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.ApplyRecommendationOperation]`): - Required. The list of operations to apply - recommendations. If partial_failure=false all - recommendations should be of the same type There is a - limit of 100 operations per request. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.ApplyRecommendationResponse: - Response message for - [RecommendationService.ApplyRecommendation][google.ads.googleads.v6.services.RecommendationService.ApplyRecommendation]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a recommendation_service.ApplyRecommendationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, recommendation_service.ApplyRecommendationRequest - ): - request = recommendation_service.ApplyRecommendationRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.apply_recommendation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def dismiss_recommendation( - self, - request: recommendation_service.DismissRecommendationRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - recommendation_service.DismissRecommendationRequest.DismissRecommendationOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> recommendation_service.DismissRecommendationResponse: - r"""Dismisses given recommendations. - - Args: - request (:class:`google.ads.googleads.v6.services.types.DismissRecommendationRequest`): - The request object. Request message for - [RecommendationService.DismissRecommendation][google.ads.googleads.v6.services.RecommendationService.DismissRecommendation]. - customer_id (:class:`str`): - Required. The ID of the customer with - the recommendation. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.DismissRecommendationRequest.DismissRecommendationOperation]`): - Required. The list of operations to dismiss - recommendations. If partial_failure=false all - recommendations should be of the same type There is a - limit of 100 operations per request. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.DismissRecommendationResponse: - Response message for - [RecommendationService.DismissRecommendation][google.ads.googleads.v6.services.RecommendationService.DismissRecommendation]. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a recommendation_service.DismissRecommendationRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, recommendation_service.DismissRecommendationRequest - ): - request = recommendation_service.DismissRecommendationRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.dismiss_recommendation - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("RecommendationServiceClient",) diff --git a/google/ads/googleads/v6/services/services/recommendation_service/transports/__init__.py b/google/ads/googleads/v6/services/services/recommendation_service/transports/__init__.py deleted file mode 100644 index 5bbe03bd4..000000000 --- a/google/ads/googleads/v6/services/services/recommendation_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import RecommendationServiceTransport -from .grpc import RecommendationServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[RecommendationServiceTransport]] -_transport_registry["grpc"] = RecommendationServiceGrpcTransport - - -__all__ = ( - "RecommendationServiceTransport", - "RecommendationServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/recommendation_service/transports/base.py b/google/ads/googleads/v6/services/services/recommendation_service/transports/base.py deleted file mode 100644 index 38bb0f3fe..000000000 --- a/google/ads/googleads/v6/services/services/recommendation_service/transports/base.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import recommendation -from google.ads.googleads.v6.services.types import recommendation_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class RecommendationServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for RecommendationService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_recommendation: gapic_v1.method.wrap_method( - self.get_recommendation, - default_timeout=None, - client_info=client_info, - ), - self.apply_recommendation: gapic_v1.method.wrap_method( - self.apply_recommendation, - default_timeout=None, - client_info=client_info, - ), - self.dismiss_recommendation: gapic_v1.method.wrap_method( - self.dismiss_recommendation, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_recommendation( - self, - ) -> typing.Callable[ - [recommendation_service.GetRecommendationRequest], - recommendation.Recommendation, - ]: - raise NotImplementedError - - @property - def apply_recommendation( - self, - ) -> typing.Callable[ - [recommendation_service.ApplyRecommendationRequest], - recommendation_service.ApplyRecommendationResponse, - ]: - raise NotImplementedError - - @property - def dismiss_recommendation( - self, - ) -> typing.Callable[ - [recommendation_service.DismissRecommendationRequest], - recommendation_service.DismissRecommendationResponse, - ]: - raise NotImplementedError - - -__all__ = ("RecommendationServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/recommendation_service/transports/grpc.py b/google/ads/googleads/v6/services/services/recommendation_service/transports/grpc.py deleted file mode 100644 index 691296ba6..000000000 --- a/google/ads/googleads/v6/services/services/recommendation_service/transports/grpc.py +++ /dev/null @@ -1,305 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import recommendation -from google.ads.googleads.v6.services.types import recommendation_service - -from .base import RecommendationServiceTransport, DEFAULT_CLIENT_INFO - - -class RecommendationServiceGrpcTransport(RecommendationServiceTransport): - """gRPC backend transport for RecommendationService. - - Service to manage recommendations. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_recommendation( - self, - ) -> Callable[ - [recommendation_service.GetRecommendationRequest], - recommendation.Recommendation, - ]: - r"""Return a callable for the get recommendation method over gRPC. - - Returns the requested recommendation in full detail. - - Returns: - Callable[[~.GetRecommendationRequest], - ~.Recommendation]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_recommendation" not in self._stubs: - self._stubs["get_recommendation"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.RecommendationService/GetRecommendation", - request_serializer=recommendation_service.GetRecommendationRequest.serialize, - response_deserializer=recommendation.Recommendation.deserialize, - ) - return self._stubs["get_recommendation"] - - @property - def apply_recommendation( - self, - ) -> Callable[ - [recommendation_service.ApplyRecommendationRequest], - recommendation_service.ApplyRecommendationResponse, - ]: - r"""Return a callable for the apply recommendation method over gRPC. - - Applies given recommendations with corresponding - apply parameters. - - Returns: - Callable[[~.ApplyRecommendationRequest], - ~.ApplyRecommendationResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "apply_recommendation" not in self._stubs: - self._stubs["apply_recommendation"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.RecommendationService/ApplyRecommendation", - request_serializer=recommendation_service.ApplyRecommendationRequest.serialize, - response_deserializer=recommendation_service.ApplyRecommendationResponse.deserialize, - ) - return self._stubs["apply_recommendation"] - - @property - def dismiss_recommendation( - self, - ) -> Callable[ - [recommendation_service.DismissRecommendationRequest], - recommendation_service.DismissRecommendationResponse, - ]: - r"""Return a callable for the dismiss recommendation method over gRPC. - - Dismisses given recommendations. - - Returns: - Callable[[~.DismissRecommendationRequest], - ~.DismissRecommendationResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "dismiss_recommendation" not in self._stubs: - self._stubs[ - "dismiss_recommendation" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.RecommendationService/DismissRecommendation", - request_serializer=recommendation_service.DismissRecommendationRequest.serialize, - response_deserializer=recommendation_service.DismissRecommendationResponse.deserialize, - ) - return self._stubs["dismiss_recommendation"] - - -__all__ = ("RecommendationServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/remarketing_action_service/__init__.py b/google/ads/googleads/v6/services/services/remarketing_action_service/__init__.py deleted file mode 100644 index 1a536ae18..000000000 --- a/google/ads/googleads/v6/services/services/remarketing_action_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import RemarketingActionServiceClient - -__all__ = ("RemarketingActionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/remarketing_action_service/client.py b/google/ads/googleads/v6/services/services/remarketing_action_service/client.py deleted file mode 100644 index 29b9dc215..000000000 --- a/google/ads/googleads/v6/services/services/remarketing_action_service/client.py +++ /dev/null @@ -1,551 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import remarketing_action -from google.ads.googleads.v6.services.types import remarketing_action_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - RemarketingActionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import RemarketingActionServiceGrpcTransport - - -class RemarketingActionServiceClientMeta(type): - """Metaclass for the RemarketingActionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[RemarketingActionServiceTransport]] - _transport_registry["grpc"] = RemarketingActionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[RemarketingActionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class RemarketingActionServiceClient( - metaclass=RemarketingActionServiceClientMeta -): - """Service to manage remarketing actions.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - RemarketingActionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - RemarketingActionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> RemarketingActionServiceTransport: - """Return the transport used by the client instance. - - Returns: - RemarketingActionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def remarketing_action_path( - customer_id: str, remarketing_action_id: str, - ) -> str: - """Return a fully-qualified remarketing_action string.""" - return "customers/{customer_id}/remarketingActions/{remarketing_action_id}".format( - customer_id=customer_id, - remarketing_action_id=remarketing_action_id, - ) - - @staticmethod - def parse_remarketing_action_path(path: str) -> Dict[str, str]: - """Parse a remarketing_action path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/remarketingActions/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, RemarketingActionServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the remarketing action service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.RemarketingActionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, RemarketingActionServiceTransport): - # transport is a RemarketingActionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = RemarketingActionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_remarketing_action( - self, - request: remarketing_action_service.GetRemarketingActionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> remarketing_action.RemarketingAction: - r"""Returns the requested remarketing action in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetRemarketingActionRequest`): - The request object. Request message for - [RemarketingActionService.GetRemarketingAction][google.ads.googleads.v6.services.RemarketingActionService.GetRemarketingAction]. - resource_name (:class:`str`): - Required. The resource name of the - remarketing action to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.RemarketingAction: - A remarketing action. A snippet of - JavaScript code that will collect the - product id and the type of page people - visited (product page, shopping cart - page, purchase page, general site visit) - on an advertiser's website. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a remarketing_action_service.GetRemarketingActionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, remarketing_action_service.GetRemarketingActionRequest - ): - request = remarketing_action_service.GetRemarketingActionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_remarketing_action - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_remarketing_actions( - self, - request: remarketing_action_service.MutateRemarketingActionsRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - remarketing_action_service.RemarketingActionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> remarketing_action_service.MutateRemarketingActionsResponse: - r"""Creates or updates remarketing actions. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateRemarketingActionsRequest`): - The request object. Request message for - [RemarketingActionService.MutateRemarketingActions][google.ads.googleads.v6.services.RemarketingActionService.MutateRemarketingActions]. - customer_id (:class:`str`): - Required. The ID of the customer - whose remarketing actions are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.RemarketingActionOperation]`): - Required. The list of operations to - perform on individual remarketing - actions. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateRemarketingActionsResponse: - Response message for remarketing - action mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a remarketing_action_service.MutateRemarketingActionsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, remarketing_action_service.MutateRemarketingActionsRequest - ): - request = remarketing_action_service.MutateRemarketingActionsRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_remarketing_actions - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("RemarketingActionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/__init__.py b/google/ads/googleads/v6/services/services/remarketing_action_service/transports/__init__.py deleted file mode 100644 index 2de3fe4cb..000000000 --- a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import RemarketingActionServiceTransport -from .grpc import RemarketingActionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[RemarketingActionServiceTransport]] -_transport_registry["grpc"] = RemarketingActionServiceGrpcTransport - - -__all__ = ( - "RemarketingActionServiceTransport", - "RemarketingActionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/base.py b/google/ads/googleads/v6/services/services/remarketing_action_service/transports/base.py deleted file mode 100644 index 4f5622d3e..000000000 --- a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import remarketing_action -from google.ads.googleads.v6.services.types import remarketing_action_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class RemarketingActionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for RemarketingActionService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_remarketing_action: gapic_v1.method.wrap_method( - self.get_remarketing_action, - default_timeout=None, - client_info=client_info, - ), - self.mutate_remarketing_actions: gapic_v1.method.wrap_method( - self.mutate_remarketing_actions, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_remarketing_action( - self, - ) -> typing.Callable[ - [remarketing_action_service.GetRemarketingActionRequest], - remarketing_action.RemarketingAction, - ]: - raise NotImplementedError - - @property - def mutate_remarketing_actions( - self, - ) -> typing.Callable[ - [remarketing_action_service.MutateRemarketingActionsRequest], - remarketing_action_service.MutateRemarketingActionsResponse, - ]: - raise NotImplementedError - - -__all__ = ("RemarketingActionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/grpc.py b/google/ads/googleads/v6/services/services/remarketing_action_service/transports/grpc.py deleted file mode 100644 index 514f4d915..000000000 --- a/google/ads/googleads/v6/services/services/remarketing_action_service/transports/grpc.py +++ /dev/null @@ -1,279 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import remarketing_action -from google.ads.googleads.v6.services.types import remarketing_action_service - -from .base import RemarketingActionServiceTransport, DEFAULT_CLIENT_INFO - - -class RemarketingActionServiceGrpcTransport(RemarketingActionServiceTransport): - """gRPC backend transport for RemarketingActionService. - - Service to manage remarketing actions. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_remarketing_action( - self, - ) -> Callable[ - [remarketing_action_service.GetRemarketingActionRequest], - remarketing_action.RemarketingAction, - ]: - r"""Return a callable for the get remarketing action method over gRPC. - - Returns the requested remarketing action in full - detail. - - Returns: - Callable[[~.GetRemarketingActionRequest], - ~.RemarketingAction]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_remarketing_action" not in self._stubs: - self._stubs[ - "get_remarketing_action" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.RemarketingActionService/GetRemarketingAction", - request_serializer=remarketing_action_service.GetRemarketingActionRequest.serialize, - response_deserializer=remarketing_action.RemarketingAction.deserialize, - ) - return self._stubs["get_remarketing_action"] - - @property - def mutate_remarketing_actions( - self, - ) -> Callable[ - [remarketing_action_service.MutateRemarketingActionsRequest], - remarketing_action_service.MutateRemarketingActionsResponse, - ]: - r"""Return a callable for the mutate remarketing actions method over gRPC. - - Creates or updates remarketing actions. Operation - statuses are returned. - - Returns: - Callable[[~.MutateRemarketingActionsRequest], - ~.MutateRemarketingActionsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_remarketing_actions" not in self._stubs: - self._stubs[ - "mutate_remarketing_actions" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.RemarketingActionService/MutateRemarketingActions", - request_serializer=remarketing_action_service.MutateRemarketingActionsRequest.serialize, - response_deserializer=remarketing_action_service.MutateRemarketingActionsResponse.deserialize, - ) - return self._stubs["mutate_remarketing_actions"] - - -__all__ = ("RemarketingActionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/search_term_view_service/__init__.py b/google/ads/googleads/v6/services/services/search_term_view_service/__init__.py deleted file mode 100644 index 3620493b9..000000000 --- a/google/ads/googleads/v6/services/services/search_term_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import SearchTermViewServiceClient - -__all__ = ("SearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/search_term_view_service/client.py b/google/ads/googleads/v6/services/services/search_term_view_service/client.py deleted file mode 100644 index ee1d51838..000000000 --- a/google/ads/googleads/v6/services/services/search_term_view_service/client.py +++ /dev/null @@ -1,460 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import search_term_view -from google.ads.googleads.v6.services.types import search_term_view_service - -from .transports.base import SearchTermViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import SearchTermViewServiceGrpcTransport - - -class SearchTermViewServiceClientMeta(type): - """Metaclass for the SearchTermViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[SearchTermViewServiceTransport]] - _transport_registry["grpc"] = SearchTermViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[SearchTermViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class SearchTermViewServiceClient(metaclass=SearchTermViewServiceClientMeta): - """Service to manage search term views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SearchTermViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> SearchTermViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - SearchTermViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def ad_group_path(customer_id: str, ad_group_id: str,) -> str: - """Return a fully-qualified ad_group string.""" - return "customers/{customer_id}/adGroups/{ad_group_id}".format( - customer_id=customer_id, ad_group_id=ad_group_id, - ) - - @staticmethod - def parse_ad_group_path(path: str) -> Dict[str, str]: - """Parse a ad_group path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/adGroups/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def search_term_view_path( - customer_id: str, campaign_id: str, ad_group_id: str, query: str, - ) -> str: - """Return a fully-qualified search_term_view string.""" - return "customers/{customer_id}/searchTermViews/{campaign_id}~{ad_group_id}~{query}".format( - customer_id=customer_id, - campaign_id=campaign_id, - ad_group_id=ad_group_id, - query=query, - ) - - @staticmethod - def parse_search_term_view_path(path: str) -> Dict[str, str]: - """Parse a search_term_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/searchTermViews/(?P.+?)~(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, SearchTermViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the search term view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.SearchTermViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, SearchTermViewServiceTransport): - # transport is a SearchTermViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = SearchTermViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_search_term_view( - self, - request: search_term_view_service.GetSearchTermViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> search_term_view.SearchTermView: - r"""Returns the attributes of the requested search term - view. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetSearchTermViewRequest`): - The request object. Request message for - [SearchTermViewService.GetSearchTermView][google.ads.googleads.v6.services.SearchTermViewService.GetSearchTermView]. - resource_name (:class:`str`): - Required. The resource name of the - search term view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.SearchTermView: - A search term view with metrics - aggregated by search term at the ad - group level. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a search_term_view_service.GetSearchTermViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, search_term_view_service.GetSearchTermViewRequest - ): - request = search_term_view_service.GetSearchTermViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_search_term_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("SearchTermViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/search_term_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/search_term_view_service/transports/__init__.py deleted file mode 100644 index be4d47c12..000000000 --- a/google/ads/googleads/v6/services/services/search_term_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import SearchTermViewServiceTransport -from .grpc import SearchTermViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[SearchTermViewServiceTransport]] -_transport_registry["grpc"] = SearchTermViewServiceGrpcTransport - - -__all__ = ( - "SearchTermViewServiceTransport", - "SearchTermViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/search_term_view_service/transports/base.py b/google/ads/googleads/v6/services/services/search_term_view_service/transports/base.py deleted file mode 100644 index 1a4c6d524..000000000 --- a/google/ads/googleads/v6/services/services/search_term_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import search_term_view -from google.ads.googleads.v6.services.types import search_term_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class SearchTermViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for SearchTermViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_search_term_view: gapic_v1.method.wrap_method( - self.get_search_term_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_search_term_view( - self, - ) -> typing.Callable[ - [search_term_view_service.GetSearchTermViewRequest], - search_term_view.SearchTermView, - ]: - raise NotImplementedError - - -__all__ = ("SearchTermViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/search_term_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/search_term_view_service/transports/grpc.py deleted file mode 100644 index ee493b506..000000000 --- a/google/ads/googleads/v6/services/services/search_term_view_service/transports/grpc.py +++ /dev/null @@ -1,245 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import search_term_view -from google.ads.googleads.v6.services.types import search_term_view_service - -from .base import SearchTermViewServiceTransport, DEFAULT_CLIENT_INFO - - -class SearchTermViewServiceGrpcTransport(SearchTermViewServiceTransport): - """gRPC backend transport for SearchTermViewService. - - Service to manage search term views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_search_term_view( - self, - ) -> Callable[ - [search_term_view_service.GetSearchTermViewRequest], - search_term_view.SearchTermView, - ]: - r"""Return a callable for the get search term view method over gRPC. - - Returns the attributes of the requested search term - view. - - Returns: - Callable[[~.GetSearchTermViewRequest], - ~.SearchTermView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_search_term_view" not in self._stubs: - self._stubs["get_search_term_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.SearchTermViewService/GetSearchTermView", - request_serializer=search_term_view_service.GetSearchTermViewRequest.serialize, - response_deserializer=search_term_view.SearchTermView.deserialize, - ) - return self._stubs["get_search_term_view"] - - -__all__ = ("SearchTermViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/shared_criterion_service/__init__.py b/google/ads/googleads/v6/services/services/shared_criterion_service/__init__.py deleted file mode 100644 index 5fba1c7e1..000000000 --- a/google/ads/googleads/v6/services/services/shared_criterion_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import SharedCriterionServiceClient - -__all__ = ("SharedCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shared_criterion_service/client.py b/google/ads/googleads/v6/services/services/shared_criterion_service/client.py deleted file mode 100644 index 965196a5d..000000000 --- a/google/ads/googleads/v6/services/services/shared_criterion_service/client.py +++ /dev/null @@ -1,561 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import shared_criterion -from google.ads.googleads.v6.services.types import shared_criterion_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import ( - SharedCriterionServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import SharedCriterionServiceGrpcTransport - - -class SharedCriterionServiceClientMeta(type): - """Metaclass for the SharedCriterionService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[SharedCriterionServiceTransport]] - _transport_registry["grpc"] = SharedCriterionServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[SharedCriterionServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class SharedCriterionServiceClient(metaclass=SharedCriterionServiceClientMeta): - """Service to manage shared criteria.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SharedCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SharedCriterionServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> SharedCriterionServiceTransport: - """Return the transport used by the client instance. - - Returns: - SharedCriterionServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def shared_criterion_path( - customer_id: str, shared_set_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified shared_criterion string.""" - return "customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}".format( - customer_id=customer_id, - shared_set_id=shared_set_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_shared_criterion_path(path: str) -> Dict[str, str]: - """Parse a shared_criterion path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedCriteria/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def shared_set_path(customer_id: str, shared_set_id: str,) -> str: - """Return a fully-qualified shared_set string.""" - return "customers/{customer_id}/sharedSets/{shared_set_id}".format( - customer_id=customer_id, shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_shared_set_path(path: str) -> Dict[str, str]: - """Parse a shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedSets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, SharedCriterionServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the shared criterion service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.SharedCriterionServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, SharedCriterionServiceTransport): - # transport is a SharedCriterionServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = SharedCriterionServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_shared_criterion( - self, - request: shared_criterion_service.GetSharedCriterionRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> shared_criterion.SharedCriterion: - r"""Returns the requested shared criterion in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetSharedCriterionRequest`): - The request object. Request message for - [SharedCriterionService.GetSharedCriterion][google.ads.googleads.v6.services.SharedCriterionService.GetSharedCriterion]. - resource_name (:class:`str`): - Required. The resource name of the - shared criterion to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.SharedCriterion: - A criterion belonging to a shared - set. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a shared_criterion_service.GetSharedCriterionRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, shared_criterion_service.GetSharedCriterionRequest - ): - request = shared_criterion_service.GetSharedCriterionRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_shared_criterion - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_shared_criteria( - self, - request: shared_criterion_service.MutateSharedCriteriaRequest = None, - *, - customer_id: str = None, - operations: Sequence[ - shared_criterion_service.SharedCriterionOperation - ] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> shared_criterion_service.MutateSharedCriteriaResponse: - r"""Creates or removes shared criteria. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateSharedCriteriaRequest`): - The request object. Request message for - [SharedCriterionService.MutateSharedCriteria][google.ads.googleads.v6.services.SharedCriterionService.MutateSharedCriteria]. - customer_id (:class:`str`): - Required. The ID of the customer - whose shared criteria are being - modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.SharedCriterionOperation]`): - Required. The list of operations to - perform on individual shared criteria. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateSharedCriteriaResponse: - Response message for a shared - criterion mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a shared_criterion_service.MutateSharedCriteriaRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, shared_criterion_service.MutateSharedCriteriaRequest - ): - request = shared_criterion_service.MutateSharedCriteriaRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_shared_criteria - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("SharedCriterionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/__init__.py b/google/ads/googleads/v6/services/services/shared_criterion_service/transports/__init__.py deleted file mode 100644 index 4761c6ec4..000000000 --- a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import SharedCriterionServiceTransport -from .grpc import SharedCriterionServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[SharedCriterionServiceTransport]] -_transport_registry["grpc"] = SharedCriterionServiceGrpcTransport - - -__all__ = ( - "SharedCriterionServiceTransport", - "SharedCriterionServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/base.py b/google/ads/googleads/v6/services/services/shared_criterion_service/transports/base.py deleted file mode 100644 index f5347489f..000000000 --- a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/base.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import shared_criterion -from google.ads.googleads.v6.services.types import shared_criterion_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class SharedCriterionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for SharedCriterionService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_shared_criterion: gapic_v1.method.wrap_method( - self.get_shared_criterion, - default_timeout=None, - client_info=client_info, - ), - self.mutate_shared_criteria: gapic_v1.method.wrap_method( - self.mutate_shared_criteria, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_shared_criterion( - self, - ) -> typing.Callable[ - [shared_criterion_service.GetSharedCriterionRequest], - shared_criterion.SharedCriterion, - ]: - raise NotImplementedError - - @property - def mutate_shared_criteria( - self, - ) -> typing.Callable[ - [shared_criterion_service.MutateSharedCriteriaRequest], - shared_criterion_service.MutateSharedCriteriaResponse, - ]: - raise NotImplementedError - - -__all__ = ("SharedCriterionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/grpc.py b/google/ads/googleads/v6/services/services/shared_criterion_service/transports/grpc.py deleted file mode 100644 index a3bfa971b..000000000 --- a/google/ads/googleads/v6/services/services/shared_criterion_service/transports/grpc.py +++ /dev/null @@ -1,277 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import shared_criterion -from google.ads.googleads.v6.services.types import shared_criterion_service - -from .base import SharedCriterionServiceTransport, DEFAULT_CLIENT_INFO - - -class SharedCriterionServiceGrpcTransport(SharedCriterionServiceTransport): - """gRPC backend transport for SharedCriterionService. - - Service to manage shared criteria. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_shared_criterion( - self, - ) -> Callable[ - [shared_criterion_service.GetSharedCriterionRequest], - shared_criterion.SharedCriterion, - ]: - r"""Return a callable for the get shared criterion method over gRPC. - - Returns the requested shared criterion in full - detail. - - Returns: - Callable[[~.GetSharedCriterionRequest], - ~.SharedCriterion]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_shared_criterion" not in self._stubs: - self._stubs["get_shared_criterion"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.SharedCriterionService/GetSharedCriterion", - request_serializer=shared_criterion_service.GetSharedCriterionRequest.serialize, - response_deserializer=shared_criterion.SharedCriterion.deserialize, - ) - return self._stubs["get_shared_criterion"] - - @property - def mutate_shared_criteria( - self, - ) -> Callable[ - [shared_criterion_service.MutateSharedCriteriaRequest], - shared_criterion_service.MutateSharedCriteriaResponse, - ]: - r"""Return a callable for the mutate shared criteria method over gRPC. - - Creates or removes shared criteria. Operation - statuses are returned. - - Returns: - Callable[[~.MutateSharedCriteriaRequest], - ~.MutateSharedCriteriaResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_shared_criteria" not in self._stubs: - self._stubs[ - "mutate_shared_criteria" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.SharedCriterionService/MutateSharedCriteria", - request_serializer=shared_criterion_service.MutateSharedCriteriaRequest.serialize, - response_deserializer=shared_criterion_service.MutateSharedCriteriaResponse.deserialize, - ) - return self._stubs["mutate_shared_criteria"] - - -__all__ = ("SharedCriterionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/shared_set_service/__init__.py b/google/ads/googleads/v6/services/services/shared_set_service/__init__.py deleted file mode 100644 index e300e1030..000000000 --- a/google/ads/googleads/v6/services/services/shared_set_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import SharedSetServiceClient - -__all__ = ("SharedSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shared_set_service/client.py b/google/ads/googleads/v6/services/services/shared_set_service/client.py deleted file mode 100644 index 5b6c16bfd..000000000 --- a/google/ads/googleads/v6/services/services/shared_set_service/client.py +++ /dev/null @@ -1,525 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import shared_set -from google.ads.googleads.v6.services.types import shared_set_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import SharedSetServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import SharedSetServiceGrpcTransport - - -class SharedSetServiceClientMeta(type): - """Metaclass for the SharedSetService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[SharedSetServiceTransport]] - _transport_registry["grpc"] = SharedSetServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[SharedSetServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class SharedSetServiceClient(metaclass=SharedSetServiceClientMeta): - """Service to manage shared sets.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SharedSetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - SharedSetServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> SharedSetServiceTransport: - """Return the transport used by the client instance. - - Returns: - SharedSetServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def shared_set_path(customer_id: str, shared_set_id: str,) -> str: - """Return a fully-qualified shared_set string.""" - return "customers/{customer_id}/sharedSets/{shared_set_id}".format( - customer_id=customer_id, shared_set_id=shared_set_id, - ) - - @staticmethod - def parse_shared_set_path(path: str) -> Dict[str, str]: - """Parse a shared_set path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/sharedSets/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, SharedSetServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the shared set service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.SharedSetServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, SharedSetServiceTransport): - # transport is a SharedSetServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = SharedSetServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_shared_set( - self, - request: shared_set_service.GetSharedSetRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> shared_set.SharedSet: - r"""Returns the requested shared set in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetSharedSetRequest`): - The request object. Request message for - [SharedSetService.GetSharedSet][google.ads.googleads.v6.services.SharedSetService.GetSharedSet]. - resource_name (:class:`str`): - Required. The resource name of the - shared set to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.SharedSet: - SharedSets are used for sharing - criterion exclusions across multiple - campaigns. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a shared_set_service.GetSharedSetRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, shared_set_service.GetSharedSetRequest): - request = shared_set_service.GetSharedSetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_shared_set] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_shared_sets( - self, - request: shared_set_service.MutateSharedSetsRequest = None, - *, - customer_id: str = None, - operations: Sequence[shared_set_service.SharedSetOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> shared_set_service.MutateSharedSetsResponse: - r"""Creates, updates, or removes shared sets. Operation - statuses are returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateSharedSetsRequest`): - The request object. Request message for - [SharedSetService.MutateSharedSets][google.ads.googleads.v6.services.SharedSetService.MutateSharedSets]. - customer_id (:class:`str`): - Required. The ID of the customer - whose shared sets are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.SharedSetOperation]`): - Required. The list of operations to - perform on individual shared sets. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateSharedSetsResponse: - Response message for a shared set - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a shared_set_service.MutateSharedSetsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, shared_set_service.MutateSharedSetsRequest): - request = shared_set_service.MutateSharedSetsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_shared_sets - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("SharedSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shared_set_service/transports/__init__.py b/google/ads/googleads/v6/services/services/shared_set_service/transports/__init__.py deleted file mode 100644 index 6a3495b85..000000000 --- a/google/ads/googleads/v6/services/services/shared_set_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import SharedSetServiceTransport -from .grpc import SharedSetServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[SharedSetServiceTransport]] -_transport_registry["grpc"] = SharedSetServiceGrpcTransport - - -__all__ = ( - "SharedSetServiceTransport", - "SharedSetServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/shared_set_service/transports/base.py b/google/ads/googleads/v6/services/services/shared_set_service/transports/base.py deleted file mode 100644 index 6177070b9..000000000 --- a/google/ads/googleads/v6/services/services/shared_set_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import shared_set -from google.ads.googleads.v6.services.types import shared_set_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class SharedSetServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for SharedSetService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_shared_set: gapic_v1.method.wrap_method( - self.get_shared_set, - default_timeout=None, - client_info=client_info, - ), - self.mutate_shared_sets: gapic_v1.method.wrap_method( - self.mutate_shared_sets, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_shared_set( - self, - ) -> typing.Callable[ - [shared_set_service.GetSharedSetRequest], shared_set.SharedSet - ]: - raise NotImplementedError - - @property - def mutate_shared_sets( - self, - ) -> typing.Callable[ - [shared_set_service.MutateSharedSetsRequest], - shared_set_service.MutateSharedSetsResponse, - ]: - raise NotImplementedError - - -__all__ = ("SharedSetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/shared_set_service/transports/grpc.py b/google/ads/googleads/v6/services/services/shared_set_service/transports/grpc.py deleted file mode 100644 index e9326df81..000000000 --- a/google/ads/googleads/v6/services/services/shared_set_service/transports/grpc.py +++ /dev/null @@ -1,273 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import shared_set -from google.ads.googleads.v6.services.types import shared_set_service - -from .base import SharedSetServiceTransport, DEFAULT_CLIENT_INFO - - -class SharedSetServiceGrpcTransport(SharedSetServiceTransport): - """gRPC backend transport for SharedSetService. - - Service to manage shared sets. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_shared_set( - self, - ) -> Callable[ - [shared_set_service.GetSharedSetRequest], shared_set.SharedSet - ]: - r"""Return a callable for the get shared set method over gRPC. - - Returns the requested shared set in full detail. - - Returns: - Callable[[~.GetSharedSetRequest], - ~.SharedSet]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_shared_set" not in self._stubs: - self._stubs["get_shared_set"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.SharedSetService/GetSharedSet", - request_serializer=shared_set_service.GetSharedSetRequest.serialize, - response_deserializer=shared_set.SharedSet.deserialize, - ) - return self._stubs["get_shared_set"] - - @property - def mutate_shared_sets( - self, - ) -> Callable[ - [shared_set_service.MutateSharedSetsRequest], - shared_set_service.MutateSharedSetsResponse, - ]: - r"""Return a callable for the mutate shared sets method over gRPC. - - Creates, updates, or removes shared sets. Operation - statuses are returned. - - Returns: - Callable[[~.MutateSharedSetsRequest], - ~.MutateSharedSetsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_shared_sets" not in self._stubs: - self._stubs["mutate_shared_sets"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.SharedSetService/MutateSharedSets", - request_serializer=shared_set_service.MutateSharedSetsRequest.serialize, - response_deserializer=shared_set_service.MutateSharedSetsResponse.deserialize, - ) - return self._stubs["mutate_shared_sets"] - - -__all__ = ("SharedSetServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/shopping_performance_view_service/__init__.py b/google/ads/googleads/v6/services/services/shopping_performance_view_service/__init__.py deleted file mode 100644 index 553a1fcab..000000000 --- a/google/ads/googleads/v6/services/services/shopping_performance_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ShoppingPerformanceViewServiceClient - -__all__ = ("ShoppingPerformanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shopping_performance_view_service/client.py b/google/ads/googleads/v6/services/services/shopping_performance_view_service/client.py deleted file mode 100644 index 1fe4cbf44..000000000 --- a/google/ads/googleads/v6/services/services/shopping_performance_view_service/client.py +++ /dev/null @@ -1,457 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import shopping_performance_view -from google.ads.googleads.v6.services.types import ( - shopping_performance_view_service, -) - -from .transports.base import ( - ShoppingPerformanceViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ShoppingPerformanceViewServiceGrpcTransport - - -class ShoppingPerformanceViewServiceClientMeta(type): - """Metaclass for the ShoppingPerformanceViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ShoppingPerformanceViewServiceTransport]] - _transport_registry["grpc"] = ShoppingPerformanceViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ShoppingPerformanceViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ShoppingPerformanceViewServiceClient( - metaclass=ShoppingPerformanceViewServiceClientMeta -): - """Service to fetch Shopping performance views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ShoppingPerformanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ShoppingPerformanceViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ShoppingPerformanceViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - ShoppingPerformanceViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def shopping_performance_view_path(customer_id: str,) -> str: - """Return a fully-qualified shopping_performance_view string.""" - return "customers/{customer_id}/shoppingPerformanceView".format( - customer_id=customer_id, - ) - - @staticmethod - def parse_shopping_performance_view_path(path: str) -> Dict[str, str]: - """Parse a shopping_performance_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/shoppingPerformanceView$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ShoppingPerformanceViewServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the shopping performance view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ShoppingPerformanceViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ShoppingPerformanceViewServiceTransport): - # transport is a ShoppingPerformanceViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ShoppingPerformanceViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_shopping_performance_view( - self, - request: shopping_performance_view_service.GetShoppingPerformanceViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> shopping_performance_view.ShoppingPerformanceView: - r"""Returns the requested Shopping performance view in - full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetShoppingPerformanceViewRequest`): - The request object. Request message for - [ShoppingPerformanceViewService.GetShoppingPerformanceView][google.ads.googleads.v6.services.ShoppingPerformanceViewService.GetShoppingPerformanceView]. - resource_name (:class:`str`): - Required. The resource name of the - Shopping performance view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ShoppingPerformanceView: - Shopping performance view. - Provides Shopping campaign statistics - aggregated at several product dimension - levels. Product dimension values from - Merchant Center such as brand, category, - custom attributes, product condition and - product type will reflect the state of - each dimension as of the date and time - when the corresponding event was - recorded. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a shopping_performance_view_service.GetShoppingPerformanceViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - shopping_performance_view_service.GetShoppingPerformanceViewRequest, - ): - request = shopping_performance_view_service.GetShoppingPerformanceViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_shopping_performance_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ShoppingPerformanceViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/__init__.py deleted file mode 100644 index 1ace803af..000000000 --- a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ShoppingPerformanceViewServiceTransport -from .grpc import ShoppingPerformanceViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ShoppingPerformanceViewServiceTransport]] -_transport_registry["grpc"] = ShoppingPerformanceViewServiceGrpcTransport - - -__all__ = ( - "ShoppingPerformanceViewServiceTransport", - "ShoppingPerformanceViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/base.py b/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/base.py deleted file mode 100644 index 522769ceb..000000000 --- a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/base.py +++ /dev/null @@ -1,104 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import shopping_performance_view -from google.ads.googleads.v6.services.types import ( - shopping_performance_view_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ShoppingPerformanceViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ShoppingPerformanceViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_shopping_performance_view: gapic_v1.method.wrap_method( - self.get_shopping_performance_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_shopping_performance_view( - self, - ) -> typing.Callable[ - [shopping_performance_view_service.GetShoppingPerformanceViewRequest], - shopping_performance_view.ShoppingPerformanceView, - ]: - raise NotImplementedError - - -__all__ = ("ShoppingPerformanceViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/grpc.py deleted file mode 100644 index cd19f0757..000000000 --- a/google/ads/googleads/v6/services/services/shopping_performance_view_service/transports/grpc.py +++ /dev/null @@ -1,251 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import shopping_performance_view -from google.ads.googleads.v6.services.types import ( - shopping_performance_view_service, -) - -from .base import ShoppingPerformanceViewServiceTransport, DEFAULT_CLIENT_INFO - - -class ShoppingPerformanceViewServiceGrpcTransport( - ShoppingPerformanceViewServiceTransport -): - """gRPC backend transport for ShoppingPerformanceViewService. - - Service to fetch Shopping performance views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_shopping_performance_view( - self, - ) -> Callable[ - [shopping_performance_view_service.GetShoppingPerformanceViewRequest], - shopping_performance_view.ShoppingPerformanceView, - ]: - r"""Return a callable for the get shopping performance view method over gRPC. - - Returns the requested Shopping performance view in - full detail. - - Returns: - Callable[[~.GetShoppingPerformanceViewRequest], - ~.ShoppingPerformanceView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_shopping_performance_view" not in self._stubs: - self._stubs[ - "get_shopping_performance_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ShoppingPerformanceViewService/GetShoppingPerformanceView", - request_serializer=shopping_performance_view_service.GetShoppingPerformanceViewRequest.serialize, - response_deserializer=shopping_performance_view.ShoppingPerformanceView.deserialize, - ) - return self._stubs["get_shopping_performance_view"] - - -__all__ = ("ShoppingPerformanceViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/__init__.py b/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/__init__.py deleted file mode 100644 index 0937fd98e..000000000 --- a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import ThirdPartyAppAnalyticsLinkServiceClient - -__all__ = ("ThirdPartyAppAnalyticsLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/client.py b/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/client.py deleted file mode 100644 index 8eb63380d..000000000 --- a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/client.py +++ /dev/null @@ -1,501 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import ( - third_party_app_analytics_link, -) -from google.ads.googleads.v6.services.types import ( - third_party_app_analytics_link_service, -) - -from .transports.base import ( - ThirdPartyAppAnalyticsLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import ThirdPartyAppAnalyticsLinkServiceGrpcTransport - - -class ThirdPartyAppAnalyticsLinkServiceClientMeta(type): - """Metaclass for the ThirdPartyAppAnalyticsLinkService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[ThirdPartyAppAnalyticsLinkServiceTransport]] - _transport_registry["grpc"] = ThirdPartyAppAnalyticsLinkServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[ThirdPartyAppAnalyticsLinkServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class ThirdPartyAppAnalyticsLinkServiceClient( - metaclass=ThirdPartyAppAnalyticsLinkServiceClientMeta -): - """This service allows management of links between Google Ads - and third party app analytics. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ThirdPartyAppAnalyticsLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - ThirdPartyAppAnalyticsLinkServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> ThirdPartyAppAnalyticsLinkServiceTransport: - """Return the transport used by the client instance. - - Returns: - ThirdPartyAppAnalyticsLinkServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def third_party_app_analytics_link_path( - customer_id: str, customer_link_id: str, - ) -> str: - """Return a fully-qualified third_party_app_analytics_link string.""" - return "customers/{customer_id}/thirdPartyAppAnalyticsLinks/{customer_link_id}".format( - customer_id=customer_id, customer_link_id=customer_link_id, - ) - - @staticmethod - def parse_third_party_app_analytics_link_path(path: str) -> Dict[str, str]: - """Parse a third_party_app_analytics_link path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/thirdPartyAppAnalyticsLinks/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[ - str, ThirdPartyAppAnalyticsLinkServiceTransport, None - ] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the third party app analytics link service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.ThirdPartyAppAnalyticsLinkServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, ThirdPartyAppAnalyticsLinkServiceTransport): - # transport is a ThirdPartyAppAnalyticsLinkServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = ThirdPartyAppAnalyticsLinkServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_third_party_app_analytics_link( - self, - request: third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> third_party_app_analytics_link.ThirdPartyAppAnalyticsLink: - r"""Returns the third party app analytics link in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetThirdPartyAppAnalyticsLinkRequest`): - The request object. Request message for - [ThirdPartyAppAnalyticsLinkService.GetThirdPartyAppAnalyticsLink][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.GetThirdPartyAppAnalyticsLink]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.ThirdPartyAppAnalyticsLink: - A data sharing connection, allowing - the import of third party app analytics - into a Google Ads Customer. - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest, - ): - request = third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest( - request - ) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_third_party_app_analytics_link - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def regenerate_shareable_link_id( - self, - request: third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> third_party_app_analytics_link_service.RegenerateShareableLinkIdResponse: - r"""Regenerate ThirdPartyAppAnalyticsLink.shareable_link_id that - should be provided to the third party when setting up app - analytics. - - Args: - request (:class:`google.ads.googleads.v6.services.types.RegenerateShareableLinkIdRequest`): - The request object. Request message for - [ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId]. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.RegenerateShareableLinkIdResponse: - Response message for - [ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId]. - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, - third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest, - ): - request = third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest( - request - ) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.regenerate_shareable_link_id - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("ThirdPartyAppAnalyticsLinkServiceClient",) diff --git a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/__init__.py b/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/__init__.py deleted file mode 100644 index ed1bc4b53..000000000 --- a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import ThirdPartyAppAnalyticsLinkServiceTransport -from .grpc import ThirdPartyAppAnalyticsLinkServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[ThirdPartyAppAnalyticsLinkServiceTransport]] -_transport_registry["grpc"] = ThirdPartyAppAnalyticsLinkServiceGrpcTransport - - -__all__ = ( - "ThirdPartyAppAnalyticsLinkServiceTransport", - "ThirdPartyAppAnalyticsLinkServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/base.py b/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/base.py deleted file mode 100644 index 4afd2df09..000000000 --- a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/base.py +++ /dev/null @@ -1,124 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ( - third_party_app_analytics_link, -) -from google.ads.googleads.v6.services.types import ( - third_party_app_analytics_link_service, -) - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class ThirdPartyAppAnalyticsLinkServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for ThirdPartyAppAnalyticsLinkService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_third_party_app_analytics_link: gapic_v1.method.wrap_method( - self.get_third_party_app_analytics_link, - default_timeout=None, - client_info=client_info, - ), - self.regenerate_shareable_link_id: gapic_v1.method.wrap_method( - self.regenerate_shareable_link_id, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_third_party_app_analytics_link( - self, - ) -> typing.Callable[ - [ - third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest - ], - third_party_app_analytics_link.ThirdPartyAppAnalyticsLink, - ]: - raise NotImplementedError - - @property - def regenerate_shareable_link_id( - self, - ) -> typing.Callable[ - [ - third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest - ], - third_party_app_analytics_link_service.RegenerateShareableLinkIdResponse, - ]: - raise NotImplementedError - - -__all__ = ("ThirdPartyAppAnalyticsLinkServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/grpc.py b/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/grpc.py deleted file mode 100644 index 690b0b2d7..000000000 --- a/google/ads/googleads/v6/services/services/third_party_app_analytics_link_service/transports/grpc.py +++ /dev/null @@ -1,295 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import ( - third_party_app_analytics_link, -) -from google.ads.googleads.v6.services.types import ( - third_party_app_analytics_link_service, -) - -from .base import ( - ThirdPartyAppAnalyticsLinkServiceTransport, - DEFAULT_CLIENT_INFO, -) - - -class ThirdPartyAppAnalyticsLinkServiceGrpcTransport( - ThirdPartyAppAnalyticsLinkServiceTransport -): - """gRPC backend transport for ThirdPartyAppAnalyticsLinkService. - - This service allows management of links between Google Ads - and third party app analytics. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_third_party_app_analytics_link( - self, - ) -> Callable[ - [ - third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest - ], - third_party_app_analytics_link.ThirdPartyAppAnalyticsLink, - ]: - r"""Return a callable for the get third party app analytics - link method over gRPC. - - Returns the third party app analytics link in full - detail. - - Returns: - Callable[[~.GetThirdPartyAppAnalyticsLinkRequest], - ~.ThirdPartyAppAnalyticsLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_third_party_app_analytics_link" not in self._stubs: - self._stubs[ - "get_third_party_app_analytics_link" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService/GetThirdPartyAppAnalyticsLink", - request_serializer=third_party_app_analytics_link_service.GetThirdPartyAppAnalyticsLinkRequest.serialize, - response_deserializer=third_party_app_analytics_link.ThirdPartyAppAnalyticsLink.deserialize, - ) - return self._stubs["get_third_party_app_analytics_link"] - - @property - def regenerate_shareable_link_id( - self, - ) -> Callable[ - [ - third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest - ], - third_party_app_analytics_link_service.RegenerateShareableLinkIdResponse, - ]: - r"""Return a callable for the regenerate shareable link id method over gRPC. - - Regenerate ThirdPartyAppAnalyticsLink.shareable_link_id that - should be provided to the third party when setting up app - analytics. - - Returns: - Callable[[~.RegenerateShareableLinkIdRequest], - ~.RegenerateShareableLinkIdResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "regenerate_shareable_link_id" not in self._stubs: - self._stubs[ - "regenerate_shareable_link_id" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService/RegenerateShareableLinkId", - request_serializer=third_party_app_analytics_link_service.RegenerateShareableLinkIdRequest.serialize, - response_deserializer=third_party_app_analytics_link_service.RegenerateShareableLinkIdResponse.deserialize, - ) - return self._stubs["regenerate_shareable_link_id"] - - -__all__ = ("ThirdPartyAppAnalyticsLinkServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/topic_constant_service/__init__.py b/google/ads/googleads/v6/services/services/topic_constant_service/__init__.py deleted file mode 100644 index 7b8b36bba..000000000 --- a/google/ads/googleads/v6/services/services/topic_constant_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import TopicConstantServiceClient - -__all__ = ("TopicConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/topic_constant_service/client.py b/google/ads/googleads/v6/services/services/topic_constant_service/client.py deleted file mode 100644 index f0eef4e53..000000000 --- a/google/ads/googleads/v6/services/services/topic_constant_service/client.py +++ /dev/null @@ -1,435 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import topic_constant -from google.ads.googleads.v6.services.types import topic_constant_service - -from .transports.base import TopicConstantServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import TopicConstantServiceGrpcTransport - - -class TopicConstantServiceClientMeta(type): - """Metaclass for the TopicConstantService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[TopicConstantServiceTransport]] - _transport_registry["grpc"] = TopicConstantServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[TopicConstantServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class TopicConstantServiceClient(metaclass=TopicConstantServiceClientMeta): - """Service to fetch topic constants.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TopicConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TopicConstantServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> TopicConstantServiceTransport: - """Return the transport used by the client instance. - - Returns: - TopicConstantServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def topic_constant_path(topic_id: str,) -> str: - """Return a fully-qualified topic_constant string.""" - return "topicConstants/{topic_id}".format(topic_id=topic_id,) - - @staticmethod - def parse_topic_constant_path(path: str) -> Dict[str, str]: - """Parse a topic_constant path into its component segments.""" - m = re.match(r"^topicConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, TopicConstantServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the topic constant service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.TopicConstantServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, TopicConstantServiceTransport): - # transport is a TopicConstantServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = TopicConstantServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_topic_constant( - self, - request: topic_constant_service.GetTopicConstantRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> topic_constant.TopicConstant: - r"""Returns the requested topic constant in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetTopicConstantRequest`): - The request object. Request message for - [TopicConstantService.GetTopicConstant][google.ads.googleads.v6.services.TopicConstantService.GetTopicConstant]. - resource_name (:class:`str`): - Required. Resource name of the Topic - to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.TopicConstant: - Use topics to target or exclude - placements in the Google Display Network - based on the category into which the - placement falls (for example, "Pets & - Animals/Pets/Dogs"). - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a topic_constant_service.GetTopicConstantRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, topic_constant_service.GetTopicConstantRequest - ): - request = topic_constant_service.GetTopicConstantRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_topic_constant - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("TopicConstantServiceClient",) diff --git a/google/ads/googleads/v6/services/services/topic_constant_service/transports/__init__.py b/google/ads/googleads/v6/services/services/topic_constant_service/transports/__init__.py deleted file mode 100644 index cd757a381..000000000 --- a/google/ads/googleads/v6/services/services/topic_constant_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import TopicConstantServiceTransport -from .grpc import TopicConstantServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[TopicConstantServiceTransport]] -_transport_registry["grpc"] = TopicConstantServiceGrpcTransport - - -__all__ = ( - "TopicConstantServiceTransport", - "TopicConstantServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/topic_constant_service/transports/base.py b/google/ads/googleads/v6/services/services/topic_constant_service/transports/base.py deleted file mode 100644 index fda12b8f7..000000000 --- a/google/ads/googleads/v6/services/services/topic_constant_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import topic_constant -from google.ads.googleads.v6.services.types import topic_constant_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class TopicConstantServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for TopicConstantService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_topic_constant: gapic_v1.method.wrap_method( - self.get_topic_constant, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_topic_constant( - self, - ) -> typing.Callable[ - [topic_constant_service.GetTopicConstantRequest], - topic_constant.TopicConstant, - ]: - raise NotImplementedError - - -__all__ = ("TopicConstantServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/topic_constant_service/transports/grpc.py b/google/ads/googleads/v6/services/services/topic_constant_service/transports/grpc.py deleted file mode 100644 index 8f4d3e8c5..000000000 --- a/google/ads/googleads/v6/services/services/topic_constant_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import topic_constant -from google.ads.googleads.v6.services.types import topic_constant_service - -from .base import TopicConstantServiceTransport, DEFAULT_CLIENT_INFO - - -class TopicConstantServiceGrpcTransport(TopicConstantServiceTransport): - """gRPC backend transport for TopicConstantService. - - Service to fetch topic constants. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_topic_constant( - self, - ) -> Callable[ - [topic_constant_service.GetTopicConstantRequest], - topic_constant.TopicConstant, - ]: - r"""Return a callable for the get topic constant method over gRPC. - - Returns the requested topic constant in full detail. - - Returns: - Callable[[~.GetTopicConstantRequest], - ~.TopicConstant]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_topic_constant" not in self._stubs: - self._stubs["get_topic_constant"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.TopicConstantService/GetTopicConstant", - request_serializer=topic_constant_service.GetTopicConstantRequest.serialize, - response_deserializer=topic_constant.TopicConstant.deserialize, - ) - return self._stubs["get_topic_constant"] - - -__all__ = ("TopicConstantServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/topic_view_service/__init__.py b/google/ads/googleads/v6/services/services/topic_view_service/__init__.py deleted file mode 100644 index 123c02d40..000000000 --- a/google/ads/googleads/v6/services/services/topic_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import TopicViewServiceClient - -__all__ = ("TopicViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/topic_view_service/client.py b/google/ads/googleads/v6/services/services/topic_view_service/client.py deleted file mode 100644 index 0dbd96b5e..000000000 --- a/google/ads/googleads/v6/services/services/topic_view_service/client.py +++ /dev/null @@ -1,435 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import topic_view -from google.ads.googleads.v6.services.types import topic_view_service - -from .transports.base import TopicViewServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import TopicViewServiceGrpcTransport - - -class TopicViewServiceClientMeta(type): - """Metaclass for the TopicViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[TopicViewServiceTransport]] - _transport_registry["grpc"] = TopicViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[TopicViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class TopicViewServiceClient(metaclass=TopicViewServiceClientMeta): - """Service to manage topic views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TopicViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - TopicViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> TopicViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - TopicViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def topic_view_path( - customer_id: str, ad_group_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified topic_view string.""" - return "customers/{customer_id}/topicViews/{ad_group_id}~{criterion_id}".format( - customer_id=customer_id, - ad_group_id=ad_group_id, - criterion_id=criterion_id, - ) - - @staticmethod - def parse_topic_view_path(path: str) -> Dict[str, str]: - """Parse a topic_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/topicViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, TopicViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the topic view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.TopicViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, TopicViewServiceTransport): - # transport is a TopicViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = TopicViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_topic_view( - self, - request: topic_view_service.GetTopicViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> topic_view.TopicView: - r"""Returns the requested topic view in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetTopicViewRequest`): - The request object. Request message for - [TopicViewService.GetTopicView][google.ads.googleads.v6.services.TopicViewService.GetTopicView]. - resource_name (:class:`str`): - Required. The resource name of the - topic view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.TopicView: - A topic view. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a topic_view_service.GetTopicViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, topic_view_service.GetTopicViewRequest): - request = topic_view_service.GetTopicViewRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_topic_view] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("TopicViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/topic_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/topic_view_service/transports/__init__.py deleted file mode 100644 index e20e56eea..000000000 --- a/google/ads/googleads/v6/services/services/topic_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import TopicViewServiceTransport -from .grpc import TopicViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[TopicViewServiceTransport]] -_transport_registry["grpc"] = TopicViewServiceGrpcTransport - - -__all__ = ( - "TopicViewServiceTransport", - "TopicViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/topic_view_service/transports/base.py b/google/ads/googleads/v6/services/services/topic_view_service/transports/base.py deleted file mode 100644 index 91c7bc5c1..000000000 --- a/google/ads/googleads/v6/services/services/topic_view_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import topic_view -from google.ads.googleads.v6.services.types import topic_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class TopicViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for TopicViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_topic_view: gapic_v1.method.wrap_method( - self.get_topic_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_topic_view( - self, - ) -> typing.Callable[ - [topic_view_service.GetTopicViewRequest], topic_view.TopicView - ]: - raise NotImplementedError - - -__all__ = ("TopicViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/topic_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/topic_view_service/transports/grpc.py deleted file mode 100644 index a48d6ee64..000000000 --- a/google/ads/googleads/v6/services/services/topic_view_service/transports/grpc.py +++ /dev/null @@ -1,243 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import topic_view -from google.ads.googleads.v6.services.types import topic_view_service - -from .base import TopicViewServiceTransport, DEFAULT_CLIENT_INFO - - -class TopicViewServiceGrpcTransport(TopicViewServiceTransport): - """gRPC backend transport for TopicViewService. - - Service to manage topic views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_topic_view( - self, - ) -> Callable[ - [topic_view_service.GetTopicViewRequest], topic_view.TopicView - ]: - r"""Return a callable for the get topic view method over gRPC. - - Returns the requested topic view in full detail. - - Returns: - Callable[[~.GetTopicViewRequest], - ~.TopicView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_topic_view" not in self._stubs: - self._stubs["get_topic_view"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.TopicViewService/GetTopicView", - request_serializer=topic_view_service.GetTopicViewRequest.serialize, - response_deserializer=topic_view.TopicView.deserialize, - ) - return self._stubs["get_topic_view"] - - -__all__ = ("TopicViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/user_data_service/__init__.py b/google/ads/googleads/v6/services/services/user_data_service/__init__.py deleted file mode 100644 index d9d5d8e79..000000000 --- a/google/ads/googleads/v6/services/services/user_data_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import UserDataServiceClient - -__all__ = ("UserDataServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_data_service/client.py b/google/ads/googleads/v6/services/services/user_data_service/client.py deleted file mode 100644 index 5ec3e78eb..000000000 --- a/google/ads/googleads/v6/services/services/user_data_service/client.py +++ /dev/null @@ -1,397 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.services.types import user_data_service - -from .transports.base import UserDataServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import UserDataServiceGrpcTransport - - -class UserDataServiceClientMeta(type): - """Metaclass for the UserDataService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[UserDataServiceTransport]] - _transport_registry["grpc"] = UserDataServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[UserDataServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class UserDataServiceClient(metaclass=UserDataServiceClientMeta): - """Service to manage user data uploads. - Accessible only to customers on the allow-list. - """ - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserDataServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserDataServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> UserDataServiceTransport: - """Return the transport used by the client instance. - - Returns: - UserDataServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, UserDataServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the user data service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.UserDataServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, UserDataServiceTransport): - # transport is a UserDataServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = UserDataServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def upload_user_data( - self, - request: user_data_service.UploadUserDataRequest = None, - *, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> user_data_service.UploadUserDataResponse: - r"""Uploads the given user data. - - Args: - request (:class:`google.ads.googleads.v6.services.types.UploadUserDataRequest`): - The request object. Request message for - [UserDataService.UploadUserData][google.ads.googleads.v6.services.UserDataService.UploadUserData] - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.UploadUserDataResponse: - Response message for - [UserDataService.UploadUserData][google.ads.googleads.v6.services.UserDataService.UploadUserData] - - """ - # Create or coerce a protobuf request object. - - # Minor optimization to avoid making a copy if the user passes - # in a user_data_service.UploadUserDataRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, user_data_service.UploadUserDataRequest): - request = user_data_service.UploadUserDataRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.upload_user_data] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("UserDataServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_data_service/transports/__init__.py b/google/ads/googleads/v6/services/services/user_data_service/transports/__init__.py deleted file mode 100644 index cd0c483d8..000000000 --- a/google/ads/googleads/v6/services/services/user_data_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import UserDataServiceTransport -from .grpc import UserDataServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[UserDataServiceTransport]] -_transport_registry["grpc"] = UserDataServiceGrpcTransport - - -__all__ = ( - "UserDataServiceTransport", - "UserDataServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/user_data_service/transports/base.py b/google/ads/googleads/v6/services/services/user_data_service/transports/base.py deleted file mode 100644 index 144750207..000000000 --- a/google/ads/googleads/v6/services/services/user_data_service/transports/base.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.services.types import user_data_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class UserDataServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for UserDataService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.upload_user_data: gapic_v1.method.wrap_method( - self.upload_user_data, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def upload_user_data( - self, - ) -> typing.Callable[ - [user_data_service.UploadUserDataRequest], - user_data_service.UploadUserDataResponse, - ]: - raise NotImplementedError - - -__all__ = ("UserDataServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/user_data_service/transports/grpc.py b/google/ads/googleads/v6/services/services/user_data_service/transports/grpc.py deleted file mode 100644 index b6e4ff1ee..000000000 --- a/google/ads/googleads/v6/services/services/user_data_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.services.types import user_data_service - -from .base import UserDataServiceTransport, DEFAULT_CLIENT_INFO - - -class UserDataServiceGrpcTransport(UserDataServiceTransport): - """gRPC backend transport for UserDataService. - - Service to manage user data uploads. - Accessible only to customers on the allow-list. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def upload_user_data( - self, - ) -> Callable[ - [user_data_service.UploadUserDataRequest], - user_data_service.UploadUserDataResponse, - ]: - r"""Return a callable for the upload user data method over gRPC. - - Uploads the given user data. - - Returns: - Callable[[~.UploadUserDataRequest], - ~.UploadUserDataResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "upload_user_data" not in self._stubs: - self._stubs["upload_user_data"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.UserDataService/UploadUserData", - request_serializer=user_data_service.UploadUserDataRequest.serialize, - response_deserializer=user_data_service.UploadUserDataResponse.deserialize, - ) - return self._stubs["upload_user_data"] - - -__all__ = ("UserDataServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/user_interest_service/__init__.py b/google/ads/googleads/v6/services/services/user_interest_service/__init__.py deleted file mode 100644 index 90c346527..000000000 --- a/google/ads/googleads/v6/services/services/user_interest_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import UserInterestServiceClient - -__all__ = ("UserInterestServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_interest_service/client.py b/google/ads/googleads/v6/services/services/user_interest_service/client.py deleted file mode 100644 index d14f33fc5..000000000 --- a/google/ads/googleads/v6/services/services/user_interest_service/client.py +++ /dev/null @@ -1,437 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import user_interest -from google.ads.googleads.v6.services.types import user_interest_service - -from .transports.base import UserInterestServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import UserInterestServiceGrpcTransport - - -class UserInterestServiceClientMeta(type): - """Metaclass for the UserInterestService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[UserInterestServiceTransport]] - _transport_registry["grpc"] = UserInterestServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[UserInterestServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class UserInterestServiceClient(metaclass=UserInterestServiceClientMeta): - """Service to fetch Google Ads User Interest.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserInterestServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserInterestServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> UserInterestServiceTransport: - """Return the transport used by the client instance. - - Returns: - UserInterestServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def user_interest_path(customer_id: str, user_interest_id: str,) -> str: - """Return a fully-qualified user_interest string.""" - return "customers/{customer_id}/userInterests/{user_interest_id}".format( - customer_id=customer_id, user_interest_id=user_interest_id, - ) - - @staticmethod - def parse_user_interest_path(path: str) -> Dict[str, str]: - """Parse a user_interest path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userInterests/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, UserInterestServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the user interest service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.UserInterestServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, UserInterestServiceTransport): - # transport is a UserInterestServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = UserInterestServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_user_interest( - self, - request: user_interest_service.GetUserInterestRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> user_interest.UserInterest: - r"""Returns the requested user interest in full detail - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetUserInterestRequest`): - The request object. Request message for - [UserInterestService.GetUserInterest][google.ads.googleads.v6.services.UserInterestService.GetUserInterest]. - resource_name (:class:`str`): - Required. Resource name of the - UserInterest to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.UserInterest: - A user interest: a particular - interest-based vertical to be targeted. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a user_interest_service.GetUserInterestRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, user_interest_service.GetUserInterestRequest - ): - request = user_interest_service.GetUserInterestRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_user_interest - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("UserInterestServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_interest_service/transports/__init__.py b/google/ads/googleads/v6/services/services/user_interest_service/transports/__init__.py deleted file mode 100644 index 795ab99dc..000000000 --- a/google/ads/googleads/v6/services/services/user_interest_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import UserInterestServiceTransport -from .grpc import UserInterestServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[UserInterestServiceTransport]] -_transport_registry["grpc"] = UserInterestServiceGrpcTransport - - -__all__ = ( - "UserInterestServiceTransport", - "UserInterestServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/user_interest_service/transports/base.py b/google/ads/googleads/v6/services/services/user_interest_service/transports/base.py deleted file mode 100644 index 092806d1c..000000000 --- a/google/ads/googleads/v6/services/services/user_interest_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import user_interest -from google.ads.googleads.v6.services.types import user_interest_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class UserInterestServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for UserInterestService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_user_interest: gapic_v1.method.wrap_method( - self.get_user_interest, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_user_interest( - self, - ) -> typing.Callable[ - [user_interest_service.GetUserInterestRequest], - user_interest.UserInterest, - ]: - raise NotImplementedError - - -__all__ = ("UserInterestServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/user_interest_service/transports/grpc.py b/google/ads/googleads/v6/services/services/user_interest_service/transports/grpc.py deleted file mode 100644 index a28eba485..000000000 --- a/google/ads/googleads/v6/services/services/user_interest_service/transports/grpc.py +++ /dev/null @@ -1,244 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import user_interest -from google.ads.googleads.v6.services.types import user_interest_service - -from .base import UserInterestServiceTransport, DEFAULT_CLIENT_INFO - - -class UserInterestServiceGrpcTransport(UserInterestServiceTransport): - """gRPC backend transport for UserInterestService. - - Service to fetch Google Ads User Interest. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_user_interest( - self, - ) -> Callable[ - [user_interest_service.GetUserInterestRequest], - user_interest.UserInterest, - ]: - r"""Return a callable for the get user interest method over gRPC. - - Returns the requested user interest in full detail - - Returns: - Callable[[~.GetUserInterestRequest], - ~.UserInterest]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_user_interest" not in self._stubs: - self._stubs["get_user_interest"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.UserInterestService/GetUserInterest", - request_serializer=user_interest_service.GetUserInterestRequest.serialize, - response_deserializer=user_interest.UserInterest.deserialize, - ) - return self._stubs["get_user_interest"] - - -__all__ = ("UserInterestServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/user_list_service/__init__.py b/google/ads/googleads/v6/services/services/user_list_service/__init__.py deleted file mode 100644 index 0a3155ce8..000000000 --- a/google/ads/googleads/v6/services/services/user_list_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import UserListServiceClient - -__all__ = ("UserListServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_list_service/client.py b/google/ads/googleads/v6/services/services/user_list_service/client.py deleted file mode 100644 index 062556c44..000000000 --- a/google/ads/googleads/v6/services/services/user_list_service/client.py +++ /dev/null @@ -1,524 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import user_list -from google.ads.googleads.v6.services.types import user_list_service -from google.rpc import status_pb2 as status # type: ignore - -from .transports.base import UserListServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import UserListServiceGrpcTransport - - -class UserListServiceClientMeta(type): - """Metaclass for the UserListService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[UserListServiceTransport]] - _transport_registry["grpc"] = UserListServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[UserListServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class UserListServiceClient(metaclass=UserListServiceClientMeta): - """Service to manage user lists.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserListServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserListServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> UserListServiceTransport: - """Return the transport used by the client instance. - - Returns: - UserListServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def user_list_path(customer_id: str, user_list_id: str,) -> str: - """Return a fully-qualified user_list string.""" - return "customers/{customer_id}/userLists/{user_list_id}".format( - customer_id=customer_id, user_list_id=user_list_id, - ) - - @staticmethod - def parse_user_list_path(path: str) -> Dict[str, str]: - """Parse a user_list path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLists/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, UserListServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the user list service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.UserListServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, UserListServiceTransport): - # transport is a UserListServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = UserListServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_user_list( - self, - request: user_list_service.GetUserListRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> user_list.UserList: - r"""Returns the requested user list. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetUserListRequest`): - The request object. Request message for - [UserListService.GetUserList][google.ads.googleads.v6.services.UserListService.GetUserList]. - resource_name (:class:`str`): - Required. The resource name of the - user list to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.UserList: - A user list. This is a list of users - a customer may target. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a user_list_service.GetUserListRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, user_list_service.GetUserListRequest): - request = user_list_service.GetUserListRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_user_list] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - def mutate_user_lists( - self, - request: user_list_service.MutateUserListsRequest = None, - *, - customer_id: str = None, - operations: Sequence[user_list_service.UserListOperation] = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> user_list_service.MutateUserListsResponse: - r"""Creates or updates user lists. Operation statuses are - returned. - - Args: - request (:class:`google.ads.googleads.v6.services.types.MutateUserListsRequest`): - The request object. Request message for - [UserListService.MutateUserLists][google.ads.googleads.v6.services.UserListService.MutateUserLists]. - customer_id (:class:`str`): - Required. The ID of the customer - whose user lists are being modified. - - This corresponds to the ``customer_id`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.UserListOperation]`): - Required. The list of operations to - perform on individual user lists. - - This corresponds to the ``operations`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.services.types.MutateUserListsResponse: - Response message for user list - mutate. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([customer_id, operations]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a user_list_service.MutateUserListsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, user_list_service.MutateUserListsRequest): - request = user_list_service.MutateUserListsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if customer_id is not None: - request.customer_id = customer_id - if operations is not None: - request.operations = operations - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.mutate_user_lists - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("customer_id", request.customer_id),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("UserListServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_list_service/transports/__init__.py b/google/ads/googleads/v6/services/services/user_list_service/transports/__init__.py deleted file mode 100644 index e3e1bfca1..000000000 --- a/google/ads/googleads/v6/services/services/user_list_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import UserListServiceTransport -from .grpc import UserListServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[UserListServiceTransport]] -_transport_registry["grpc"] = UserListServiceGrpcTransport - - -__all__ = ( - "UserListServiceTransport", - "UserListServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/user_list_service/transports/base.py b/google/ads/googleads/v6/services/services/user_list_service/transports/base.py deleted file mode 100644 index 6b8a060d4..000000000 --- a/google/ads/googleads/v6/services/services/user_list_service/transports/base.py +++ /dev/null @@ -1,115 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import user_list -from google.ads.googleads.v6.services.types import user_list_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class UserListServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for UserListService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_user_list: gapic_v1.method.wrap_method( - self.get_user_list, - default_timeout=None, - client_info=client_info, - ), - self.mutate_user_lists: gapic_v1.method.wrap_method( - self.mutate_user_lists, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_user_list( - self, - ) -> typing.Callable[ - [user_list_service.GetUserListRequest], user_list.UserList - ]: - raise NotImplementedError - - @property - def mutate_user_lists( - self, - ) -> typing.Callable[ - [user_list_service.MutateUserListsRequest], - user_list_service.MutateUserListsResponse, - ]: - raise NotImplementedError - - -__all__ = ("UserListServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/user_list_service/transports/grpc.py b/google/ads/googleads/v6/services/services/user_list_service/transports/grpc.py deleted file mode 100644 index dd34e8ae7..000000000 --- a/google/ads/googleads/v6/services/services/user_list_service/transports/grpc.py +++ /dev/null @@ -1,271 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import user_list -from google.ads.googleads.v6.services.types import user_list_service - -from .base import UserListServiceTransport, DEFAULT_CLIENT_INFO - - -class UserListServiceGrpcTransport(UserListServiceTransport): - """gRPC backend transport for UserListService. - - Service to manage user lists. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_user_list( - self, - ) -> Callable[[user_list_service.GetUserListRequest], user_list.UserList]: - r"""Return a callable for the get user list method over gRPC. - - Returns the requested user list. - - Returns: - Callable[[~.GetUserListRequest], - ~.UserList]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_user_list" not in self._stubs: - self._stubs["get_user_list"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.UserListService/GetUserList", - request_serializer=user_list_service.GetUserListRequest.serialize, - response_deserializer=user_list.UserList.deserialize, - ) - return self._stubs["get_user_list"] - - @property - def mutate_user_lists( - self, - ) -> Callable[ - [user_list_service.MutateUserListsRequest], - user_list_service.MutateUserListsResponse, - ]: - r"""Return a callable for the mutate user lists method over gRPC. - - Creates or updates user lists. Operation statuses are - returned. - - Returns: - Callable[[~.MutateUserListsRequest], - ~.MutateUserListsResponse]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "mutate_user_lists" not in self._stubs: - self._stubs["mutate_user_lists"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.UserListService/MutateUserLists", - request_serializer=user_list_service.MutateUserListsRequest.serialize, - response_deserializer=user_list_service.MutateUserListsResponse.deserialize, - ) - return self._stubs["mutate_user_lists"] - - -__all__ = ("UserListServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/user_location_view_service/__init__.py b/google/ads/googleads/v6/services/services/user_location_view_service/__init__.py deleted file mode 100644 index cde8cc1ee..000000000 --- a/google/ads/googleads/v6/services/services/user_location_view_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import UserLocationViewServiceClient - -__all__ = ("UserLocationViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_location_view_service/client.py b/google/ads/googleads/v6/services/services/user_location_view_service/client.py deleted file mode 100644 index 674f822bb..000000000 --- a/google/ads/googleads/v6/services/services/user_location_view_service/client.py +++ /dev/null @@ -1,455 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import user_location_view -from google.ads.googleads.v6.services.types import user_location_view_service - -from .transports.base import ( - UserLocationViewServiceTransport, - DEFAULT_CLIENT_INFO, -) -from .transports.grpc import UserLocationViewServiceGrpcTransport - - -class UserLocationViewServiceClientMeta(type): - """Metaclass for the UserLocationViewService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[UserLocationViewServiceTransport]] - _transport_registry["grpc"] = UserLocationViewServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[UserLocationViewServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class UserLocationViewServiceClient( - metaclass=UserLocationViewServiceClientMeta -): - """Service to manage user location views.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserLocationViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - UserLocationViewServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> UserLocationViewServiceTransport: - """Return the transport used by the client instance. - - Returns: - UserLocationViewServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def user_location_view_path( - customer_id: str, country_criterion_id: str, is_targeting_location: str, - ) -> str: - """Return a fully-qualified user_location_view string.""" - return "customers/{customer_id}/userLocationViews/{country_criterion_id}~{is_targeting_location}".format( - customer_id=customer_id, - country_criterion_id=country_criterion_id, - is_targeting_location=is_targeting_location, - ) - - @staticmethod - def parse_user_location_view_path(path: str) -> Dict[str, str]: - """Parse a user_location_view path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/userLocationViews/(?P.+?)~(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, UserLocationViewServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the user location view service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.UserLocationViewServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, UserLocationViewServiceTransport): - # transport is a UserLocationViewServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = UserLocationViewServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_user_location_view( - self, - request: user_location_view_service.GetUserLocationViewRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> user_location_view.UserLocationView: - r"""Returns the requested user location view in full - detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetUserLocationViewRequest`): - The request object. Request message for - [UserLocationViewService.GetUserLocationView][google.ads.googleads.v6.services.UserLocationViewService.GetUserLocationView]. - resource_name (:class:`str`): - Required. The resource name of the - user location view to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.UserLocationView: - A user location view. - User Location View includes all metrics - aggregated at the country level, one row - per country. It reports metrics at the - actual physical location of the user by - targeted or not targeted location. If - other segment fields are used, you may - get more than one row per country. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a user_location_view_service.GetUserLocationViewRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, user_location_view_service.GetUserLocationViewRequest - ): - request = user_location_view_service.GetUserLocationViewRequest( - request - ) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_user_location_view - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("UserLocationViewServiceClient",) diff --git a/google/ads/googleads/v6/services/services/user_location_view_service/transports/__init__.py b/google/ads/googleads/v6/services/services/user_location_view_service/transports/__init__.py deleted file mode 100644 index 7e0771aee..000000000 --- a/google/ads/googleads/v6/services/services/user_location_view_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import UserLocationViewServiceTransport -from .grpc import UserLocationViewServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[UserLocationViewServiceTransport]] -_transport_registry["grpc"] = UserLocationViewServiceGrpcTransport - - -__all__ = ( - "UserLocationViewServiceTransport", - "UserLocationViewServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/user_location_view_service/transports/base.py b/google/ads/googleads/v6/services/services/user_location_view_service/transports/base.py deleted file mode 100644 index 360a392a2..000000000 --- a/google/ads/googleads/v6/services/services/user_location_view_service/transports/base.py +++ /dev/null @@ -1,102 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import user_location_view -from google.ads.googleads.v6.services.types import user_location_view_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class UserLocationViewServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for UserLocationViewService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_user_location_view: gapic_v1.method.wrap_method( - self.get_user_location_view, - default_timeout=None, - client_info=client_info, - ), - } - - @property - def get_user_location_view( - self, - ) -> typing.Callable[ - [user_location_view_service.GetUserLocationViewRequest], - user_location_view.UserLocationView, - ]: - raise NotImplementedError - - -__all__ = ("UserLocationViewServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/user_location_view_service/transports/grpc.py b/google/ads/googleads/v6/services/services/user_location_view_service/transports/grpc.py deleted file mode 100644 index 288d17415..000000000 --- a/google/ads/googleads/v6/services/services/user_location_view_service/transports/grpc.py +++ /dev/null @@ -1,247 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import user_location_view -from google.ads.googleads.v6.services.types import user_location_view_service - -from .base import UserLocationViewServiceTransport, DEFAULT_CLIENT_INFO - - -class UserLocationViewServiceGrpcTransport(UserLocationViewServiceTransport): - """gRPC backend transport for UserLocationViewService. - - Service to manage user location views. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_user_location_view( - self, - ) -> Callable[ - [user_location_view_service.GetUserLocationViewRequest], - user_location_view.UserLocationView, - ]: - r"""Return a callable for the get user location view method over gRPC. - - Returns the requested user location view in full - detail. - - Returns: - Callable[[~.GetUserLocationViewRequest], - ~.UserLocationView]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_user_location_view" not in self._stubs: - self._stubs[ - "get_user_location_view" - ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.UserLocationViewService/GetUserLocationView", - request_serializer=user_location_view_service.GetUserLocationViewRequest.serialize, - response_deserializer=user_location_view.UserLocationView.deserialize, - ) - return self._stubs["get_user_location_view"] - - -__all__ = ("UserLocationViewServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/services/video_service/__init__.py b/google/ads/googleads/v6/services/services/video_service/__init__.py deleted file mode 100644 index ed4cdf69c..000000000 --- a/google/ads/googleads/v6/services/services/video_service/__init__.py +++ /dev/null @@ -1,20 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from .client import VideoServiceClient - -__all__ = ("VideoServiceClient",) diff --git a/google/ads/googleads/v6/services/services/video_service/client.py b/google/ads/googleads/v6/services/services/video_service/client.py deleted file mode 100644 index 7dc16ba1e..000000000 --- a/google/ads/googleads/v6/services/services/video_service/client.py +++ /dev/null @@ -1,430 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from distutils import util -import os -import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union - -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport import mtls # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.ads.googleads.v6.resources.types import video -from google.ads.googleads.v6.services.types import video_service - -from .transports.base import VideoServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc import VideoServiceGrpcTransport - - -class VideoServiceClientMeta(type): - """Metaclass for the VideoService client. - - This provides class-level methods for building and retrieving - support objects (e.g. transport) without polluting the client instance - objects. - """ - - _transport_registry = ( - OrderedDict() - ) # type: Dict[str, Type[VideoServiceTransport]] - _transport_registry["grpc"] = VideoServiceGrpcTransport - - def get_transport_class( - cls, label: str = None, - ) -> Type[VideoServiceTransport]: - """Return an appropriate transport class. - - Args: - label: The name of the desired transport. If none is - provided, then the first transport in the registry is used. - - Returns: - The transport class to use. - """ - # If a specific transport is requested, return that one. - if label: - return cls._transport_registry[label] - - # No transport is requested; return the default (that is, the first one - # in the dictionary). - return next(iter(cls._transport_registry.values())) - - -class VideoServiceClient(metaclass=VideoServiceClientMeta): - """Service to manage videos.""" - - @staticmethod - def _get_default_mtls_endpoint(api_endpoint): - """Convert api endpoint to mTLS endpoint. - Convert "*.sandbox.googleapis.com" and "*.googleapis.com" to - "*.mtls.sandbox.googleapis.com" and "*.mtls.googleapis.com" respectively. - Args: - api_endpoint (Optional[str]): the api endpoint to convert. - Returns: - str: converted mTLS api endpoint. - """ - if not api_endpoint: - return api_endpoint - - mtls_endpoint_re = re.compile( - r"(?P[^.]+)(?P\.mtls)?(?P\.sandbox)?(?P\.googleapis\.com)?" - ) - - m = mtls_endpoint_re.match(api_endpoint) - name, mtls, sandbox, googledomain = m.groups() - if mtls or not googledomain: - return api_endpoint - - if sandbox: - return api_endpoint.replace( - "sandbox.googleapis.com", "mtls.sandbox.googleapis.com" - ) - - return api_endpoint.replace(".googleapis.com", ".mtls.googleapis.com") - - DEFAULT_ENDPOINT = "googleads.googleapis.com" - DEFAULT_MTLS_ENDPOINT = _get_default_mtls_endpoint.__func__( # type: ignore - DEFAULT_ENDPOINT - ) - - @classmethod - def from_service_account_info(cls, info: dict, *args, **kwargs): - """Creates an instance of this client using the provided credentials info. - - Args: - info (dict): The service account private key info. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - VideoServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_info( - info - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - @classmethod - def from_service_account_file(cls, filename: str, *args, **kwargs): - """Creates an instance of this client using the provided credentials - file. - - Args: - filename (str): The path to the service account private key json - file. - args: Additional arguments to pass to the constructor. - kwargs: Additional arguments to pass to the constructor. - - Returns: - VideoServiceClient: The constructed client. - """ - credentials = service_account.Credentials.from_service_account_file( - filename - ) - kwargs["credentials"] = credentials - return cls(*args, **kwargs) - - from_service_account_json = from_service_account_file - - @property - def transport(self) -> VideoServiceTransport: - """Return the transport used by the client instance. - - Returns: - VideoServiceTransport: The transport used by the client instance. - """ - return self._transport - - @staticmethod - def video_path(customer_id: str, video_id: str,) -> str: - """Return a fully-qualified video string.""" - return "customers/{customer_id}/videos/{video_id}".format( - customer_id=customer_id, video_id=video_id, - ) - - @staticmethod - def parse_video_path(path: str) -> Dict[str, str]: - """Parse a video path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/videos/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - @staticmethod - def common_billing_account_path(billing_account: str,) -> str: - """Return a fully-qualified billing_account string.""" - return "billingAccounts/{billing_account}".format( - billing_account=billing_account, - ) - - @staticmethod - def parse_common_billing_account_path(path: str) -> Dict[str, str]: - """Parse a billing_account path into its component segments.""" - m = re.match(r"^billingAccounts/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_folder_path(folder: str,) -> str: - """Return a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) - - @staticmethod - def parse_common_folder_path(path: str) -> Dict[str, str]: - """Parse a folder path into its component segments.""" - m = re.match(r"^folders/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_organization_path(organization: str,) -> str: - """Return a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) - - @staticmethod - def parse_common_organization_path(path: str) -> Dict[str, str]: - """Parse a organization path into its component segments.""" - m = re.match(r"^organizations/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_project_path(project: str,) -> str: - """Return a fully-qualified project string.""" - return "projects/{project}".format(project=project,) - - @staticmethod - def parse_common_project_path(path: str) -> Dict[str, str]: - """Parse a project path into its component segments.""" - m = re.match(r"^projects/(?P.+?)$", path) - return m.groupdict() if m else {} - - @staticmethod - def common_location_path(project: str, location: str,) -> str: - """Return a fully-qualified location string.""" - return "projects/{project}/locations/{location}".format( - project=project, location=location, - ) - - @staticmethod - def parse_common_location_path(path: str) -> Dict[str, str]: - """Parse a location path into its component segments.""" - m = re.match( - r"^projects/(?P.+?)/locations/(?P.+?)$", path - ) - return m.groupdict() if m else {} - - def __init__( - self, - *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, VideoServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the video service client. - - Args: - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - transport (Union[str, ~.VideoServiceTransport]): The - transport to use. If set to None, a transport is chosen - automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the - client. It won't take effect if a ``transport`` instance is provided. - (1) The ``api_endpoint`` property can be used to override the - default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT - environment variable can also be used to override the endpoint: - "always" (always use the default mTLS endpoint), "never" (always - use the default regular endpoint) and "auto" (auto switch to the - default mTLS endpoint if client certificate is present, this is - the default value). However, the ``api_endpoint`` property takes - precedence if provided. - (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable - is "true", then the ``client_cert_source`` property can be used - to provide client certificate for mutual TLS transport. If - not provided, the default SSL client certificate will be used if - present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not - set, no client certificate will be used. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - if isinstance(client_options, dict): - client_options = client_options_lib.from_dict(client_options) - if client_options is None: - client_options = client_options_lib.ClientOptions() - - # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") - ) - ) - - ssl_credentials = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - is_mtls = True - else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - api_endpoint = ( - self.DEFAULT_MTLS_ENDPOINT - if is_mtls - else self.DEFAULT_ENDPOINT - ) - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted values: never, auto, always" - ) - - # Save or instantiate the transport. - # Ordinarily, we provide the transport, but allowing a custom transport - # instance provides an extensibility point for unusual situations. - if isinstance(transport, VideoServiceTransport): - # transport is a VideoServiceTransport instance. - if credentials: - raise ValueError( - "When providing a transport instance, " - "provide its credentials directly." - ) - self._transport = transport - elif isinstance(transport, str): - Transport = type(self).get_transport_class(transport) - self._transport = Transport( - credentials=credentials, host=self.DEFAULT_ENDPOINT - ) - else: - self._transport = VideoServiceGrpcTransport( - credentials=credentials, - host=api_endpoint, - ssl_channel_credentials=ssl_credentials, - client_info=client_info, - ) - - def get_video( - self, - request: video_service.GetVideoRequest = None, - *, - resource_name: str = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> video.Video: - r"""Returns the requested video in full detail. - - Args: - request (:class:`google.ads.googleads.v6.services.types.GetVideoRequest`): - The request object. Request message for - [VideoService.GetVideo][google.ads.googleads.v6.services.VideoService.GetVideo]. - resource_name (:class:`str`): - Required. The resource name of the - video to fetch. - - This corresponds to the ``resource_name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.ads.googleads.v6.resources.types.Video: - A video. - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - if request is not None and any([resource_name]): - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a video_service.GetVideoRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, video_service.GetVideoRequest): - request = video_service.GetVideoRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - - if resource_name is not None: - request.resource_name = resource_name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_video] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("resource_name", request.resource_name),) - ), - ) - - # Send the request. - response = rpc( - request, retry=retry, timeout=timeout, metadata=metadata, - ) - - # Done; return the response. - return response - - -__all__ = ("VideoServiceClient",) diff --git a/google/ads/googleads/v6/services/services/video_service/transports/__init__.py b/google/ads/googleads/v6/services/services/video_service/transports/__init__.py deleted file mode 100644 index 3a55dd423..000000000 --- a/google/ads/googleads/v6/services/services/video_service/transports/__init__.py +++ /dev/null @@ -1,35 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -from collections import OrderedDict -from typing import Dict, Type - -from .base import VideoServiceTransport -from .grpc import VideoServiceGrpcTransport - - -# Compile a registry of transports. -_transport_registry = ( - OrderedDict() -) # type: Dict[str, Type[VideoServiceTransport]] -_transport_registry["grpc"] = VideoServiceGrpcTransport - - -__all__ = ( - "VideoServiceTransport", - "VideoServiceGrpcTransport", -) diff --git a/google/ads/googleads/v6/services/services/video_service/transports/base.py b/google/ads/googleads/v6/services/services/video_service/transports/base.py deleted file mode 100644 index 9fa69e52e..000000000 --- a/google/ads/googleads/v6/services/services/video_service/transports/base.py +++ /dev/null @@ -1,97 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import abc -import typing -import pkg_resources - -from google import auth -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import video -from google.ads.googleads.v6.services.types import video_service - - -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-ads",).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() - - -class VideoServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for VideoService.""" - - AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - """ - # Save the hostname. Default to port 443 (HTTPS) if none is specified. - if ":" not in host: - host += ":443" - self._host = host - - # If no credentials are provided, then determine the appropriate - # defaults. - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # Save the credentials. - self._credentials = credentials - - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - - def _prep_wrapped_messages(self, client_info): - # Precomputed wrapped methods - self._wrapped_methods = { - self.get_video: gapic_v1.method.wrap_method( - self.get_video, default_timeout=None, client_info=client_info, - ), - } - - @property - def get_video( - self, - ) -> typing.Callable[[video_service.GetVideoRequest], video.Video]: - raise NotImplementedError - - -__all__ = ("VideoServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/video_service/transports/grpc.py b/google/ads/googleads/v6/services/services/video_service/transports/grpc.py deleted file mode 100644 index 956a17b3d..000000000 --- a/google/ads/googleads/v6/services/services/video_service/transports/grpc.py +++ /dev/null @@ -1,241 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import warnings -from typing import Callable, Dict, Optional, Sequence, Tuple - -from google.api_core import grpc_helpers # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore -from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.ads.googleads.v6.resources.types import video -from google.ads.googleads.v6.services.types import video_service - -from .base import VideoServiceTransport, DEFAULT_CLIENT_INFO - - -class VideoServiceGrpcTransport(VideoServiceTransport): - """gRPC backend transport for VideoService. - - Service to manage videos. - - This class defines the same methods as the primary client, so the - primary client can load the underlying transport implementation - and call it. - - It sends protocol buffers over the wire using gRPC (which is built on - top of HTTP/2); the ``grpcio`` package must be installed. - """ - - def __init__( - self, - *, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - quota_project_id: Optional[str] = None, - client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, - ) -> None: - """Instantiate the transport. - - Args: - host (Optional[str]): The hostname to connect to. - credentials (Optional[google.auth.credentials.Credentials]): The - authorization credentials to attach to requests. These - credentials identify the application to the service; if none - are specified, the client will attempt to ascertain the - credentials from the environment. - This argument is ignored if ``channel`` is provided. - credentials_file (Optional[str]): A file with credentials that can - be loaded with :func:`google.auth.load_credentials_from_file`. - This argument is ignored if ``channel`` is provided. - scopes (Optional(Sequence[str])): A list of scopes. This argument is - ignored if ``channel`` is provided. - channel (Optional[grpc.Channel]): A ``Channel`` instance through - which to make calls. - api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint. - If provided, it overrides the ``host`` argument and tries to create - a mutual TLS channel with client SSL credentials from - ``client_cert_source`` or applicatin default SSL credentials. - client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]): - Deprecated. A callback to provide client SSL certificate bytes and - private key bytes, both in PEM format. It is ignored if - ``api_mtls_endpoint`` is None. - ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials - for grpc channel. It is ignored if ``channel`` is provided. - quota_project_id (Optional[str]): An optional project to use for billing - and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing - your own client library. - - Raises: - google.auth.exceptions.MutualTLSChannelError: If mutual TLS transport - creation failed for any reason. - """ - self._ssl_channel_credentials = ssl_channel_credentials - - if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. - credentials = False - - # If a channel was explicitly provided, set it. - self._grpc_channel = channel - self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) - else: - ssl_credentials = SslCredentials().ssl_credentials - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) - - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - ssl_credentials=ssl_channel_credentials, - scopes=self.AUTH_SCOPES, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - - self._stubs = {} # type: Dict[str, Callable] - - # Run the base constructor. - super().__init__( - host=host, credentials=credentials, client_info=client_info, - ) - - @classmethod - def create_channel( - cls, - host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, - scopes: Optional[Sequence[str]] = None, - **kwargs, - ) -> grpc.Channel: - """Create and return a gRPC channel object. - Args: - address (Optionsl[str]): The host for the channel to use. - credentials (Optional[~.Credentials]): The - authorization credentials to attach to requests. These - credentials identify this application to the service. If - none are specified, the client will attempt to ascertain - the credentials from the environment. - scopes (Optional[Sequence[str]]): A optional list of scopes needed for this - service. These are only used when credentials are not specified and - are passed to :func:`google.auth.default`. - kwargs (Optional[dict]): Keyword arguments, which are passed to the - channel creation. - Returns: - grpc.Channel: A gRPC channel object. - """ - return grpc_helpers.create_channel( - host, - credentials=credentials, - scopes=scopes or cls.AUTH_SCOPES, - **kwargs, - ) - - @property - def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ - return self._grpc_channel - - @property - def get_video( - self, - ) -> Callable[[video_service.GetVideoRequest], video.Video]: - r"""Return a callable for the get video method over gRPC. - - Returns the requested video in full detail. - - Returns: - Callable[[~.GetVideoRequest], - ~.Video]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "get_video" not in self._stubs: - self._stubs["get_video"] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.VideoService/GetVideo", - request_serializer=video_service.GetVideoRequest.serialize, - response_deserializer=video.Video.deserialize, - ) - return self._stubs["get_video"] - - -__all__ = ("VideoServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/services/types/__init__.py b/google/ads/googleads/v6/services/types/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/services/types/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v6/services/types/account_budget_proposal_service.py b/google/ads/googleads/v6/services/types/account_budget_proposal_service.py deleted file mode 100644 index 5fb8d2f73..000000000 --- a/google/ads/googleads/v6/services/types/account_budget_proposal_service.py +++ /dev/null @@ -1,138 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import account_budget_proposal -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAccountBudgetProposalRequest", - "MutateAccountBudgetProposalRequest", - "AccountBudgetProposalOperation", - "MutateAccountBudgetProposalResponse", - "MutateAccountBudgetProposalResult", - }, -) - - -class GetAccountBudgetProposalRequest(proto.Message): - r"""Request message for - [AccountBudgetProposalService.GetAccountBudgetProposal][google.ads.googleads.v6.services.AccountBudgetProposalService.GetAccountBudgetProposal]. - - Attributes: - resource_name (str): - Required. The resource name of the account- - evel budget proposal to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAccountBudgetProposalRequest(proto.Message): - r"""Request message for - [AccountBudgetProposalService.MutateAccountBudgetProposal][google.ads.googleads.v6.services.AccountBudgetProposalService.MutateAccountBudgetProposal]. - - Attributes: - customer_id (str): - Required. The ID of the customer. - operation (google.ads.googleads.v6.services.types.AccountBudgetProposalOperation): - Required. The operation to perform on an - individual account-level budget proposal. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="AccountBudgetProposalOperation", - ) - validate_only = proto.Field(proto.BOOL, number=3) - - -class AccountBudgetProposalOperation(proto.Message): - r"""A single operation to propose the creation of a new account- - evel budget or edit/end/remove an existing one. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which budget fields - are modified. While budgets may be modified, - proposals that propose such modifications are - final. Therefore, update operations are not - supported for proposals. - Proposals that modify budgets have the 'update' - proposal type. Specifying a mask for any other - proposal type is considered an error. - create (google.ads.googleads.v6.resources.types.AccountBudgetProposal): - Create operation: A new proposal to create a - new budget, edit an existing budget, end an - actively running budget, or remove an approved - budget scheduled to start in the future. - No resource name is expected for the new - proposal. - remove (str): - Remove operation: A resource name for the removed proposal - is expected, in this format: - - ``customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}`` - A request may be cancelled iff it is pending. - """ - - update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=account_budget_proposal.AccountBudgetProposal, - ) - remove = proto.Field(proto.STRING, number=1, oneof="operation") - - -class MutateAccountBudgetProposalResponse(proto.Message): - r"""Response message for account-level budget mutate operations. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateAccountBudgetProposalResult): - The result of the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=2, message="MutateAccountBudgetProposalResult", - ) - - -class MutateAccountBudgetProposalResult(proto.Message): - r"""The result for the account budget proposal mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/account_budget_service.py b/google/ads/googleads/v6/services/types/account_budget_service.py deleted file mode 100644 index 6d6cbd873..000000000 --- a/google/ads/googleads/v6/services/types/account_budget_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAccountBudgetRequest",}, -) - - -class GetAccountBudgetRequest(proto.Message): - r"""Request message for - [AccountBudgetService.GetAccountBudget][google.ads.googleads.v6.services.AccountBudgetService.GetAccountBudget]. - - Attributes: - resource_name (str): - Required. The resource name of the account- - evel budget to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/account_link_service.py b/google/ads/googleads/v6/services/types/account_link_service.py deleted file mode 100644 index cd28ada9f..000000000 --- a/google/ads/googleads/v6/services/types/account_link_service.py +++ /dev/null @@ -1,168 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ( - account_link as gagr_account_link, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAccountLinkRequest", - "CreateAccountLinkRequest", - "CreateAccountLinkResponse", - "MutateAccountLinkRequest", - "AccountLinkOperation", - "MutateAccountLinkResponse", - "MutateAccountLinkResult", - }, -) - - -class GetAccountLinkRequest(proto.Message): - r"""Request message for - [AccountLinkService.GetAccountLink][google.ads.googleads.v6.services.AccountLinkService.GetAccountLink]. - - Attributes: - resource_name (str): - Required. Resource name of the account link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class CreateAccountLinkRequest(proto.Message): - r"""Request message for - [AccountLinkService.CreateAccountLink][google.ads.googleads.v6.services.AccountLinkService.CreateAccountLink]. - - Attributes: - customer_id (str): - Required. The ID of the customer for which - the account link is created. - account_link (google.ads.googleads.v6.resources.types.AccountLink): - Required. The account link to be created. - """ - - customer_id = proto.Field(proto.STRING, number=1) - account_link = proto.Field( - proto.MESSAGE, number=2, message=gagr_account_link.AccountLink, - ) - - -class CreateAccountLinkResponse(proto.Message): - r"""Response message for - [AccountLinkService.CreateAccountLink][google.ads.googleads.v6.services.AccountLinkService.CreateAccountLink]. - - Attributes: - resource_name (str): - Returned for successful operations. Resource - name of the account link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAccountLinkRequest(proto.Message): - r"""Request message for - [AccountLinkService.MutateAccountLink][google.ads.googleads.v6.services.AccountLinkService.MutateAccountLink]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - modified. - operation (google.ads.googleads.v6.services.types.AccountLinkOperation): - Required. The operation to perform on the - link. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="AccountLinkOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class AccountLinkOperation(proto.Message): - r"""A single update on an account link. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - update (google.ads.googleads.v6.resources.types.AccountLink): - Update operation: The account link is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the account link to - remove is expected, in this format: - - ``customers/{customer_id}/accountLinks/{account_link_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_account_link.AccountLink, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAccountLinkResponse(proto.Message): - r"""Response message for account link mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateAccountLinkResult): - Result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=1, message="MutateAccountLinkResult", - ) - - -class MutateAccountLinkResult(proto.Message): - r"""The result for the account link mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_ad_asset_view_service.py b/google/ads/googleads/v6/services/types/ad_group_ad_asset_view_service.py deleted file mode 100644 index f03181e23..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_ad_asset_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAdGroupAdAssetViewRequest",}, -) - - -class GetAdGroupAdAssetViewRequest(proto.Message): - r"""Request message for - [AdGroupAdAssetViewService.GetAdGroupAdAssetView][google.ads.googleads.v6.services.AdGroupAdAssetViewService.GetAdGroupAdAssetView]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - ad asset view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_ad_label_service.py b/google/ads/googleads/v6/services/types/ad_group_ad_label_service.py deleted file mode 100644 index 343657bb8..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_ad_label_service.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ad_group_ad_label -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupAdLabelRequest", - "MutateAdGroupAdLabelsRequest", - "AdGroupAdLabelOperation", - "MutateAdGroupAdLabelsResponse", - "MutateAdGroupAdLabelResult", - }, -) - - -class GetAdGroupAdLabelRequest(proto.Message): - r"""Request message for - [AdGroupAdLabelService.GetAdGroupAdLabel][google.ads.googleads.v6.services.AdGroupAdLabelService.GetAdGroupAdLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - ad label to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupAdLabelsRequest(proto.Message): - r"""Request message for - [AdGroupAdLabelService.MutateAdGroupAdLabels][google.ads.googleads.v6.services.AdGroupAdLabelService.MutateAdGroupAdLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose ad group - ad labels are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupAdLabelOperation]): - Required. The list of operations to perform - on ad group ad labels. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupAdLabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class AdGroupAdLabelOperation(proto.Message): - r"""A single operation (create, remove) on an ad group ad label. - - Attributes: - create (google.ads.googleads.v6.resources.types.AdGroupAdLabel): - Create operation: No resource name is - expected for the new ad group ad label. - remove (str): - Remove operation: A resource name for the ad group ad label - being removed, in this format: - - ``customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id} _{label_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=ad_group_ad_label.AdGroupAdLabel, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateAdGroupAdLabelsResponse(proto.Message): - r"""Response message for an ad group ad labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupAdLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupAdLabelResult", - ) - - -class MutateAdGroupAdLabelResult(proto.Message): - r"""The result for an ad group ad label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_ad_service.py b/google/ads/googleads/v6/services/types/ad_group_ad_service.py deleted file mode 100644 index 446868c70..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_ad_service.py +++ /dev/null @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_ad as gagr_ad_group_ad, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupAdRequest", - "MutateAdGroupAdsRequest", - "AdGroupAdOperation", - "MutateAdGroupAdsResponse", - "MutateAdGroupAdResult", - }, -) - - -class GetAdGroupAdRequest(proto.Message): - r"""Request message for - [AdGroupAdService.GetAdGroupAd][google.ads.googleads.v6.services.AdGroupAdService.GetAdGroupAd]. - - Attributes: - resource_name (str): - Required. The resource name of the ad to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupAdsRequest(proto.Message): - r"""Request message for - [AdGroupAdService.MutateAdGroupAds][google.ads.googleads.v6.services.AdGroupAdService.MutateAdGroupAds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose ads - are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupAdOperation]): - Required. The list of operations to perform - on individual ads. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupAdOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdGroupAdOperation(proto.Message): - r"""A single operation (create, update, remove) on an ad group - ad. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - policy_validation_parameter (google.ads.googleads.v6.common.types.PolicyValidationParameter): - Configuration for how policies are validated. - create (google.ads.googleads.v6.resources.types.AdGroupAd): - Create operation: No resource name is - expected for the new ad. - update (google.ads.googleads.v6.resources.types.AdGroupAd): - Update operation: The ad is expected to have - a valid resource name. - remove (str): - Remove operation: A resource name for the removed ad is - expected, in this format: - - ``customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - policy_validation_parameter = proto.Field( - proto.MESSAGE, number=5, message=policy.PolicyValidationParameter, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group_ad.AdGroupAd, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group_ad.AdGroupAd, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupAdsResponse(proto.Message): - r"""Response message for an ad group ad mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupAdResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupAdResult", - ) - - -class MutateAdGroupAdResult(proto.Message): - r"""The result for the ad mutate. - - Attributes: - resource_name (str): - The resource name returned for successful - operations. - ad_group_ad (google.ads.googleads.v6.resources.types.AdGroupAd): - The mutated ad group ad with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_ad = proto.Field( - proto.MESSAGE, number=2, message=gagr_ad_group_ad.AdGroupAd, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_audience_view_service.py b/google/ads/googleads/v6/services/types/ad_group_audience_view_service.py deleted file mode 100644 index 596c6fda1..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_audience_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAdGroupAudienceViewRequest",}, -) - - -class GetAdGroupAudienceViewRequest(proto.Message): - r"""Request message for - [AdGroupAudienceViewService.GetAdGroupAudienceView][google.ads.googleads.v6.services.AdGroupAudienceViewService.GetAdGroupAudienceView]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - audience view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_bid_modifier_service.py b/google/ads/googleads/v6/services/types/ad_group_bid_modifier_service.py deleted file mode 100644 index 1ecf36c5d..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_bid_modifier_service.py +++ /dev/null @@ -1,177 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_bid_modifier as gagr_ad_group_bid_modifier, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupBidModifierRequest", - "MutateAdGroupBidModifiersRequest", - "AdGroupBidModifierOperation", - "MutateAdGroupBidModifiersResponse", - "MutateAdGroupBidModifierResult", - }, -) - - -class GetAdGroupBidModifierRequest(proto.Message): - r"""Request message for - [AdGroupBidModifierService.GetAdGroupBidModifier][google.ads.googleads.v6.services.AdGroupBidModifierService.GetAdGroupBidModifier]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - bid modifier to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupBidModifiersRequest(proto.Message): - r"""Request message for - [AdGroupBidModifierService.MutateAdGroupBidModifiers][google.ads.googleads.v6.services.AdGroupBidModifierService.MutateAdGroupBidModifiers]. - - Attributes: - customer_id (str): - Required. ID of the customer whose ad group - bid modifiers are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupBidModifierOperation]): - Required. The list of operations to perform - on individual ad group bid modifiers. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupBidModifierOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdGroupBidModifierOperation(proto.Message): - r"""A single operation (create, remove, update) on an ad group - bid modifier. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.AdGroupBidModifier): - Create operation: No resource name is - expected for the new ad group bid modifier. - update (google.ads.googleads.v6.resources.types.AdGroupBidModifier): - Update operation: The ad group bid modifier - is expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed ad group - bid modifier is expected, in this format: - - ``customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group_bid_modifier.AdGroupBidModifier, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group_bid_modifier.AdGroupBidModifier, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupBidModifiersResponse(proto.Message): - r"""Response message for ad group bid modifiers mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupBidModifierResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupBidModifierResult", - ) - - -class MutateAdGroupBidModifierResult(proto.Message): - r"""The result for the criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - ad_group_bid_modifier (google.ads.googleads.v6.resources.types.AdGroupBidModifier): - The mutated ad group bid modifier with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_bid_modifier = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_ad_group_bid_modifier.AdGroupBidModifier, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_criterion_label_service.py b/google/ads/googleads/v6/services/types/ad_group_criterion_label_service.py deleted file mode 100644 index 4fa688885..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_criterion_label_service.py +++ /dev/null @@ -1,138 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ad_group_criterion_label -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupCriterionLabelRequest", - "MutateAdGroupCriterionLabelsRequest", - "AdGroupCriterionLabelOperation", - "MutateAdGroupCriterionLabelsResponse", - "MutateAdGroupCriterionLabelResult", - }, -) - - -class GetAdGroupCriterionLabelRequest(proto.Message): - r"""Request message for - [AdGroupCriterionLabelService.GetAdGroupCriterionLabel][google.ads.googleads.v6.services.AdGroupCriterionLabelService.GetAdGroupCriterionLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - criterion label to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupCriterionLabelsRequest(proto.Message): - r"""Request message for - [AdGroupCriterionLabelService.MutateAdGroupCriterionLabels][google.ads.googleads.v6.services.AdGroupCriterionLabelService.MutateAdGroupCriterionLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose ad group - criterion labels are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupCriterionLabelOperation]): - Required. The list of operations to perform - on ad group criterion labels. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupCriterionLabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class AdGroupCriterionLabelOperation(proto.Message): - r"""A single operation (create, remove) on an ad group criterion - label. - - Attributes: - create (google.ads.googleads.v6.resources.types.AdGroupCriterionLabel): - Create operation: No resource name is - expected for the new ad group label. - remove (str): - Remove operation: A resource name for the ad group criterion - label being removed, in this format: - - ``customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=ad_group_criterion_label.AdGroupCriterionLabel, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateAdGroupCriterionLabelsResponse(proto.Message): - r"""Response message for an ad group criterion labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupCriterionLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupCriterionLabelResult", - ) - - -class MutateAdGroupCriterionLabelResult(proto.Message): - r"""The result for an ad group criterion label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_criterion_service.py b/google/ads/googleads/v6/services/types/ad_group_criterion_service.py deleted file mode 100644 index db911b5b0..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_criterion_service.py +++ /dev/null @@ -1,191 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion as gagr_ad_group_criterion, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupCriterionRequest", - "MutateAdGroupCriteriaRequest", - "AdGroupCriterionOperation", - "MutateAdGroupCriteriaResponse", - "MutateAdGroupCriterionResult", - }, -) - - -class GetAdGroupCriterionRequest(proto.Message): - r"""Request message for - [AdGroupCriterionService.GetAdGroupCriterion][google.ads.googleads.v6.services.AdGroupCriterionService.GetAdGroupCriterion]. - - Attributes: - resource_name (str): - Required. The resource name of the criterion - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupCriteriaRequest(proto.Message): - r"""Request message for - [AdGroupCriterionService.MutateAdGroupCriteria][google.ads.googleads.v6.services.AdGroupCriterionService.MutateAdGroupCriteria]. - - Attributes: - customer_id (str): - Required. ID of the customer whose criteria - are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupCriterionOperation]): - Required. The list of operations to perform - on individual criteria. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupCriterionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdGroupCriterionOperation(proto.Message): - r"""A single operation (create, remove, update) on an ad group - criterion. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - exempt_policy_violation_keys (Sequence[google.ads.googleads.v6.common.types.PolicyViolationKey]): - The list of policy violation keys that should not cause a - PolicyViolationError to be reported. Not all policy - violations are exemptable, please refer to the is_exemptible - field in the returned PolicyViolationError. - - Resources violating these polices will be saved, but will - not be eligible to serve. They may begin serving at a later - time due to a change in policies, re-review of the resource, - or a change in advertiser certificates. - create (google.ads.googleads.v6.resources.types.AdGroupCriterion): - Create operation: No resource name is - expected for the new criterion. - update (google.ads.googleads.v6.resources.types.AdGroupCriterion): - Update operation: The criterion is expected - to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed criterion - is expected, in this format: - - ``customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - exempt_policy_violation_keys = proto.RepeatedField( - proto.MESSAGE, number=5, message=policy.PolicyViolationKey, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group_criterion.AdGroupCriterion, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group_criterion.AdGroupCriterion, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupCriteriaResponse(proto.Message): - r"""Response message for an ad group criterion mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupCriterionResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupCriterionResult", - ) - - -class MutateAdGroupCriterionResult(proto.Message): - r"""The result for the criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - ad_group_criterion (google.ads.googleads.v6.resources.types.AdGroupCriterion): - The mutated ad group criterion with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_criterion = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_ad_group_criterion.AdGroupCriterion, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_criterion_simulation_service.py b/google/ads/googleads/v6/services/types/ad_group_criterion_simulation_service.py deleted file mode 100644 index 84954c8b6..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_criterion_simulation_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAdGroupCriterionSimulationRequest",}, -) - - -class GetAdGroupCriterionSimulationRequest(proto.Message): - r"""Request message for - [AdGroupCriterionSimulationService.GetAdGroupCriterionSimulation][google.ads.googleads.v6.services.AdGroupCriterionSimulationService.GetAdGroupCriterionSimulation]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - criterion simulation to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_extension_setting_service.py b/google/ads/googleads/v6/services/types/ad_group_extension_setting_service.py deleted file mode 100644 index 5ce664cf0..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_extension_setting_service.py +++ /dev/null @@ -1,178 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_extension_setting as gagr_ad_group_extension_setting, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupExtensionSettingRequest", - "MutateAdGroupExtensionSettingsRequest", - "AdGroupExtensionSettingOperation", - "MutateAdGroupExtensionSettingsResponse", - "MutateAdGroupExtensionSettingResult", - }, -) - - -class GetAdGroupExtensionSettingRequest(proto.Message): - r"""Request message for - [AdGroupExtensionSettingService.GetAdGroupExtensionSetting][google.ads.googleads.v6.services.AdGroupExtensionSettingService.GetAdGroupExtensionSetting]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - extension setting to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupExtensionSettingsRequest(proto.Message): - r"""Request message for - [AdGroupExtensionSettingService.MutateAdGroupExtensionSettings][google.ads.googleads.v6.services.AdGroupExtensionSettingService.MutateAdGroupExtensionSettings]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose ad - group extension settings are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupExtensionSettingOperation]): - Required. The list of operations to perform - on individual ad group extension settings. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupExtensionSettingOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class AdGroupExtensionSettingOperation(proto.Message): - r"""A single operation (create, update, remove) on an ad group - extension setting. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - create (google.ads.googleads.v6.resources.types.AdGroupExtensionSetting): - Create operation: No resource name is - expected for the new ad group extension setting. - update (google.ads.googleads.v6.resources.types.AdGroupExtensionSetting): - Update operation: The ad group extension - setting is expected to have a valid resource - name. - remove (str): - Remove operation: A resource name for the removed ad group - extension setting is expected, in this format: - - ``customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group_extension_setting.AdGroupExtensionSetting, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group_extension_setting.AdGroupExtensionSetting, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupExtensionSettingsResponse(proto.Message): - r"""Response message for an ad group extension setting mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupExtensionSettingResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupExtensionSettingResult", - ) - - -class MutateAdGroupExtensionSettingResult(proto.Message): - r"""The result for the ad group extension setting mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - ad_group_extension_setting (google.ads.googleads.v6.resources.types.AdGroupExtensionSetting): - The mutated AdGroupExtensionSetting with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_extension_setting = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_ad_group_extension_setting.AdGroupExtensionSetting, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_feed_service.py b/google/ads/googleads/v6/services/types/ad_group_feed_service.py deleted file mode 100644 index e870ece54..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_feed_service.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_feed as gagr_ad_group_feed, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupFeedRequest", - "MutateAdGroupFeedsRequest", - "AdGroupFeedOperation", - "MutateAdGroupFeedsResponse", - "MutateAdGroupFeedResult", - }, -) - - -class GetAdGroupFeedRequest(proto.Message): - r"""Request message for - [AdGroupFeedService.GetAdGroupFeed][google.ads.googleads.v6.services.AdGroupFeedService.GetAdGroupFeed]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - feed to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupFeedsRequest(proto.Message): - r"""Request message for - [AdGroupFeedService.MutateAdGroupFeeds][google.ads.googleads.v6.services.AdGroupFeedService.MutateAdGroupFeeds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose ad - group feeds are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupFeedOperation]): - Required. The list of operations to perform - on individual ad group feeds. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupFeedOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdGroupFeedOperation(proto.Message): - r"""A single operation (create, update, remove) on an ad group - feed. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.AdGroupFeed): - Create operation: No resource name is - expected for the new ad group feed. - update (google.ads.googleads.v6.resources.types.AdGroupFeed): - Update operation: The ad group feed is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed ad group - feed is expected, in this format: - - ``customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group_feed.AdGroupFeed, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group_feed.AdGroupFeed, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupFeedsResponse(proto.Message): - r"""Response message for an ad group feed mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupFeedResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupFeedResult", - ) - - -class MutateAdGroupFeedResult(proto.Message): - r"""The result for the ad group feed mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - ad_group_feed (google.ads.googleads.v6.resources.types.AdGroupFeed): - The mutated ad group feed with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group_feed = proto.Field( - proto.MESSAGE, number=2, message=gagr_ad_group_feed.AdGroupFeed, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_label_service.py b/google/ads/googleads/v6/services/types/ad_group_label_service.py deleted file mode 100644 index c5bdf2a1d..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_label_service.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ad_group_label -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupLabelRequest", - "MutateAdGroupLabelsRequest", - "AdGroupLabelOperation", - "MutateAdGroupLabelsResponse", - "MutateAdGroupLabelResult", - }, -) - - -class GetAdGroupLabelRequest(proto.Message): - r"""Request message for - [AdGroupLabelService.GetAdGroupLabel][google.ads.googleads.v6.services.AdGroupLabelService.GetAdGroupLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - label to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupLabelsRequest(proto.Message): - r"""Request message for - [AdGroupLabelService.MutateAdGroupLabels][google.ads.googleads.v6.services.AdGroupLabelService.MutateAdGroupLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose ad group - labels are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupLabelOperation]): - Required. The list of operations to perform - on ad group labels. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupLabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class AdGroupLabelOperation(proto.Message): - r"""A single operation (create, remove) on an ad group label. - - Attributes: - create (google.ads.googleads.v6.resources.types.AdGroupLabel): - Create operation: No resource name is - expected for the new ad group label. - remove (str): - Remove operation: A resource name for the ad group label - being removed, in this format: - - ``customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=ad_group_label.AdGroupLabel, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateAdGroupLabelsResponse(proto.Message): - r"""Response message for an ad group labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupLabelResult", - ) - - -class MutateAdGroupLabelResult(proto.Message): - r"""The result for an ad group label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_service.py b/google/ads/googleads/v6/services/types/ad_group_service.py deleted file mode 100644 index bce73cdb5..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_service.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ad_group as gagr_ad_group -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdGroupRequest", - "MutateAdGroupsRequest", - "AdGroupOperation", - "MutateAdGroupsResponse", - "MutateAdGroupResult", - }, -) - - -class GetAdGroupRequest(proto.Message): - r"""Request message for - [AdGroupService.GetAdGroup][google.ads.googleads.v6.services.AdGroupService.GetAdGroup]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdGroupsRequest(proto.Message): - r"""Request message for - [AdGroupService.MutateAdGroups][google.ads.googleads.v6.services.AdGroupService.MutateAdGroups]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose ad - groups are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdGroupOperation]): - Required. The list of operations to perform - on individual ad groups. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdGroupOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdGroupOperation(proto.Message): - r"""A single operation (create, update, remove) on an ad group. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.AdGroup): - Create operation: No resource name is - expected for the new ad group. - update (google.ads.googleads.v6.resources.types.AdGroup): - Update operation: The ad group is expected to - have a valid resource name. - remove (str): - Remove operation: A resource name for the removed ad group - is expected, in this format: - - ``customers/{customer_id}/adGroups/{ad_group_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_group.AdGroup, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_group.AdGroup, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdGroupsResponse(proto.Message): - r"""Response message for an ad group mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdGroupResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdGroupResult", - ) - - -class MutateAdGroupResult(proto.Message): - r"""The result for the ad group mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - ad_group (google.ads.googleads.v6.resources.types.AdGroup): - The mutated ad group with only mutable fields after mutate. - The field will only be returned when response_content_type - is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_group = proto.Field( - proto.MESSAGE, number=2, message=gagr_ad_group.AdGroup, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_group_simulation_service.py b/google/ads/googleads/v6/services/types/ad_group_simulation_service.py deleted file mode 100644 index 9bd239263..000000000 --- a/google/ads/googleads/v6/services/types/ad_group_simulation_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAdGroupSimulationRequest",}, -) - - -class GetAdGroupSimulationRequest(proto.Message): - r"""Request message for - [AdGroupSimulationService.GetAdGroupSimulation][google.ads.googleads.v6.services.AdGroupSimulationService.GetAdGroupSimulation]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - simulation to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_parameter_service.py b/google/ads/googleads/v6/services/types/ad_parameter_service.py deleted file mode 100644 index ff588f87a..000000000 --- a/google/ads/googleads/v6/services/types/ad_parameter_service.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - ad_parameter as gagr_ad_parameter, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdParameterRequest", - "MutateAdParametersRequest", - "AdParameterOperation", - "MutateAdParametersResponse", - "MutateAdParameterResult", - }, -) - - -class GetAdParameterRequest(proto.Message): - r"""Request message for - [AdParameterService.GetAdParameter][google.ads.googleads.v6.services.AdParameterService.GetAdParameter] - - Attributes: - resource_name (str): - Required. The resource name of the ad - parameter to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdParametersRequest(proto.Message): - r"""Request message for - [AdParameterService.MutateAdParameters][google.ads.googleads.v6.services.AdParameterService.MutateAdParameters] - - Attributes: - customer_id (str): - Required. The ID of the customer whose ad - parameters are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdParameterOperation]): - Required. The list of operations to perform - on individual ad parameters. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdParameterOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdParameterOperation(proto.Message): - r"""A single operation (create, update, remove) on ad parameter. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.AdParameter): - Create operation: No resource name is - expected for the new ad parameter. - update (google.ads.googleads.v6.resources.types.AdParameter): - Update operation: The ad parameter is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the ad parameter to - remove is expected in this format: - - ``customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_ad_parameter.AdParameter, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_ad_parameter.AdParameter, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateAdParametersResponse(proto.Message): - r"""Response message for an ad parameter mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateAdParameterResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdParameterResult", - ) - - -class MutateAdParameterResult(proto.Message): - r"""The result for the ad parameter mutate. - - Attributes: - resource_name (str): - The resource name returned for successful - operations. - ad_parameter (google.ads.googleads.v6.resources.types.AdParameter): - The mutated AdParameter with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad_parameter = proto.Field( - proto.MESSAGE, number=2, message=gagr_ad_parameter.AdParameter, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_schedule_view_service.py b/google/ads/googleads/v6/services/types/ad_schedule_view_service.py deleted file mode 100644 index 1700591bb..000000000 --- a/google/ads/googleads/v6/services/types/ad_schedule_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAdScheduleViewRequest",}, -) - - -class GetAdScheduleViewRequest(proto.Message): - r"""Request message for - [AdScheduleViewService.GetAdScheduleView][google.ads.googleads.v6.services.AdScheduleViewService.GetAdScheduleView]. - - Attributes: - resource_name (str): - Required. The resource name of the ad - schedule view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/ad_service.py b/google/ads/googleads/v6/services/types/ad_service.py deleted file mode 100644 index 766afb11c..000000000 --- a/google/ads/googleads/v6/services/types/ad_service.py +++ /dev/null @@ -1,140 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import policy -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ad as gagr_ad -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAdRequest", - "MutateAdsRequest", - "AdOperation", - "MutateAdsResponse", - "MutateAdResult", - }, -) - - -class GetAdRequest(proto.Message): - r"""Request message for - [AdService.GetAd][google.ads.googleads.v6.services.AdService.GetAd]. - - Attributes: - resource_name (str): - Required. The resource name of the ad to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAdsRequest(proto.Message): - r"""Request message for - [AdService.MutateAds][google.ads.googleads.v6.services.AdService.MutateAds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose ads - are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AdOperation]): - Required. The list of operations to perform - on individual ads. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AdOperation", - ) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AdOperation(proto.Message): - r"""A single update operation on an ad. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - policy_validation_parameter (google.ads.googleads.v6.common.types.PolicyValidationParameter): - Configuration for how policies are validated. - update (google.ads.googleads.v6.resources.types.Ad): - Update operation: The ad is expected to have a valid - resource name in this format: - - ``customers/{customer_id}/ads/{ad_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask.FieldMask, - ) - policy_validation_parameter = proto.Field( - proto.MESSAGE, number=3, message=policy.PolicyValidationParameter, - ) - update = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=gagr_ad.Ad, - ) - - -class MutateAdsResponse(proto.Message): - r"""Response message for an ad mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateAdResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAdResult", - ) - - -class MutateAdResult(proto.Message): - r"""The result for the ad mutate. - - Attributes: - resource_name (str): - The resource name returned for successful - operations. - ad (google.ads.googleads.v6.resources.types.Ad): - The mutated ad with only mutable fields after mutate. The - field will only be returned when response_content_type is - set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - ad = proto.Field(proto.MESSAGE, number=2, message=gagr_ad.Ad,) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/age_range_view_service.py b/google/ads/googleads/v6/services/types/age_range_view_service.py deleted file mode 100644 index 9b092e114..000000000 --- a/google/ads/googleads/v6/services/types/age_range_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetAgeRangeViewRequest",}, -) - - -class GetAgeRangeViewRequest(proto.Message): - r"""Request message for - [AgeRangeViewService.GetAgeRangeView][google.ads.googleads.v6.services.AgeRangeViewService.GetAgeRangeView]. - - Attributes: - resource_name (str): - Required. The resource name of the age range - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/asset_service.py b/google/ads/googleads/v6/services/types/asset_service.py deleted file mode 100644 index a47e02451..000000000 --- a/google/ads/googleads/v6/services/types/asset_service.py +++ /dev/null @@ -1,142 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import asset as gagr_asset -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetAssetRequest", - "MutateAssetsRequest", - "AssetOperation", - "MutateAssetsResponse", - "MutateAssetResult", - }, -) - - -class GetAssetRequest(proto.Message): - r"""Request message for - [AssetService.GetAsset][google.ads.googleads.v6.services.AssetService.GetAsset] - - Attributes: - resource_name (str): - Required. The resource name of the asset to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateAssetsRequest(proto.Message): - r"""Request message for - [AssetService.MutateAssets][google.ads.googleads.v6.services.AssetService.MutateAssets] - - Attributes: - customer_id (str): - Required. The ID of the customer whose assets - are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.AssetOperation]): - Required. The list of operations to perform - on individual assets. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AssetOperation", - ) - response_content_type = proto.Field( - proto.ENUM, - number=3, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class AssetOperation(proto.Message): - r"""A single operation to create an asset. Supported asset types - are YoutubeVideoAsset, MediaBundleAsset, ImageAsset, and - LeadFormAsset. TextAsset should be created with Ad inline. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.Asset): - Create operation: No resource name is - expected for the new asset. - update (google.ads.googleads.v6.resources.types.Asset): - Update operation: The asset is expected to have a valid - resource name in this format: - - ``customers/{customer_id}/assets/{asset_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=gagr_asset.Asset, - ) - update = proto.Field( - proto.MESSAGE, number=2, oneof="operation", message=gagr_asset.Asset, - ) - - -class MutateAssetsResponse(proto.Message): - r"""Response message for an asset mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateAssetResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateAssetResult", - ) - - -class MutateAssetResult(proto.Message): - r"""The result for the asset mutate. - - Attributes: - resource_name (str): - The resource name returned for successful - operations. - asset (google.ads.googleads.v6.resources.types.Asset): - The mutated asset with only mutable fields after mutate. The - field will only be returned when response_content_type is - set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - asset = proto.Field(proto.MESSAGE, number=2, message=gagr_asset.Asset,) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/batch_job_service.py b/google/ads/googleads/v6/services/types/batch_job_service.py deleted file mode 100644 index fcd6a60be..000000000 --- a/google/ads/googleads/v6/services/types/batch_job_service.py +++ /dev/null @@ -1,255 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import batch_job -from google.ads.googleads.v6.services.types import google_ads_service -from google.rpc import status_pb2 as gr_status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "MutateBatchJobRequest", - "BatchJobOperation", - "MutateBatchJobResponse", - "MutateBatchJobResult", - "GetBatchJobRequest", - "RunBatchJobRequest", - "AddBatchJobOperationsRequest", - "AddBatchJobOperationsResponse", - "ListBatchJobResultsRequest", - "ListBatchJobResultsResponse", - "BatchJobResult", - }, -) - - -class MutateBatchJobRequest(proto.Message): - r"""Request message for - [BatchJobService.MutateBatchJob][google.ads.googleads.v6.services.BatchJobService.MutateBatchJob]. - - Attributes: - customer_id (str): - Required. The ID of the customer for which to - create a batch job. - operation (google.ads.googleads.v6.services.types.BatchJobOperation): - Required. The operation to perform on an - individual batch job. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="BatchJobOperation", - ) - - -class BatchJobOperation(proto.Message): - r"""A single operation on a batch job. - - Attributes: - create (google.ads.googleads.v6.resources.types.BatchJob): - Create operation: No resource name is - expected for the new batch job. - """ - - create = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=batch_job.BatchJob, - ) - - -class MutateBatchJobResponse(proto.Message): - r"""Response message for - [BatchJobService.MutateBatchJob][google.ads.googleads.v6.services.BatchJobService.MutateBatchJob]. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateBatchJobResult): - The result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=1, message="MutateBatchJobResult", - ) - - -class MutateBatchJobResult(proto.Message): - r"""The result for the batch job mutate. - - Attributes: - resource_name (str): - The resource name of the batch job. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class GetBatchJobRequest(proto.Message): - r"""Request message for - [BatchJobService.GetBatchJob][google.ads.googleads.v6.services.BatchJobService.GetBatchJob]. - - Attributes: - resource_name (str): - Required. The resource name of the batch job - to get. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class RunBatchJobRequest(proto.Message): - r"""Request message for - [BatchJobService.RunBatchJob][google.ads.googleads.v6.services.BatchJobService.RunBatchJob]. - - Attributes: - resource_name (str): - Required. The resource name of the BatchJob - to run. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class AddBatchJobOperationsRequest(proto.Message): - r"""Request message for - [BatchJobService.AddBatchJobOperations][google.ads.googleads.v6.services.BatchJobService.AddBatchJobOperations]. - - Attributes: - resource_name (str): - Required. The resource name of the batch job. - sequence_token (str): - A token used to enforce sequencing. - - The first AddBatchJobOperations request for a batch job - should not set sequence_token. Subsequent requests must set - sequence_token to the value of next_sequence_token received - in the previous AddBatchJobOperations response. - mutate_operations (Sequence[google.ads.googleads.v6.services.types.MutateOperation]): - Required. The list of mutates being added. - Operations can use negative integers as temp ids - to signify dependencies between entities created - in this batch job. For example, a customer with - id = 1234 can create a campaign and an ad group - in that same campaign by creating a campaign in - the first operation with the resource name - explicitly set to "customers/1234/campaigns/-1", - and creating an ad group in the second operation - with the campaign field also set to - "customers/1234/campaigns/-1". - """ - - resource_name = proto.Field(proto.STRING, number=1) - sequence_token = proto.Field(proto.STRING, number=2) - mutate_operations = proto.RepeatedField( - proto.MESSAGE, number=3, message=google_ads_service.MutateOperation, - ) - - -class AddBatchJobOperationsResponse(proto.Message): - r"""Response message for - [BatchJobService.AddBatchJobOperations][google.ads.googleads.v6.services.BatchJobService.AddBatchJobOperations]. - - Attributes: - total_operations (int): - The total number of operations added so far - for this batch job. - next_sequence_token (str): - The sequence token to be used when calling - AddBatchJobOperations again if more operations need to be - added. The next AddBatchJobOperations request must set the - sequence_token field to the value of this field. - """ - - total_operations = proto.Field(proto.INT64, number=1) - next_sequence_token = proto.Field(proto.STRING, number=2) - - -class ListBatchJobResultsRequest(proto.Message): - r"""Request message for - [BatchJobService.ListBatchJobResults][google.ads.googleads.v6.services.BatchJobService.ListBatchJobResults]. - - Attributes: - resource_name (str): - Required. The resource name of the batch job - whose results are being listed. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. Use the value obtained - from ``next_page_token`` in the previous response in order - to request the next page of results. - page_size (int): - Number of elements to retrieve in a single - page. When a page request is too large, the - server may decide to further limit the number of - returned resources. - """ - - resource_name = proto.Field(proto.STRING, number=1) - page_token = proto.Field(proto.STRING, number=2) - page_size = proto.Field(proto.INT32, number=3) - - -class ListBatchJobResultsResponse(proto.Message): - r"""Response message for - [BatchJobService.ListBatchJobResults][google.ads.googleads.v6.services.BatchJobService.ListBatchJobResults]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.BatchJobResult]): - The list of rows that matched the query. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - """ - - @property - def raw_page(self): - return self - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="BatchJobResult", - ) - next_page_token = proto.Field(proto.STRING, number=2) - - -class BatchJobResult(proto.Message): - r"""An individual batch job result. - - Attributes: - operation_index (int): - Index of the mutate operation. - mutate_operation_response (google.ads.googleads.v6.services.types.MutateOperationResponse): - Response for the mutate. - May be empty if errors occurred. - status (google.rpc.status_pb2.Status): - Details of the errors when processing the - operation. - """ - - operation_index = proto.Field(proto.INT64, number=1) - mutate_operation_response = proto.Field( - proto.MESSAGE, - number=2, - message=google_ads_service.MutateOperationResponse, - ) - status = proto.Field(proto.MESSAGE, number=3, message=gr_status.Status,) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/bidding_strategy_service.py b/google/ads/googleads/v6/services/types/bidding_strategy_service.py deleted file mode 100644 index 3d0dcda79..000000000 --- a/google/ads/googleads/v6/services/types/bidding_strategy_service.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import bidding_strategy -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetBiddingStrategyRequest", - "MutateBiddingStrategiesRequest", - "BiddingStrategyOperation", - "MutateBiddingStrategiesResponse", - "MutateBiddingStrategyResult", - }, -) - - -class GetBiddingStrategyRequest(proto.Message): - r"""Request message for - [BiddingStrategyService.GetBiddingStrategy][google.ads.googleads.v6.services.BiddingStrategyService.GetBiddingStrategy]. - - Attributes: - resource_name (str): - Required. The resource name of the bidding - strategy to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateBiddingStrategiesRequest(proto.Message): - r"""Request message for - [BiddingStrategyService.MutateBiddingStrategies][google.ads.googleads.v6.services.BiddingStrategyService.MutateBiddingStrategies]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - bidding strategies are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.BiddingStrategyOperation]): - Required. The list of operations to perform - on individual bidding strategies. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="BiddingStrategyOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class BiddingStrategyOperation(proto.Message): - r"""A single operation (create, update, remove) on a bidding - strategy. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.BiddingStrategy): - Create operation: No resource name is - expected for the new bidding strategy. - update (google.ads.googleads.v6.resources.types.BiddingStrategy): - Update operation: The bidding strategy is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed bidding - strategy is expected, in this format: - - ``customers/{customer_id}/biddingStrategies/{bidding_strategy_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=bidding_strategy.BiddingStrategy, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=bidding_strategy.BiddingStrategy, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateBiddingStrategiesResponse(proto.Message): - r"""Response message for bidding strategy mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateBiddingStrategyResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateBiddingStrategyResult", - ) - - -class MutateBiddingStrategyResult(proto.Message): - r"""The result for the bidding strategy mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/billing_setup_service.py b/google/ads/googleads/v6/services/types/billing_setup_service.py deleted file mode 100644 index 85b82ab4d..000000000 --- a/google/ads/googleads/v6/services/types/billing_setup_service.py +++ /dev/null @@ -1,116 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import billing_setup - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetBillingSetupRequest", - "MutateBillingSetupRequest", - "BillingSetupOperation", - "MutateBillingSetupResponse", - "MutateBillingSetupResult", - }, -) - - -class GetBillingSetupRequest(proto.Message): - r"""Request message for - [BillingSetupService.GetBillingSetup][google.ads.googleads.v6.services.BillingSetupService.GetBillingSetup]. - - Attributes: - resource_name (str): - Required. The resource name of the billing - setup to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateBillingSetupRequest(proto.Message): - r"""Request message for billing setup mutate operations. - - Attributes: - customer_id (str): - Required. Id of the customer to apply the - billing setup mutate operation to. - operation (google.ads.googleads.v6.services.types.BillingSetupOperation): - Required. The operation to perform. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="BillingSetupOperation", - ) - - -class BillingSetupOperation(proto.Message): - r"""A single operation on a billing setup, which describes the - cancellation of an existing billing setup. - - Attributes: - create (google.ads.googleads.v6.resources.types.BillingSetup): - Creates a billing setup. No resource name is - expected for the new billing setup. - remove (str): - Resource name of the billing setup to remove. A setup cannot - be removed unless it is in a pending state or its scheduled - start time is in the future. The resource name looks like - ``customers/{customer_id}/billingSetups/{billing_id}``. - """ - - create = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=billing_setup.BillingSetup, - ) - remove = proto.Field(proto.STRING, number=1, oneof="operation") - - -class MutateBillingSetupResponse(proto.Message): - r"""Response message for a billing setup operation. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateBillingSetupResult): - A result that identifies the resource - affected by the mutate request. - """ - - result = proto.Field( - proto.MESSAGE, number=1, message="MutateBillingSetupResult", - ) - - -class MutateBillingSetupResult(proto.Message): - r"""Result for a single billing setup mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_asset_service.py b/google/ads/googleads/v6/services/types/campaign_asset_service.py deleted file mode 100644 index bb6fdce20..000000000 --- a/google/ads/googleads/v6/services/types/campaign_asset_service.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import campaign_asset -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignAssetRequest", - "MutateCampaignAssetsRequest", - "CampaignAssetOperation", - "MutateCampaignAssetsResponse", - "MutateCampaignAssetResult", - }, -) - - -class GetCampaignAssetRequest(proto.Message): - r"""Request message for - [CampaignAssetService.GetCampaignAsset][google.ads.googleads.v6.services.CampaignAssetService.GetCampaignAsset]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - asset to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignAssetsRequest(proto.Message): - r"""Request message for - [CampaignAssetService.MutateCampaignAssets][google.ads.googleads.v6.services.CampaignAssetService.MutateCampaignAssets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign assets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignAssetOperation]): - Required. The list of operations to perform - on individual campaign assets. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignAssetOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CampaignAssetOperation(proto.Message): - r"""A single operation (create, remove) on a campaign asset. - - Attributes: - create (google.ads.googleads.v6.resources.types.CampaignAsset): - Create operation: No resource name is - expected for the new campaign asset. - remove (str): - Remove operation: A resource name for the removed campaign - asset is expected, in this format: - - ``customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=campaign_asset.CampaignAsset, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCampaignAssetsResponse(proto.Message): - r"""Response message for a campaign asset mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignAssetResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=1, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignAssetResult", - ) - - -class MutateCampaignAssetResult(proto.Message): - r"""The result for the campaign asset mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_audience_view_service.py b/google/ads/googleads/v6/services/types/campaign_audience_view_service.py deleted file mode 100644 index b74f34596..000000000 --- a/google/ads/googleads/v6/services/types/campaign_audience_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCampaignAudienceViewRequest",}, -) - - -class GetCampaignAudienceViewRequest(proto.Message): - r"""Request message for - [CampaignAudienceViewService.GetCampaignAudienceView][google.ads.googleads.v6.services.CampaignAudienceViewService.GetCampaignAudienceView]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - audience view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_bid_modifier_service.py b/google/ads/googleads/v6/services/types/campaign_bid_modifier_service.py deleted file mode 100644 index 0d4b86c5e..000000000 --- a/google/ads/googleads/v6/services/types/campaign_bid_modifier_service.py +++ /dev/null @@ -1,177 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_bid_modifier as gagr_campaign_bid_modifier, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignBidModifierRequest", - "MutateCampaignBidModifiersRequest", - "CampaignBidModifierOperation", - "MutateCampaignBidModifiersResponse", - "MutateCampaignBidModifierResult", - }, -) - - -class GetCampaignBidModifierRequest(proto.Message): - r"""Request message for - [CampaignBidModifierService.GetCampaignBidModifier][google.ads.googleads.v6.services.CampaignBidModifierService.GetCampaignBidModifier]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - bid modifier to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignBidModifiersRequest(proto.Message): - r"""Request message for - [CampaignBidModifierService.MutateCampaignBidModifiers][google.ads.googleads.v6.services.CampaignBidModifierService.MutateCampaignBidModifiers]. - - Attributes: - customer_id (str): - Required. ID of the customer whose campaign - bid modifiers are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignBidModifierOperation]): - Required. The list of operations to perform - on individual campaign bid modifiers. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignBidModifierOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignBidModifierOperation(proto.Message): - r"""A single operation (create, remove, update) on a campaign bid - modifier. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignBidModifier): - Create operation: No resource name is - expected for the new campaign bid modifier. - update (google.ads.googleads.v6.resources.types.CampaignBidModifier): - Update operation: The campaign bid modifier - is expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed campaign - bid modifier is expected, in this format: - - ``customers/{customer_id}/CampaignBidModifiers/{campaign_id}~{criterion_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_bid_modifier.CampaignBidModifier, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign_bid_modifier.CampaignBidModifier, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignBidModifiersResponse(proto.Message): - r"""Response message for campaign bid modifiers mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignBidModifierResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignBidModifierResult", - ) - - -class MutateCampaignBidModifierResult(proto.Message): - r"""The result for the criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_bid_modifier (google.ads.googleads.v6.resources.types.CampaignBidModifier): - The mutated campaign bid modifier with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_bid_modifier = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_campaign_bid_modifier.CampaignBidModifier, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_budget_service.py b/google/ads/googleads/v6/services/types/campaign_budget_service.py deleted file mode 100644 index 2f1c277e8..000000000 --- a/google/ads/googleads/v6/services/types/campaign_budget_service.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_budget as gagr_campaign_budget, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignBudgetRequest", - "MutateCampaignBudgetsRequest", - "CampaignBudgetOperation", - "MutateCampaignBudgetsResponse", - "MutateCampaignBudgetResult", - }, -) - - -class GetCampaignBudgetRequest(proto.Message): - r"""Request message for - [CampaignBudgetService.GetCampaignBudget][google.ads.googleads.v6.services.CampaignBudgetService.GetCampaignBudget]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - budget to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignBudgetsRequest(proto.Message): - r"""Request message for - [CampaignBudgetService.MutateCampaignBudgets][google.ads.googleads.v6.services.CampaignBudgetService.MutateCampaignBudgets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign budgets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignBudgetOperation]): - Required. The list of operations to perform - on individual campaign budgets. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignBudgetOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignBudgetOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign - budget. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignBudget): - Create operation: No resource name is - expected for the new budget. - update (google.ads.googleads.v6.resources.types.CampaignBudget): - Update operation: The campaign budget is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed budget is - expected, in this format: - - ``customers/{customer_id}/campaignBudgets/{budget_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_budget.CampaignBudget, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign_budget.CampaignBudget, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignBudgetsResponse(proto.Message): - r"""Response message for campaign budget mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignBudgetResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignBudgetResult", - ) - - -class MutateCampaignBudgetResult(proto.Message): - r"""The result for the campaign budget mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_budget (google.ads.googleads.v6.resources.types.CampaignBudget): - The mutated campaign budget with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_budget = proto.Field( - proto.MESSAGE, number=2, message=gagr_campaign_budget.CampaignBudget, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_criterion_service.py b/google/ads/googleads/v6/services/types/campaign_criterion_service.py deleted file mode 100644 index 41ff74197..000000000 --- a/google/ads/googleads/v6/services/types/campaign_criterion_service.py +++ /dev/null @@ -1,177 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_criterion as gagr_campaign_criterion, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignCriterionRequest", - "MutateCampaignCriteriaRequest", - "CampaignCriterionOperation", - "MutateCampaignCriteriaResponse", - "MutateCampaignCriterionResult", - }, -) - - -class GetCampaignCriterionRequest(proto.Message): - r"""Request message for - [CampaignCriterionService.GetCampaignCriterion][google.ads.googleads.v6.services.CampaignCriterionService.GetCampaignCriterion]. - - Attributes: - resource_name (str): - Required. The resource name of the criterion - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignCriteriaRequest(proto.Message): - r"""Request message for - [CampaignCriterionService.MutateCampaignCriteria][google.ads.googleads.v6.services.CampaignCriterionService.MutateCampaignCriteria]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - criteria are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignCriterionOperation]): - Required. The list of operations to perform - on individual criteria. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignCriterionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignCriterionOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign - criterion. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignCriterion): - Create operation: No resource name is - expected for the new criterion. - update (google.ads.googleads.v6.resources.types.CampaignCriterion): - Update operation: The criterion is expected - to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed criterion - is expected, in this format: - - ``customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_criterion.CampaignCriterion, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign_criterion.CampaignCriterion, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignCriteriaResponse(proto.Message): - r"""Response message for campaign criterion mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignCriterionResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignCriterionResult", - ) - - -class MutateCampaignCriterionResult(proto.Message): - r"""The result for the criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_criterion (google.ads.googleads.v6.resources.types.CampaignCriterion): - The mutated campaign criterion with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_criterion = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_campaign_criterion.CampaignCriterion, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_criterion_simulation_service.py b/google/ads/googleads/v6/services/types/campaign_criterion_simulation_service.py deleted file mode 100644 index 1bb7e8029..000000000 --- a/google/ads/googleads/v6/services/types/campaign_criterion_simulation_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCampaignCriterionSimulationRequest",}, -) - - -class GetCampaignCriterionSimulationRequest(proto.Message): - r"""Request message for - [CampaignCriterionSimulationService.GetCampaignCriterionSimulation][google.ads.googleads.v6.services.CampaignCriterionSimulationService.GetCampaignCriterionSimulation]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - criterion simulation to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_draft_service.py b/google/ads/googleads/v6/services/types/campaign_draft_service.py deleted file mode 100644 index 9b36a8cb0..000000000 --- a/google/ads/googleads/v6/services/types/campaign_draft_service.py +++ /dev/null @@ -1,241 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_draft as gagr_campaign_draft, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignDraftRequest", - "MutateCampaignDraftsRequest", - "PromoteCampaignDraftRequest", - "CampaignDraftOperation", - "MutateCampaignDraftsResponse", - "MutateCampaignDraftResult", - "ListCampaignDraftAsyncErrorsRequest", - "ListCampaignDraftAsyncErrorsResponse", - }, -) - - -class GetCampaignDraftRequest(proto.Message): - r"""Request message for - [CampaignDraftService.GetCampaignDraft][google.ads.googleads.v6.services.CampaignDraftService.GetCampaignDraft]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - draft to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignDraftsRequest(proto.Message): - r"""Request message for - [CampaignDraftService.MutateCampaignDrafts][google.ads.googleads.v6.services.CampaignDraftService.MutateCampaignDrafts]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign drafts are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignDraftOperation]): - Required. The list of operations to perform - on individual campaign drafts. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignDraftOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class PromoteCampaignDraftRequest(proto.Message): - r"""Request message for - [CampaignDraftService.PromoteCampaignDraft][google.ads.googleads.v6.services.CampaignDraftService.PromoteCampaignDraft]. - - Attributes: - campaign_draft (str): - Required. The resource name of the campaign - draft to promote. - """ - - campaign_draft = proto.Field(proto.STRING, number=1) - - -class CampaignDraftOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign - draft. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignDraft): - Create operation: No resource name is - expected for the new campaign draft. - update (google.ads.googleads.v6.resources.types.CampaignDraft): - Update operation: The campaign draft is - expected to have a valid resource name. - remove (str): - Remove operation: The campaign draft is expected to have a - valid resource name, in this format: - - ``customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_draft.CampaignDraft, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign_draft.CampaignDraft, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignDraftsResponse(proto.Message): - r"""Response message for campaign draft mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignDraftResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignDraftResult", - ) - - -class MutateCampaignDraftResult(proto.Message): - r"""The result for the campaign draft mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_draft (google.ads.googleads.v6.resources.types.CampaignDraft): - The mutated campaign draft with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_draft = proto.Field( - proto.MESSAGE, number=2, message=gagr_campaign_draft.CampaignDraft, - ) - - -class ListCampaignDraftAsyncErrorsRequest(proto.Message): - r"""Request message for - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors]. - - Attributes: - resource_name (str): - Required. The name of the campaign draft from - which to retrieve the async errors. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. Use the value obtained - from ``next_page_token`` in the previous response in order - to request the next page of results. - page_size (int): - Number of elements to retrieve in a single - page. When a page request is too large, the - server may decide to further limit the number of - returned resources. - """ - - resource_name = proto.Field(proto.STRING, number=1) - page_token = proto.Field(proto.STRING, number=2) - page_size = proto.Field(proto.INT32, number=3) - - -class ListCampaignDraftAsyncErrorsResponse(proto.Message): - r"""Response message for - [CampaignDraftService.ListCampaignDraftAsyncErrors][google.ads.googleads.v6.services.CampaignDraftService.ListCampaignDraftAsyncErrors]. - - Attributes: - errors (Sequence[google.rpc.status_pb2.Status]): - Details of the errors when performing the - asynchronous operation. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - """ - - @property - def raw_page(self): - return self - - errors = proto.RepeatedField( - proto.MESSAGE, number=1, message=status.Status, - ) - next_page_token = proto.Field(proto.STRING, number=2) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_experiment_service.py b/google/ads/googleads/v6/services/types/campaign_experiment_service.py deleted file mode 100644 index a330ded7b..000000000 --- a/google/ads/googleads/v6/services/types/campaign_experiment_service.py +++ /dev/null @@ -1,319 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_experiment as gagr_campaign_experiment, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignExperimentRequest", - "MutateCampaignExperimentsRequest", - "CampaignExperimentOperation", - "MutateCampaignExperimentsResponse", - "MutateCampaignExperimentResult", - "CreateCampaignExperimentRequest", - "CreateCampaignExperimentMetadata", - "GraduateCampaignExperimentRequest", - "GraduateCampaignExperimentResponse", - "PromoteCampaignExperimentRequest", - "EndCampaignExperimentRequest", - "ListCampaignExperimentAsyncErrorsRequest", - "ListCampaignExperimentAsyncErrorsResponse", - }, -) - - -class GetCampaignExperimentRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.GetCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.GetCampaignExperiment]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - experiment to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignExperimentsRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.MutateCampaignExperiments][google.ads.googleads.v6.services.CampaignExperimentService.MutateCampaignExperiments]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign experiments are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignExperimentOperation]): - Required. The list of operations to perform - on individual campaign experiments. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignExperimentOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignExperimentOperation(proto.Message): - r"""A single update operation on a campaign experiment. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - update (google.ads.googleads.v6.resources.types.CampaignExperiment): - Update operation: The campaign experiment is - expected to have a valid resource name. - remove (str): - Remove operation: The campaign experiment is expected to - have a valid resource name, in this format: - - ``customers/{customer_id}/campaignExperiments/{campaign_experiment_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask.FieldMask, - ) - update = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_experiment.CampaignExperiment, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCampaignExperimentsResponse(proto.Message): - r"""Response message for campaign experiment mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignExperimentResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignExperimentResult", - ) - - -class MutateCampaignExperimentResult(proto.Message): - r"""The result for the campaign experiment mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_experiment (google.ads.googleads.v6.resources.types.CampaignExperiment): - The mutated campaign experiment with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_experiment = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_campaign_experiment.CampaignExperiment, - ) - - -class CreateCampaignExperimentRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.CreateCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.CreateCampaignExperiment]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign experiment is being created. - campaign_experiment (google.ads.googleads.v6.resources.types.CampaignExperiment): - Required. The campaign experiment to be - created. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - campaign_experiment = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_campaign_experiment.CampaignExperiment, - ) - validate_only = proto.Field(proto.BOOL, number=3) - - -class CreateCampaignExperimentMetadata(proto.Message): - r"""Message used as metadata returned in Long Running Operations - for CreateCampaignExperimentRequest - - Attributes: - campaign_experiment (str): - Resource name of campaign experiment created. - """ - - campaign_experiment = proto.Field(proto.STRING, number=1) - - -class GraduateCampaignExperimentRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.GraduateCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.GraduateCampaignExperiment]. - - Attributes: - campaign_experiment (str): - Required. The resource name of the campaign - experiment to graduate. - campaign_budget (str): - Required. Resource name of the budget to - attach to the campaign graduated from the - experiment. - """ - - campaign_experiment = proto.Field(proto.STRING, number=1) - campaign_budget = proto.Field(proto.STRING, number=2) - - -class GraduateCampaignExperimentResponse(proto.Message): - r"""Response message for campaign experiment graduate. - - Attributes: - graduated_campaign (str): - The resource name of the campaign from the graduated - experiment. This campaign is the same one as - CampaignExperiment.experiment_campaign. - """ - - graduated_campaign = proto.Field(proto.STRING, number=1) - - -class PromoteCampaignExperimentRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.PromoteCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.PromoteCampaignExperiment]. - - Attributes: - campaign_experiment (str): - Required. The resource name of the campaign - experiment to promote. - """ - - campaign_experiment = proto.Field(proto.STRING, number=1) - - -class EndCampaignExperimentRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.EndCampaignExperiment][google.ads.googleads.v6.services.CampaignExperimentService.EndCampaignExperiment]. - - Attributes: - campaign_experiment (str): - Required. The resource name of the campaign - experiment to end. - """ - - campaign_experiment = proto.Field(proto.STRING, number=1) - - -class ListCampaignExperimentAsyncErrorsRequest(proto.Message): - r"""Request message for - [CampaignExperimentService.ListCampaignExperimentAsyncErrors][google.ads.googleads.v6.services.CampaignExperimentService.ListCampaignExperimentAsyncErrors]. - - Attributes: - resource_name (str): - Required. The name of the campaign experiment - from which to retrieve the async errors. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. Use the value obtained - from ``next_page_token`` in the previous response in order - to request the next page of results. - page_size (int): - Number of elements to retrieve in a single - page. When a page request is too large, the - server may decide to further limit the number of - returned resources. - """ - - resource_name = proto.Field(proto.STRING, number=1) - page_token = proto.Field(proto.STRING, number=2) - page_size = proto.Field(proto.INT32, number=3) - - -class ListCampaignExperimentAsyncErrorsResponse(proto.Message): - r"""Response message for - [CampaignExperimentService.ListCampaignExperimentAsyncErrors][google.ads.googleads.v6.services.CampaignExperimentService.ListCampaignExperimentAsyncErrors]. - - Attributes: - errors (Sequence[google.rpc.status_pb2.Status]): - Details of the errors when performing the - asynchronous operation. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - """ - - @property - def raw_page(self): - return self - - errors = proto.RepeatedField( - proto.MESSAGE, number=1, message=status.Status, - ) - next_page_token = proto.Field(proto.STRING, number=2) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_extension_setting_service.py b/google/ads/googleads/v6/services/types/campaign_extension_setting_service.py deleted file mode 100644 index 362047c6d..000000000 --- a/google/ads/googleads/v6/services/types/campaign_extension_setting_service.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import campaign_extension_setting -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignExtensionSettingRequest", - "MutateCampaignExtensionSettingsRequest", - "CampaignExtensionSettingOperation", - "MutateCampaignExtensionSettingsResponse", - "MutateCampaignExtensionSettingResult", - }, -) - - -class GetCampaignExtensionSettingRequest(proto.Message): - r"""Request message for - [CampaignExtensionSettingService.GetCampaignExtensionSetting][google.ads.googleads.v6.services.CampaignExtensionSettingService.GetCampaignExtensionSetting]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - extension setting to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignExtensionSettingsRequest(proto.Message): - r"""Request message for - [CampaignExtensionSettingService.MutateCampaignExtensionSettings][google.ads.googleads.v6.services.CampaignExtensionSettingService.MutateCampaignExtensionSettings]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign extension settings are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignExtensionSettingOperation]): - Required. The list of operations to perform - on individual campaign extension settings. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignExtensionSettingOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CampaignExtensionSettingOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign - extension setting. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignExtensionSetting): - Create operation: No resource name is - expected for the new campaign extension setting. - update (google.ads.googleads.v6.resources.types.CampaignExtensionSetting): - Update operation: The campaign extension - setting is expected to have a valid resource - name. - remove (str): - Remove operation: A resource name for the removed campaign - extension setting is expected, in this format: - - ``customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=campaign_extension_setting.CampaignExtensionSetting, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=campaign_extension_setting.CampaignExtensionSetting, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignExtensionSettingsResponse(proto.Message): - r"""Response message for a campaign extension setting mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignExtensionSettingResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignExtensionSettingResult", - ) - - -class MutateCampaignExtensionSettingResult(proto.Message): - r"""The result for the campaign extension setting mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_feed_service.py b/google/ads/googleads/v6/services/types/campaign_feed_service.py deleted file mode 100644 index 264b9dd40..000000000 --- a/google/ads/googleads/v6/services/types/campaign_feed_service.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_feed as gagr_campaign_feed, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignFeedRequest", - "MutateCampaignFeedsRequest", - "CampaignFeedOperation", - "MutateCampaignFeedsResponse", - "MutateCampaignFeedResult", - }, -) - - -class GetCampaignFeedRequest(proto.Message): - r"""Request message for - [CampaignFeedService.GetCampaignFeed][google.ads.googleads.v6.services.CampaignFeedService.GetCampaignFeed]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - feed to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignFeedsRequest(proto.Message): - r"""Request message for - [CampaignFeedService.MutateCampaignFeeds][google.ads.googleads.v6.services.CampaignFeedService.MutateCampaignFeeds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign feeds are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignFeedOperation]): - Required. The list of operations to perform - on individual campaign feeds. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignFeedOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignFeedOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign - feed. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CampaignFeed): - Create operation: No resource name is - expected for the new campaign feed. - update (google.ads.googleads.v6.resources.types.CampaignFeed): - Update operation: The campaign feed is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed campaign - feed is expected, in this format: - - ``customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_feed.CampaignFeed, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign_feed.CampaignFeed, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignFeedsResponse(proto.Message): - r"""Response message for a campaign feed mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignFeedResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignFeedResult", - ) - - -class MutateCampaignFeedResult(proto.Message): - r"""The result for the campaign feed mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_feed (google.ads.googleads.v6.resources.types.CampaignFeed): - The mutated campaign feed with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_feed = proto.Field( - proto.MESSAGE, number=2, message=gagr_campaign_feed.CampaignFeed, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_label_service.py b/google/ads/googleads/v6/services/types/campaign_label_service.py deleted file mode 100644 index 6bfa36d1e..000000000 --- a/google/ads/googleads/v6/services/types/campaign_label_service.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import campaign_label -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignLabelRequest", - "MutateCampaignLabelsRequest", - "CampaignLabelOperation", - "MutateCampaignLabelsResponse", - "MutateCampaignLabelResult", - }, -) - - -class GetCampaignLabelRequest(proto.Message): - r"""Request message for - [CampaignLabelService.GetCampaignLabel][google.ads.googleads.v6.services.CampaignLabelService.GetCampaignLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign- - abel relationship to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignLabelsRequest(proto.Message): - r"""Request message for - [CampaignLabelService.MutateCampaignLabels][google.ads.googleads.v6.services.CampaignLabelService.MutateCampaignLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose campaign- - abel relationships are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignLabelOperation]): - Required. The list of operations to perform - on campaign-label relationships. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignLabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CampaignLabelOperation(proto.Message): - r"""A single operation (create, remove) on a campaign-label - relationship. - - Attributes: - create (google.ads.googleads.v6.resources.types.CampaignLabel): - Create operation: No resource name is - expected for the new campaign-label - relationship. - remove (str): - Remove operation: A resource name for the campaign-label - relationship being removed, in this format: - - ``customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=campaign_label.CampaignLabel, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCampaignLabelsResponse(proto.Message): - r"""Response message for a campaign labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignLabelResult", - ) - - -class MutateCampaignLabelResult(proto.Message): - r"""The result for a campaign label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_service.py b/google/ads/googleads/v6/services/types/campaign_service.py deleted file mode 100644 index 44f674907..000000000 --- a/google/ads/googleads/v6/services/types/campaign_service.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import campaign as gagr_campaign -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignRequest", - "MutateCampaignsRequest", - "CampaignOperation", - "MutateCampaignsResponse", - "MutateCampaignResult", - }, -) - - -class GetCampaignRequest(proto.Message): - r"""Request message for - [CampaignService.GetCampaign][google.ads.googleads.v6.services.CampaignService.GetCampaign]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignsRequest(proto.Message): - r"""Request message for - [CampaignService.MutateCampaigns][google.ads.googleads.v6.services.CampaignService.MutateCampaigns]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaigns are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignOperation]): - Required. The list of operations to perform - on individual campaigns. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignOperation(proto.Message): - r"""A single operation (create, update, remove) on a campaign. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.Campaign): - Create operation: No resource name is - expected for the new campaign. - update (google.ads.googleads.v6.resources.types.Campaign): - Update operation: The campaign is expected to - have a valid resource name. - remove (str): - Remove operation: A resource name for the removed campaign - is expected, in this format: - - ``customers/{customer_id}/campaigns/{campaign_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign.Campaign, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_campaign.Campaign, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignsResponse(proto.Message): - r"""Response message for campaign mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignResult", - ) - - -class MutateCampaignResult(proto.Message): - r"""The result for the campaign mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign (google.ads.googleads.v6.resources.types.Campaign): - The mutated campaign with only mutable fields after mutate. - The field will only be returned when response_content_type - is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign = proto.Field( - proto.MESSAGE, number=2, message=gagr_campaign.Campaign, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/campaign_shared_set_service.py b/google/ads/googleads/v6/services/types/campaign_shared_set_service.py deleted file mode 100644 index 8db201100..000000000 --- a/google/ads/googleads/v6/services/types/campaign_shared_set_service.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - campaign_shared_set as gagr_campaign_shared_set, -) -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCampaignSharedSetRequest", - "MutateCampaignSharedSetsRequest", - "CampaignSharedSetOperation", - "MutateCampaignSharedSetsResponse", - "MutateCampaignSharedSetResult", - }, -) - - -class GetCampaignSharedSetRequest(proto.Message): - r"""Request message for - [CampaignSharedSetService.GetCampaignSharedSet][google.ads.googleads.v6.services.CampaignSharedSetService.GetCampaignSharedSet]. - - Attributes: - resource_name (str): - Required. The resource name of the campaign - shared set to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCampaignSharedSetsRequest(proto.Message): - r"""Request message for - [CampaignSharedSetService.MutateCampaignSharedSets][google.ads.googleads.v6.services.CampaignSharedSetService.MutateCampaignSharedSets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign shared sets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CampaignSharedSetOperation]): - Required. The list of operations to perform - on individual campaign shared sets. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CampaignSharedSetOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CampaignSharedSetOperation(proto.Message): - r"""A single operation (create, remove) on an campaign shared - set. - - Attributes: - create (google.ads.googleads.v6.resources.types.CampaignSharedSet): - Create operation: No resource name is - expected for the new campaign shared set. - remove (str): - Remove operation: A resource name for the removed campaign - shared set is expected, in this format: - - ``customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_campaign_shared_set.CampaignSharedSet, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCampaignSharedSetsResponse(proto.Message): - r"""Response message for a campaign shared set mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCampaignSharedSetResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCampaignSharedSetResult", - ) - - -class MutateCampaignSharedSetResult(proto.Message): - r"""The result for the campaign shared set mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - campaign_shared_set (google.ads.googleads.v6.resources.types.CampaignSharedSet): - The mutated campaign shared set with only mutable fields - after mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - campaign_shared_set = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_campaign_shared_set.CampaignSharedSet, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/carrier_constant_service.py b/google/ads/googleads/v6/services/types/carrier_constant_service.py deleted file mode 100644 index c400da48c..000000000 --- a/google/ads/googleads/v6/services/types/carrier_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCarrierConstantRequest",}, -) - - -class GetCarrierConstantRequest(proto.Message): - r"""Request message for - [CarrierConstantService.GetCarrierConstant][google.ads.googleads.v6.services.CarrierConstantService.GetCarrierConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the carrier - constant to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/change_status_service.py b/google/ads/googleads/v6/services/types/change_status_service.py deleted file mode 100644 index 1525b2467..000000000 --- a/google/ads/googleads/v6/services/types/change_status_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetChangeStatusRequest",}, -) - - -class GetChangeStatusRequest(proto.Message): - r"""Request message for - '[ChangeStatusService.GetChangeStatus][google.ads.googleads.v6.services.ChangeStatusService.GetChangeStatus]'. - - Attributes: - resource_name (str): - Required. The resource name of the change - status to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/click_view_service.py b/google/ads/googleads/v6/services/types/click_view_service.py deleted file mode 100644 index cd6d1ec7b..000000000 --- a/google/ads/googleads/v6/services/types/click_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetClickViewRequest",}, -) - - -class GetClickViewRequest(proto.Message): - r"""Request message for - [ClickViewService.GetClickView][google.ads.googleads.v6.services.ClickViewService.GetClickView]. - - Attributes: - resource_name (str): - Required. The resource name of the click view - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/combined_audience_service.py b/google/ads/googleads/v6/services/types/combined_audience_service.py deleted file mode 100644 index 3eb7d4a83..000000000 --- a/google/ads/googleads/v6/services/types/combined_audience_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCombinedAudienceRequest",}, -) - - -class GetCombinedAudienceRequest(proto.Message): - r"""Request message for - [CombinedAudienceService.GetCombinedAudience][google.ads.googleads.v6.services.CombinedAudienceService.GetCombinedAudience]. - - Attributes: - resource_name (str): - Required. The resource name of the combined - audience to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/conversion_action_service.py b/google/ads/googleads/v6/services/types/conversion_action_service.py deleted file mode 100644 index b438be521..000000000 --- a/google/ads/googleads/v6/services/types/conversion_action_service.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import conversion_action -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetConversionActionRequest", - "MutateConversionActionsRequest", - "ConversionActionOperation", - "MutateConversionActionsResponse", - "MutateConversionActionResult", - }, -) - - -class GetConversionActionRequest(proto.Message): - r"""Request message for - [ConversionActionService.GetConversionAction][google.ads.googleads.v6.services.ConversionActionService.GetConversionAction]. - - Attributes: - resource_name (str): - Required. The resource name of the conversion - action to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateConversionActionsRequest(proto.Message): - r"""Request message for - [ConversionActionService.MutateConversionActions][google.ads.googleads.v6.services.ConversionActionService.MutateConversionActions]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - conversion actions are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.ConversionActionOperation]): - Required. The list of operations to perform - on individual conversion actions. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="ConversionActionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class ConversionActionOperation(proto.Message): - r"""A single operation (create, update, remove) on a conversion - action. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.ConversionAction): - Create operation: No resource name is - expected for the new conversion action. - update (google.ads.googleads.v6.resources.types.ConversionAction): - Update operation: The conversion action is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed conversion - action is expected, in this format: - - ``customers/{customer_id}/conversionActions/{conversion_action_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=conversion_action.ConversionAction, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=conversion_action.ConversionAction, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateConversionActionsResponse(proto.Message): - r"""Response message for - [ConversionActionService.MutateConversionActions][google.ads.googleads.v6.services.ConversionActionService.MutateConversionActions]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateConversionActionResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateConversionActionResult", - ) - - -class MutateConversionActionResult(proto.Message): - r"""The result for the conversion action mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/conversion_adjustment_upload_service.py b/google/ads/googleads/v6/services/types/conversion_adjustment_upload_service.py deleted file mode 100644 index 041002ce4..000000000 --- a/google/ads/googleads/v6/services/types/conversion_adjustment_upload_service.py +++ /dev/null @@ -1,250 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import conversion_adjustment_type -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "UploadConversionAdjustmentsRequest", - "UploadConversionAdjustmentsResponse", - "ConversionAdjustment", - "RestatementValue", - "GclidDateTimePair", - "ConversionAdjustmentResult", - }, -) - - -class UploadConversionAdjustmentsRequest(proto.Message): - r"""Request message for - [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v6.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. - - Attributes: - customer_id (str): - Required. The ID of the customer performing - the upload. - conversion_adjustments (Sequence[google.ads.googleads.v6.services.types.ConversionAdjustment]): - Required. The conversion adjustments that are - being uploaded. - partial_failure (bool): - Required. If true, successful operations will - be carried out and invalid operations will - return errors. If false, all operations will be - carried out in one transaction if and only if - they are all valid. This should always be set to - true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - conversion_adjustments = proto.RepeatedField( - proto.MESSAGE, number=2, message="ConversionAdjustment", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class UploadConversionAdjustmentsResponse(proto.Message): - r"""Response message for - [ConversionAdjustmentUploadService.UploadConversionAdjustments][google.ads.googleads.v6.services.ConversionAdjustmentUploadService.UploadConversionAdjustments]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to conversion adjustment - failures in the partial failure mode. Returned - when all errors occur inside the adjustments. If - any errors occur outside the adjustments (e.g. - auth errors), we return an RPC level error. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - results (Sequence[google.ads.googleads.v6.services.types.ConversionAdjustmentResult]): - Returned for successfully processed conversion adjustments. - Proto will be empty for rows that received an error. Results - are not returned when validate_only is true. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=1, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="ConversionAdjustmentResult", - ) - - -class ConversionAdjustment(proto.Message): - r"""A conversion adjustment. - - Attributes: - conversion_action (str): - Resource name of the conversion action - associated with this conversion adjustment. - Note: Although this resource name consists of a - customer id and a conversion action id, - validation will ignore the customer id and use - the conversion action id as the sole identifier - of the conversion action. - adjustment_date_time (str): - The date time at which the adjustment occurred. Must be - after the conversion_date_time. The timezone must be - specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. - "2019-01-01 12:32:45-08:00". - adjustment_type (google.ads.googleads.v6.enums.types.ConversionAdjustmentTypeEnum.ConversionAdjustmentType): - The adjustment type. - restatement_value (google.ads.googleads.v6.services.types.RestatementValue): - Information needed to restate the - conversion's value. Required for restatements. - Should not be supplied for retractions. An error - will be returned if provided for a retraction. - NOTE: If you want to upload a second restatement - with a different adjusted value, it must have a - new, more recent, adjustment occurrence time. - Otherwise, it will be treated as a duplicate of - the previous restatement and ignored. - gclid_date_time_pair (google.ads.googleads.v6.services.types.GclidDateTimePair): - Uniquely identifies a conversion that was - reported without an order ID specified. - order_id (str): - The order ID of the conversion to be - adjusted. If the conversion was reported with an - order ID specified, that order ID must be used - as the identifier here. - """ - - conversion_action = proto.Field(proto.STRING, number=8, optional=True) - adjustment_date_time = proto.Field(proto.STRING, number=9, optional=True) - adjustment_type = proto.Field( - proto.ENUM, - number=5, - enum=conversion_adjustment_type.ConversionAdjustmentTypeEnum.ConversionAdjustmentType, - ) - restatement_value = proto.Field( - proto.MESSAGE, number=6, message="RestatementValue", - ) - gclid_date_time_pair = proto.Field( - proto.MESSAGE, - number=1, - oneof="conversion_identifier", - message="GclidDateTimePair", - ) - order_id = proto.Field( - proto.STRING, number=7, oneof="conversion_identifier" - ) - - -class RestatementValue(proto.Message): - r"""Contains information needed to restate a conversion's value. - - Attributes: - adjusted_value (float): - The restated conversion value. This is the - value of the conversion after restatement. For - example, to change the value of a conversion - from 100 to 70, an adjusted value of 70 should - be reported. NOTE: If you want to upload a - second restatement with a different adjusted - value, it must have a new, more recent, - adjustment occurrence time. Otherwise, it will - be treated as a duplicate of the previous - restatement and ignored. - currency_code (str): - The currency of the restated value. If not - provided, then the default currency from the - conversion action is used, and if that is not - set then the account currency is used. This is - the ISO 4217 3-character currency code e.g. USD - or EUR. - """ - - adjusted_value = proto.Field(proto.DOUBLE, number=3, optional=True) - currency_code = proto.Field(proto.STRING, number=4, optional=True) - - -class GclidDateTimePair(proto.Message): - r"""Uniquely identifies a conversion that was reported without an - order ID specified. - - Attributes: - gclid (str): - Google click ID (gclid) associated with the - original conversion for this adjustment. - conversion_date_time (str): - The date time at which the original conversion for this - adjustment occurred. The timezone must be specified. The - format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - """ - - gclid = proto.Field(proto.STRING, number=3, optional=True) - conversion_date_time = proto.Field(proto.STRING, number=4, optional=True) - - -class ConversionAdjustmentResult(proto.Message): - r"""Information identifying a successfully processed - ConversionAdjustment. - - Attributes: - conversion_action (str): - Resource name of the conversion action - associated with this conversion adjustment. - adjustment_date_time (str): - The date time at which the adjustment occurred. The format - is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - adjustment_type (google.ads.googleads.v6.enums.types.ConversionAdjustmentTypeEnum.ConversionAdjustmentType): - The adjustment type. - gclid_date_time_pair (google.ads.googleads.v6.services.types.GclidDateTimePair): - Uniquely identifies a conversion that was - reported without an order ID specified. - order_id (str): - The order ID of the conversion that was - adjusted. - """ - - conversion_action = proto.Field(proto.STRING, number=7, optional=True) - adjustment_date_time = proto.Field(proto.STRING, number=8, optional=True) - adjustment_type = proto.Field( - proto.ENUM, - number=5, - enum=conversion_adjustment_type.ConversionAdjustmentTypeEnum.ConversionAdjustmentType, - ) - gclid_date_time_pair = proto.Field( - proto.MESSAGE, - number=1, - oneof="conversion_identifier", - message="GclidDateTimePair", - ) - order_id = proto.Field( - proto.STRING, number=6, oneof="conversion_identifier" - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/conversion_upload_service.py b/google/ads/googleads/v6/services/types/conversion_upload_service.py deleted file mode 100644 index 7e6a96cef..000000000 --- a/google/ads/googleads/v6/services/types/conversion_upload_service.py +++ /dev/null @@ -1,328 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "UploadClickConversionsRequest", - "UploadClickConversionsResponse", - "UploadCallConversionsRequest", - "UploadCallConversionsResponse", - "ClickConversion", - "CallConversion", - "ExternalAttributionData", - "ClickConversionResult", - "CallConversionResult", - }, -) - - -class UploadClickConversionsRequest(proto.Message): - r"""Request message for - [ConversionUploadService.UploadClickConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadClickConversions]. - - Attributes: - customer_id (str): - Required. The ID of the customer performing - the upload. - conversions (Sequence[google.ads.googleads.v6.services.types.ClickConversion]): - Required. The conversions that are being - uploaded. - partial_failure (bool): - Required. If true, successful operations will - be carried out and invalid operations will - return errors. If false, all operations will be - carried out in one transaction if and only if - they are all valid. This should always be set to - true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - conversions = proto.RepeatedField( - proto.MESSAGE, number=2, message="ClickConversion", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class UploadClickConversionsResponse(proto.Message): - r"""Response message for - [ConversionUploadService.UploadClickConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadClickConversions]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to conversion failures in - the partial failure mode. Returned when all - errors occur inside the conversions. If any - errors occur outside the conversions (e.g. auth - errors), we return an RPC level error. See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - results (Sequence[google.ads.googleads.v6.services.types.ClickConversionResult]): - Returned for successfully processed conversions. Proto will - be empty for rows that received an error. Results are not - returned when validate_only is true. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=1, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="ClickConversionResult", - ) - - -class UploadCallConversionsRequest(proto.Message): - r"""Request message for - [ConversionUploadService.UploadCallConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadCallConversions]. - - Attributes: - customer_id (str): - Required. The ID of the customer performing - the upload. - conversions (Sequence[google.ads.googleads.v6.services.types.CallConversion]): - Required. The conversions that are being - uploaded. - partial_failure (bool): - Required. If true, successful operations will - be carried out and invalid operations will - return errors. If false, all operations will be - carried out in one transaction if and only if - they are all valid. This should always be set to - true. - See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - conversions = proto.RepeatedField( - proto.MESSAGE, number=2, message="CallConversion", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class UploadCallConversionsResponse(proto.Message): - r"""Response message for - [ConversionUploadService.UploadCallConversions][google.ads.googleads.v6.services.ConversionUploadService.UploadCallConversions]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to conversion failures in - the partial failure mode. Returned when all - errors occur inside the conversions. If any - errors occur outside the conversions (e.g. auth - errors), we return an RPC level error. See - https://developers.google.com/google- - ads/api/docs/best-practices/partial-failures for - more information about partial failure. - results (Sequence[google.ads.googleads.v6.services.types.CallConversionResult]): - Returned for successfully processed conversions. Proto will - be empty for rows that received an error. Results are not - returned when validate_only is true. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=1, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="CallConversionResult", - ) - - -class ClickConversion(proto.Message): - r"""A click conversion. - - Attributes: - gclid (str): - The Google click ID (gclid) associated with - this conversion. - conversion_action (str): - Resource name of the conversion action - associated with this conversion. Note: Although - this resource name consists of a customer id and - a conversion action id, validation will ignore - the customer id and use the conversion action id - as the sole identifier of the conversion action. - conversion_date_time (str): - The date time at which the conversion occurred. Must be - after the click time. The timezone must be specified. The - format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. “2019-01-01 - 12:32:45-08:00”. - conversion_value (float): - The value of the conversion for the - advertiser. - currency_code (str): - Currency associated with the conversion - value. This is the ISO 4217 3-character currency - code. For example: USD, EUR. - order_id (str): - The order ID associated with the conversion. - An order id can only be used for one conversion - per conversion action. - external_attribution_data (google.ads.googleads.v6.services.types.ExternalAttributionData): - Additional data about externally attributed - conversions. This field is required for - conversions with an externally attributed - conversion action, but should not be set - otherwise. - """ - - gclid = proto.Field(proto.STRING, number=9, optional=True) - conversion_action = proto.Field(proto.STRING, number=10, optional=True) - conversion_date_time = proto.Field(proto.STRING, number=11, optional=True) - conversion_value = proto.Field(proto.DOUBLE, number=12, optional=True) - currency_code = proto.Field(proto.STRING, number=13, optional=True) - order_id = proto.Field(proto.STRING, number=14, optional=True) - external_attribution_data = proto.Field( - proto.MESSAGE, number=7, message="ExternalAttributionData", - ) - - -class CallConversion(proto.Message): - r"""A call conversion. - - Attributes: - caller_id (str): - The caller id from which this call was - placed. Caller id is expected to be in E.164 - format with preceding '+' sign. e.g. - "+16502531234". - call_start_date_time (str): - The date time at which the call occurred. The timezone must - be specified. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", - e.g. "2019-01-01 12:32:45-08:00". - conversion_action (str): - Resource name of the conversion action - associated with this conversion. Note: Although - this resource name consists of a customer id and - a conversion action id, validation will ignore - the customer id and use the conversion action id - as the sole identifier of the conversion action. - conversion_date_time (str): - The date time at which the conversion occurred. Must be - after the call time. The timezone must be specified. The - format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - conversion_value (float): - The value of the conversion for the - advertiser. - currency_code (str): - Currency associated with the conversion - value. This is the ISO 4217 3-character currency - code. For example: USD, EUR. - """ - - caller_id = proto.Field(proto.STRING, number=7, optional=True) - call_start_date_time = proto.Field(proto.STRING, number=8, optional=True) - conversion_action = proto.Field(proto.STRING, number=9, optional=True) - conversion_date_time = proto.Field(proto.STRING, number=10, optional=True) - conversion_value = proto.Field(proto.DOUBLE, number=11, optional=True) - currency_code = proto.Field(proto.STRING, number=12, optional=True) - - -class ExternalAttributionData(proto.Message): - r"""Contains additional information about externally attributed - conversions. - - Attributes: - external_attribution_credit (float): - Represents the fraction of the conversion - that is attributed to the Google Ads click. - external_attribution_model (str): - Specifies the attribution model name. - """ - - external_attribution_credit = proto.Field( - proto.DOUBLE, number=3, optional=True - ) - external_attribution_model = proto.Field( - proto.STRING, number=4, optional=True - ) - - -class ClickConversionResult(proto.Message): - r"""Identifying information for a successfully processed - ClickConversion. - - Attributes: - gclid (str): - The Google Click ID (gclid) associated with - this conversion. - conversion_action (str): - Resource name of the conversion action - associated with this conversion. - conversion_date_time (str): - The date time at which the conversion occurred. The format - is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. “2019-01-01 - 12:32:45-08:00”. - """ - - gclid = proto.Field(proto.STRING, number=4, optional=True) - conversion_action = proto.Field(proto.STRING, number=5, optional=True) - conversion_date_time = proto.Field(proto.STRING, number=6, optional=True) - - -class CallConversionResult(proto.Message): - r"""Identifying information for a successfully processed - CallConversionUpload. - - Attributes: - caller_id (str): - The caller id from which this call was - placed. Caller id is expected to be in E.164 - format with preceding '+' sign. - call_start_date_time (str): - The date time at which the call occurred. The format is - "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - conversion_action (str): - Resource name of the conversion action - associated with this conversion. - conversion_date_time (str): - The date time at which the conversion occurred. The format - is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - """ - - caller_id = proto.Field(proto.STRING, number=5, optional=True) - call_start_date_time = proto.Field(proto.STRING, number=6, optional=True) - conversion_action = proto.Field(proto.STRING, number=7, optional=True) - conversion_date_time = proto.Field(proto.STRING, number=8, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/currency_constant_service.py b/google/ads/googleads/v6/services/types/currency_constant_service.py deleted file mode 100644 index 8ee93321b..000000000 --- a/google/ads/googleads/v6/services/types/currency_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCurrencyConstantRequest",}, -) - - -class GetCurrencyConstantRequest(proto.Message): - r"""Request message for - [CurrencyConstantService.GetCurrencyConstant][google.ads.googleads.v6.services.CurrencyConstantService.GetCurrencyConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the currency - constant to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/custom_audience_service.py b/google/ads/googleads/v6/services/types/custom_audience_service.py deleted file mode 100644 index 8f3fcf915..000000000 --- a/google/ads/googleads/v6/services/types/custom_audience_service.py +++ /dev/null @@ -1,136 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import custom_audience -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomAudienceRequest", - "MutateCustomAudiencesRequest", - "CustomAudienceOperation", - "MutateCustomAudiencesResponse", - "MutateCustomAudienceResult", - }, -) - - -class GetCustomAudienceRequest(proto.Message): - r"""Request message for - [CustomAudienceService.GetCustomAudience][google.ads.googleads.v6.services.CustomAudienceService.GetCustomAudience]. - - Attributes: - resource_name (str): - Required. The resource name of the custom - audience to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomAudiencesRequest(proto.Message): - r"""Request message for - [CustomAudienceService.MutateCustomAudiences][google.ads.googleads.v6.services.CustomAudienceService.MutateCustomAudiences]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose custom - audiences are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomAudienceOperation]): - Required. The list of operations to perform - on individual custom audiences. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomAudienceOperation", - ) - validate_only = proto.Field(proto.BOOL, number=3) - - -class CustomAudienceOperation(proto.Message): - r"""A single operation (create, update) on a custom audience. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CustomAudience): - Create operation: No resource name is - expected for the new custom audience. - update (google.ads.googleads.v6.resources.types.CustomAudience): - Update operation: The custom audience is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed custom - audience is expected, in this format: - - ``customers/{customer_id}/customAudiences/{custom_audience_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=custom_audience.CustomAudience, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=custom_audience.CustomAudience, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCustomAudiencesResponse(proto.Message): - r"""Response message for custom audience mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomAudienceResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="MutateCustomAudienceResult", - ) - - -class MutateCustomAudienceResult(proto.Message): - r"""The result for the custom audience mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/custom_interest_service.py b/google/ads/googleads/v6/services/types/custom_interest_service.py deleted file mode 100644 index 2ded21746..000000000 --- a/google/ads/googleads/v6/services/types/custom_interest_service.py +++ /dev/null @@ -1,130 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import custom_interest -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomInterestRequest", - "MutateCustomInterestsRequest", - "CustomInterestOperation", - "MutateCustomInterestsResponse", - "MutateCustomInterestResult", - }, -) - - -class GetCustomInterestRequest(proto.Message): - r"""Request message for - [CustomInterestService.GetCustomInterest][google.ads.googleads.v6.services.CustomInterestService.GetCustomInterest]. - - Attributes: - resource_name (str): - Required. The resource name of the custom - interest to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomInterestsRequest(proto.Message): - r"""Request message for - [CustomInterestService.MutateCustomInterests][google.ads.googleads.v6.services.CustomInterestService.MutateCustomInterests]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose custom - interests are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomInterestOperation]): - Required. The list of operations to perform - on individual custom interests. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomInterestOperation", - ) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CustomInterestOperation(proto.Message): - r"""A single operation (create, update) on a custom interest. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CustomInterest): - Create operation: No resource name is - expected for the new custom interest. - update (google.ads.googleads.v6.resources.types.CustomInterest): - Update operation: The custom interest is - expected to have a valid resource name. - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=custom_interest.CustomInterest, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=custom_interest.CustomInterest, - ) - - -class MutateCustomInterestsResponse(proto.Message): - r"""Response message for custom interest mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomInterestResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCustomInterestResult", - ) - - -class MutateCustomInterestResult(proto.Message): - r"""The result for the custom interest mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_client_link_service.py b/google/ads/googleads/v6/services/types/customer_client_link_service.py deleted file mode 100644 index 2c52101aa..000000000 --- a/google/ads/googleads/v6/services/types/customer_client_link_service.py +++ /dev/null @@ -1,127 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import customer_client_link -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerClientLinkRequest", - "MutateCustomerClientLinkRequest", - "CustomerClientLinkOperation", - "MutateCustomerClientLinkResponse", - "MutateCustomerClientLinkResult", - }, -) - - -class GetCustomerClientLinkRequest(proto.Message): - r"""Request message for - [CustomerClientLinkService.GetCustomerClientLink][google.ads.googleads.v6.services.CustomerClientLinkService.GetCustomerClientLink]. - - Attributes: - resource_name (str): - Required. The resource name of the customer - client link to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerClientLinkRequest(proto.Message): - r"""Request message for - [CustomerClientLinkService.MutateCustomerClientLink][google.ads.googleads.v6.services.CustomerClientLinkService.MutateCustomerClientLink]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - customer link are being modified. - operation (google.ads.googleads.v6.services.types.CustomerClientLinkOperation): - Required. The operation to perform on the - individual CustomerClientLink. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="CustomerClientLinkOperation", - ) - - -class CustomerClientLinkOperation(proto.Message): - r"""A single operation (create, update) on a CustomerClientLink. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CustomerClientLink): - Create operation: No resource name is - expected for the new link. - update (google.ads.googleads.v6.resources.types.CustomerClientLink): - Update operation: The link is expected to - have a valid resource name. - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=customer_client_link.CustomerClientLink, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=customer_client_link.CustomerClientLink, - ) - - -class MutateCustomerClientLinkResponse(proto.Message): - r"""Response message for a CustomerClientLink mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateCustomerClientLinkResult): - A result that identifies the resource - affected by the mutate request. - """ - - result = proto.Field( - proto.MESSAGE, number=1, message="MutateCustomerClientLinkResult", - ) - - -class MutateCustomerClientLinkResult(proto.Message): - r"""The result for a single customer client link mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_client_service.py b/google/ads/googleads/v6/services/types/customer_client_service.py deleted file mode 100644 index 2ae257d16..000000000 --- a/google/ads/googleads/v6/services/types/customer_client_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetCustomerClientRequest",}, -) - - -class GetCustomerClientRequest(proto.Message): - r"""Request message for - [CustomerClientService.GetCustomerClient][google.ads.googleads.v6.services.CustomerClientService.GetCustomerClient]. - - Attributes: - resource_name (str): - Required. The resource name of the client to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_extension_setting_service.py b/google/ads/googleads/v6/services/types/customer_extension_setting_service.py deleted file mode 100644 index 7aa404a68..000000000 --- a/google/ads/googleads/v6/services/types/customer_extension_setting_service.py +++ /dev/null @@ -1,155 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import customer_extension_setting -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerExtensionSettingRequest", - "MutateCustomerExtensionSettingsRequest", - "CustomerExtensionSettingOperation", - "MutateCustomerExtensionSettingsResponse", - "MutateCustomerExtensionSettingResult", - }, -) - - -class GetCustomerExtensionSettingRequest(proto.Message): - r"""Request message for - [CustomerExtensionSettingService.GetCustomerExtensionSetting][google.ads.googleads.v6.services.CustomerExtensionSettingService.GetCustomerExtensionSetting]. - - Attributes: - resource_name (str): - Required. The resource name of the customer - extension setting to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerExtensionSettingsRequest(proto.Message): - r"""Request message for - [CustomerExtensionSettingService.MutateCustomerExtensionSettings][google.ads.googleads.v6.services.CustomerExtensionSettingService.MutateCustomerExtensionSettings]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - customer extension settings are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomerExtensionSettingOperation]): - Required. The list of operations to perform - on individual customer extension settings. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomerExtensionSettingOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CustomerExtensionSettingOperation(proto.Message): - r"""A single operation (create, update, remove) on a customer - extension setting. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CustomerExtensionSetting): - Create operation: No resource name is - expected for the new customer extension setting. - update (google.ads.googleads.v6.resources.types.CustomerExtensionSetting): - Update operation: The customer extension - setting is expected to have a valid resource - name. - remove (str): - Remove operation: A resource name for the removed customer - extension setting is expected, in this format: - - ``customers/{customer_id}/customerExtensionSettings/{extension_type}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=customer_extension_setting.CustomerExtensionSetting, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=customer_extension_setting.CustomerExtensionSetting, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCustomerExtensionSettingsResponse(proto.Message): - r"""Response message for a customer extension setting mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomerExtensionSettingResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCustomerExtensionSettingResult", - ) - - -class MutateCustomerExtensionSettingResult(proto.Message): - r"""The result for the customer extension setting mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_feed_service.py b/google/ads/googleads/v6/services/types/customer_feed_service.py deleted file mode 100644 index f81480db3..000000000 --- a/google/ads/googleads/v6/services/types/customer_feed_service.py +++ /dev/null @@ -1,175 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - customer_feed as gagr_customer_feed, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerFeedRequest", - "MutateCustomerFeedsRequest", - "CustomerFeedOperation", - "MutateCustomerFeedsResponse", - "MutateCustomerFeedResult", - }, -) - - -class GetCustomerFeedRequest(proto.Message): - r"""Request message for - [CustomerFeedService.GetCustomerFeed][google.ads.googleads.v6.services.CustomerFeedService.GetCustomerFeed]. - - Attributes: - resource_name (str): - Required. The resource name of the customer - feed to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerFeedsRequest(proto.Message): - r"""Request message for - [CustomerFeedService.MutateCustomerFeeds][google.ads.googleads.v6.services.CustomerFeedService.MutateCustomerFeeds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - customer feeds are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomerFeedOperation]): - Required. The list of operations to perform - on individual customer feeds. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomerFeedOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CustomerFeedOperation(proto.Message): - r"""A single operation (create, update, remove) on a customer - feed. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.CustomerFeed): - Create operation: No resource name is - expected for the new customer feed. - update (google.ads.googleads.v6.resources.types.CustomerFeed): - Update operation: The customer feed is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed customer - feed is expected, in this format: - - ``customers/{customer_id}/customerFeeds/{feed_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_customer_feed.CustomerFeed, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_customer_feed.CustomerFeed, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateCustomerFeedsResponse(proto.Message): - r"""Response message for a customer feed mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomerFeedResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCustomerFeedResult", - ) - - -class MutateCustomerFeedResult(proto.Message): - r"""The result for the customer feed mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - customer_feed (google.ads.googleads.v6.resources.types.CustomerFeed): - The mutated customer feed with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - customer_feed = proto.Field( - proto.MESSAGE, number=2, message=gagr_customer_feed.CustomerFeed, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_label_service.py b/google/ads/googleads/v6/services/types/customer_label_service.py deleted file mode 100644 index 4738299fe..000000000 --- a/google/ads/googleads/v6/services/types/customer_label_service.py +++ /dev/null @@ -1,139 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import customer_label -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerLabelRequest", - "MutateCustomerLabelsRequest", - "CustomerLabelOperation", - "MutateCustomerLabelsResponse", - "MutateCustomerLabelResult", - }, -) - - -class GetCustomerLabelRequest(proto.Message): - r"""Request message for - [CustomerLabelService.GetCustomerLabel][google.ads.googleads.v6.services.CustomerLabelService.GetCustomerLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the customer- - abel relationship to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerLabelsRequest(proto.Message): - r"""Request message for - [CustomerLabelService.MutateCustomerLabels][google.ads.googleads.v6.services.CustomerLabelService.MutateCustomerLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose customer- - abel relationships are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomerLabelOperation]): - Required. The list of operations to perform - on customer-label relationships. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomerLabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class CustomerLabelOperation(proto.Message): - r"""A single operation (create, remove) on a customer-label - relationship. - - Attributes: - create (google.ads.googleads.v6.resources.types.CustomerLabel): - Create operation: No resource name is - expected for the new customer-label - relationship. - remove (str): - Remove operation: A resource name for the customer-label - relationship being removed, in this format: - - ``customers/{customer_id}/customerLabels/{label_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=customer_label.CustomerLabel, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCustomerLabelsResponse(proto.Message): - r"""Response message for a customer labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomerLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCustomerLabelResult", - ) - - -class MutateCustomerLabelResult(proto.Message): - r"""The result for a customer label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_manager_link_service.py b/google/ads/googleads/v6/services/types/customer_manager_link_service.py deleted file mode 100644 index 960329174..000000000 --- a/google/ads/googleads/v6/services/types/customer_manager_link_service.py +++ /dev/null @@ -1,162 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import customer_manager_link -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerManagerLinkRequest", - "MutateCustomerManagerLinkRequest", - "MoveManagerLinkRequest", - "CustomerManagerLinkOperation", - "MutateCustomerManagerLinkResponse", - "MoveManagerLinkResponse", - "MutateCustomerManagerLinkResult", - }, -) - - -class GetCustomerManagerLinkRequest(proto.Message): - r"""Request message for - [CustomerManagerLinkService.GetCustomerManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.GetCustomerManagerLink]. - - Attributes: - resource_name (str): - Required. The resource name of the - CustomerManagerLink to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerManagerLinkRequest(proto.Message): - r"""Request message for - [CustomerManagerLinkService.MutateCustomerManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.MutateCustomerManagerLink]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - customer manager links are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomerManagerLinkOperation]): - Required. The list of operations to perform - on individual customer manager links. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomerManagerLinkOperation", - ) - - -class MoveManagerLinkRequest(proto.Message): - r"""Request message for - [CustomerManagerLinkService.MoveManagerLink][google.ads.googleads.v6.services.CustomerManagerLinkService.MoveManagerLink]. - - Attributes: - customer_id (str): - Required. The ID of the client customer that - is being moved. - previous_customer_manager_link (str): - Required. The resource name of the previous - CustomerManagerLink. The resource name has the form: - ``customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}`` - new_manager (str): - Required. The resource name of the new manager customer that - the client wants to move to. Customer resource names have - the format: "customers/{customer_id}". - """ - - customer_id = proto.Field(proto.STRING, number=1) - previous_customer_manager_link = proto.Field(proto.STRING, number=2) - new_manager = proto.Field(proto.STRING, number=3) - - -class CustomerManagerLinkOperation(proto.Message): - r"""Updates the status of a CustomerManagerLink. - The following actions are possible: - 1. Update operation with status ACTIVE accepts a pending - invitation. 2. Update operation with status REFUSED declines a - pending invitation. 3. Update operation with status INACTIVE - terminates link to manager. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - update (google.ads.googleads.v6.resources.types.CustomerManagerLink): - Update operation: The link is expected to - have a valid resource name. - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=customer_manager_link.CustomerManagerLink, - ) - - -class MutateCustomerManagerLinkResponse(proto.Message): - r"""Response message for a CustomerManagerLink mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomerManagerLinkResult]): - A result that identifies the resource - affected by the mutate request. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="MutateCustomerManagerLinkResult", - ) - - -class MoveManagerLinkResponse(proto.Message): - r"""Response message for a CustomerManagerLink moveManagerLink. - - Attributes: - resource_name (str): - Returned for successful operations. - Represents a CustomerManagerLink resource of the - newly created link between client customer and - new manager customer. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerManagerLinkResult(proto.Message): - r"""The result for the customer manager link mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_negative_criterion_service.py b/google/ads/googleads/v6/services/types/customer_negative_criterion_service.py deleted file mode 100644 index eeaa73734..000000000 --- a/google/ads/googleads/v6/services/types/customer_negative_criterion_service.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - customer_negative_criterion as gagr_customer_negative_criterion, -) -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerNegativeCriterionRequest", - "MutateCustomerNegativeCriteriaRequest", - "CustomerNegativeCriterionOperation", - "MutateCustomerNegativeCriteriaResponse", - "MutateCustomerNegativeCriteriaResult", - }, -) - - -class GetCustomerNegativeCriterionRequest(proto.Message): - r"""Request message for - [CustomerNegativeCriterionService.GetCustomerNegativeCriterion][google.ads.googleads.v6.services.CustomerNegativeCriterionService.GetCustomerNegativeCriterion]. - - Attributes: - resource_name (str): - Required. The resource name of the criterion - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerNegativeCriteriaRequest(proto.Message): - r"""Request message for - [CustomerNegativeCriterionService.MutateCustomerNegativeCriteria][google.ads.googleads.v6.services.CustomerNegativeCriterionService.MutateCustomerNegativeCriteria]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - criteria are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.CustomerNegativeCriterionOperation]): - Required. The list of operations to perform - on individual criteria. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="CustomerNegativeCriterionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CustomerNegativeCriterionOperation(proto.Message): - r"""A single operation (create or remove) on a customer level - negative criterion. - - Attributes: - create (google.ads.googleads.v6.resources.types.CustomerNegativeCriterion): - Create operation: No resource name is - expected for the new criterion. - remove (str): - Remove operation: A resource name for the removed criterion - is expected, in this format: - - ``customers/{customer_id}/customerNegativeCriteria/{criterion_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_customer_negative_criterion.CustomerNegativeCriterion, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCustomerNegativeCriteriaResponse(proto.Message): - r"""Response message for customer negative criterion mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateCustomerNegativeCriteriaResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateCustomerNegativeCriteriaResult", - ) - - -class MutateCustomerNegativeCriteriaResult(proto.Message): - r"""The result for the criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - customer_negative_criterion (google.ads.googleads.v6.resources.types.CustomerNegativeCriterion): - The mutated criterion with only mutable fields after mutate. - The field will only be returned when response_content_type - is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - customer_negative_criterion = proto.Field( - proto.MESSAGE, - number=2, - message=gagr_customer_negative_criterion.CustomerNegativeCriterion, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_service.py b/google/ads/googleads/v6/services/types/customer_service.py deleted file mode 100644 index 26b72d6b3..000000000 --- a/google/ads/googleads/v6/services/types/customer_service.py +++ /dev/null @@ -1,210 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import access_role as gage_access_role -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import customer as gagr_customer -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerRequest", - "MutateCustomerRequest", - "CreateCustomerClientRequest", - "CustomerOperation", - "CreateCustomerClientResponse", - "MutateCustomerResponse", - "MutateCustomerResult", - "ListAccessibleCustomersRequest", - "ListAccessibleCustomersResponse", - }, -) - - -class GetCustomerRequest(proto.Message): - r"""Request message for - [CustomerService.GetCustomer][google.ads.googleads.v6.services.CustomerService.GetCustomer]. - - Attributes: - resource_name (str): - Required. The resource name of the customer - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerRequest(proto.Message): - r"""Request message for - [CustomerService.MutateCustomer][google.ads.googleads.v6.services.CustomerService.MutateCustomer]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - modified. - operation (google.ads.googleads.v6.services.types.CustomerOperation): - Required. The operation to perform on the - customer - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=4, message="CustomerOperation", - ) - validate_only = proto.Field(proto.BOOL, number=5) - response_content_type = proto.Field( - proto.ENUM, - number=6, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class CreateCustomerClientRequest(proto.Message): - r"""Request message for - [CustomerService.CreateCustomerClient][google.ads.googleads.v6.services.CustomerService.CreateCustomerClient]. - - Attributes: - customer_id (str): - Required. The ID of the Manager under whom - client customer is being created. - customer_client (google.ads.googleads.v6.resources.types.Customer): - Required. The new client customer to create. - The resource name on this customer will be - ignored. - email_address (str): - Email address of the user who should be - invited on the created client customer. - Accessible only to customers on the allow-list. - access_role (google.ads.googleads.v6.enums.types.AccessRoleEnum.AccessRole): - The proposed role of user on the created - client customer. Accessible only to customers on - the allow-list. - """ - - customer_id = proto.Field(proto.STRING, number=1) - customer_client = proto.Field( - proto.MESSAGE, number=2, message=gagr_customer.Customer, - ) - email_address = proto.Field(proto.STRING, number=5, optional=True) - access_role = proto.Field( - proto.ENUM, number=4, enum=gage_access_role.AccessRoleEnum.AccessRole, - ) - - -class CustomerOperation(proto.Message): - r"""A single update on a customer. - - Attributes: - update (google.ads.googleads.v6.resources.types.Customer): - Mutate operation. Only updates are supported - for customer. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - """ - - update = proto.Field( - proto.MESSAGE, number=1, message=gagr_customer.Customer, - ) - update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask.FieldMask, - ) - - -class CreateCustomerClientResponse(proto.Message): - r"""Response message for CreateCustomerClient mutate. - - Attributes: - resource_name (str): - The resource name of the newly created - customer client. - invitation_link (str): - Link for inviting user to access the created - customer. Accessible to allowlisted customers - only. - """ - - resource_name = proto.Field(proto.STRING, number=2) - invitation_link = proto.Field(proto.STRING, number=3) - - -class MutateCustomerResponse(proto.Message): - r"""Response message for customer mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateCustomerResult): - Result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=2, message="MutateCustomerResult", - ) - - -class MutateCustomerResult(proto.Message): - r"""The result for the customer mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - customer (google.ads.googleads.v6.resources.types.Customer): - The mutated customer with only mutable fields after mutate. - The fields will only be returned when response_content_type - is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - customer = proto.Field( - proto.MESSAGE, number=2, message=gagr_customer.Customer, - ) - - -class ListAccessibleCustomersRequest(proto.Message): - r"""Request message for - [CustomerService.ListAccessibleCustomers][google.ads.googleads.v6.services.CustomerService.ListAccessibleCustomers]. - """ - - -class ListAccessibleCustomersResponse(proto.Message): - r"""Response message for - [CustomerService.ListAccessibleCustomers][google.ads.googleads.v6.services.CustomerService.ListAccessibleCustomers]. - - Attributes: - resource_names (Sequence[str]): - Resource name of customers directly - accessible by the user authenticating the call. - """ - - resource_names = proto.RepeatedField(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_user_access_invitation_service.py b/google/ads/googleads/v6/services/types/customer_user_access_invitation_service.py deleted file mode 100644 index 2a2cb173d..000000000 --- a/google/ads/googleads/v6/services/types/customer_user_access_invitation_service.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ( - customer_user_access_invitation, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerUserAccessInvitationRequest", - "MutateCustomerUserAccessInvitationRequest", - "CustomerUserAccessInvitationOperation", - "MutateCustomerUserAccessInvitationResponse", - "MutateCustomerUserAccessInvitationResult", - }, -) - - -class GetCustomerUserAccessInvitationRequest(proto.Message): - r"""Request message for - [CustomerUserAccessInvitation.GetCustomerUserAccessInvitation][] - - Attributes: - resource_name (str): - Required. Resource name of the access - invitation. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerUserAccessInvitationRequest(proto.Message): - r"""Request message for - [CustomerUserAccessInvitation.MutateCustomerUserAccessInvitation][] - - Attributes: - customer_id (str): - Required. The ID of the customer whose access - invitation is being modified. - operation (google.ads.googleads.v6.services.types.CustomerUserAccessInvitationOperation): - Required. The operation to perform on the - access invitation - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, - number=2, - message="CustomerUserAccessInvitationOperation", - ) - - -class CustomerUserAccessInvitationOperation(proto.Message): - r"""A single operation (create or remove) on customer user access - invitation. - - Attributes: - create (google.ads.googleads.v6.resources.types.CustomerUserAccessInvitation): - Create operation: No resource name is - expected for the new access invitation. - remove (str): - Remove operation: A resource name for the revoke invitation - is expected, in this format: - - ``customers/{customer_id}/customerUserAccessInvitations/{invitation_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=customer_user_access_invitation.CustomerUserAccessInvitation, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCustomerUserAccessInvitationResponse(proto.Message): - r"""Response message for access invitation mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateCustomerUserAccessInvitationResult): - Result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, - number=1, - message="MutateCustomerUserAccessInvitationResult", - ) - - -class MutateCustomerUserAccessInvitationResult(proto.Message): - r"""The result for the access invitation mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/customer_user_access_service.py b/google/ads/googleads/v6/services/types/customer_user_access_service.py deleted file mode 100644 index 388889a84..000000000 --- a/google/ads/googleads/v6/services/types/customer_user_access_service.py +++ /dev/null @@ -1,123 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import customer_user_access -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetCustomerUserAccessRequest", - "MutateCustomerUserAccessRequest", - "CustomerUserAccessOperation", - "MutateCustomerUserAccessResponse", - "MutateCustomerUserAccessResult", - }, -) - - -class GetCustomerUserAccessRequest(proto.Message): - r"""Request message for - [CustomerUserAccessService.GetCustomerUserAccess][google.ads.googleads.v6.services.CustomerUserAccessService.GetCustomerUserAccess]. - - Attributes: - resource_name (str): - Required. Resource name of the customer user - access. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateCustomerUserAccessRequest(proto.Message): - r"""Mutate Request for - [CustomerUserAccessService.MutateCustomerUserAccess][google.ads.googleads.v6.services.CustomerUserAccessService.MutateCustomerUserAccess]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - modified. - operation (google.ads.googleads.v6.services.types.CustomerUserAccessOperation): - Required. The operation to perform on the - customer - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="CustomerUserAccessOperation", - ) - - -class CustomerUserAccessOperation(proto.Message): - r"""A single operation (update, remove) on customer user access. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - update (google.ads.googleads.v6.resources.types.CustomerUserAccess): - Update operation: The customer user access is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed access is - expected, in this format: - - ``customers/{customer_id}/customerUserAccesses/{CustomerUserAccess.user_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask.FieldMask, - ) - update = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=customer_user_access.CustomerUserAccess, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateCustomerUserAccessResponse(proto.Message): - r"""Response message for customer user access mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateCustomerUserAccessResult): - Result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=1, message="MutateCustomerUserAccessResult", - ) - - -class MutateCustomerUserAccessResult(proto.Message): - r"""The result for the customer user access mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/detail_placement_view_service.py b/google/ads/googleads/v6/services/types/detail_placement_view_service.py deleted file mode 100644 index 887f4c00d..000000000 --- a/google/ads/googleads/v6/services/types/detail_placement_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetDetailPlacementViewRequest",}, -) - - -class GetDetailPlacementViewRequest(proto.Message): - r"""Request message for - [DetailPlacementViewService.GetDetailPlacementView][google.ads.googleads.v6.services.DetailPlacementViewService.GetDetailPlacementView]. - - Attributes: - resource_name (str): - Required. The resource name of the Detail - Placement view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/display_keyword_view_service.py b/google/ads/googleads/v6/services/types/display_keyword_view_service.py deleted file mode 100644 index e2f59810a..000000000 --- a/google/ads/googleads/v6/services/types/display_keyword_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetDisplayKeywordViewRequest",}, -) - - -class GetDisplayKeywordViewRequest(proto.Message): - r"""Request message for - [DisplayKeywordViewService.GetDisplayKeywordView][google.ads.googleads.v6.services.DisplayKeywordViewService.GetDisplayKeywordView]. - - Attributes: - resource_name (str): - Required. The resource name of the display - keyword view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/distance_view_service.py b/google/ads/googleads/v6/services/types/distance_view_service.py deleted file mode 100644 index 31530eb7b..000000000 --- a/google/ads/googleads/v6/services/types/distance_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetDistanceViewRequest",}, -) - - -class GetDistanceViewRequest(proto.Message): - r"""Request message for - [DistanceViewService.GetDistanceView][google.ads.googleads.v6.services.DistanceViewService.GetDistanceView]. - - Attributes: - resource_name (str): - Required. The resource name of the distance - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/domain_category_service.py b/google/ads/googleads/v6/services/types/domain_category_service.py deleted file mode 100644 index e63833c47..000000000 --- a/google/ads/googleads/v6/services/types/domain_category_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetDomainCategoryRequest",}, -) - - -class GetDomainCategoryRequest(proto.Message): - r"""Request message for - [DomainCategoryService.GetDomainCategory][google.ads.googleads.v6.services.DomainCategoryService.GetDomainCategory]. - - Attributes: - resource_name (str): - Required. Resource name of the domain - category to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/dynamic_search_ads_search_term_view_service.py b/google/ads/googleads/v6/services/types/dynamic_search_ads_search_term_view_service.py deleted file mode 100644 index f5246ffa9..000000000 --- a/google/ads/googleads/v6/services/types/dynamic_search_ads_search_term_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetDynamicSearchAdsSearchTermViewRequest",}, -) - - -class GetDynamicSearchAdsSearchTermViewRequest(proto.Message): - r"""Request message for - [DynamicSearchAdsSearchTermViewService.GetDynamicSearchAdsSearchTermView][google.ads.googleads.v6.services.DynamicSearchAdsSearchTermViewService.GetDynamicSearchAdsSearchTermView]. - - Attributes: - resource_name (str): - Required. The resource name of the dynamic - search ads search term view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/expanded_landing_page_view_service.py b/google/ads/googleads/v6/services/types/expanded_landing_page_view_service.py deleted file mode 100644 index bc30ec5c5..000000000 --- a/google/ads/googleads/v6/services/types/expanded_landing_page_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetExpandedLandingPageViewRequest",}, -) - - -class GetExpandedLandingPageViewRequest(proto.Message): - r"""Request message for - [ExpandedLandingPageViewService.GetExpandedLandingPageView][google.ads.googleads.v6.services.ExpandedLandingPageViewService.GetExpandedLandingPageView]. - - Attributes: - resource_name (str): - Required. The resource name of the expanded - landing page view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_item_service.py b/google/ads/googleads/v6/services/types/feed_item_service.py deleted file mode 100644 index 87e826593..000000000 --- a/google/ads/googleads/v6/services/types/feed_item_service.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import feed_item as gagr_feed_item -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedItemRequest", - "MutateFeedItemsRequest", - "FeedItemOperation", - "MutateFeedItemsResponse", - "MutateFeedItemResult", - }, -) - - -class GetFeedItemRequest(proto.Message): - r"""Request message for - [FeedItemService.GetFeedItem][google.ads.googleads.v6.services.FeedItemService.GetFeedItem]. - - Attributes: - resource_name (str): - Required. The resource name of the feed item - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedItemsRequest(proto.Message): - r"""Request message for - [FeedItemService.MutateFeedItems][google.ads.googleads.v6.services.FeedItemService.MutateFeedItems]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feed - items are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedItemOperation]): - Required. The list of operations to perform - on individual feed items. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedItemOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class FeedItemOperation(proto.Message): - r"""A single operation (create, update, remove) on an feed item. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.FeedItem): - Create operation: No resource name is - expected for the new feed item. - update (google.ads.googleads.v6.resources.types.FeedItem): - Update operation: The feed item is expected - to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed feed item - is expected, in this format: - - ``customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_feed_item.FeedItem, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_feed_item.FeedItem, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateFeedItemsResponse(proto.Message): - r"""Response message for an feed item mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedItemResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateFeedItemResult", - ) - - -class MutateFeedItemResult(proto.Message): - r"""The result for the feed item mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - feed_item (google.ads.googleads.v6.resources.types.FeedItem): - The mutated feed item with only mutable fields after mutate. - The field will only be returned when response_content_type - is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed_item = proto.Field( - proto.MESSAGE, number=2, message=gagr_feed_item.FeedItem, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_item_set_link_service.py b/google/ads/googleads/v6/services/types/feed_item_set_link_service.py deleted file mode 100644 index 52ea4af14..000000000 --- a/google/ads/googleads/v6/services/types/feed_item_set_link_service.py +++ /dev/null @@ -1,127 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import feed_item_set_link - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedItemSetLinkRequest", - "MutateFeedItemSetLinksRequest", - "FeedItemSetLinkOperation", - "MutateFeedItemSetLinksResponse", - "MutateFeedItemSetLinkResult", - }, -) - - -class GetFeedItemSetLinkRequest(proto.Message): - r"""Request message for [FeedItemSetLinkService.GetFeedItemSetLinks][]. - - Attributes: - resource_name (str): - Required. The resource name of the feed item - set link to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedItemSetLinksRequest(proto.Message): - r"""Request message for - [FeedItemSetLinkService.MutateFeedItemSetLinks][google.ads.googleads.v6.services.FeedItemSetLinkService.MutateFeedItemSetLinks]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feed - item set links are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedItemSetLinkOperation]): - Required. The list of operations to perform - on individual feed item set links. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedItemSetLinkOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class FeedItemSetLinkOperation(proto.Message): - r"""A single operation (create, update, remove) on a feed item - set link. - - Attributes: - create (google.ads.googleads.v6.resources.types.FeedItemSetLink): - Create operation: No resource name is - expected for the new feed item set link. - remove (str): - Remove operation: A resource name for the removed feed item - set link is expected, in this format: - - ``customers/{customer_id}/feedItemSetLinks/{feed_id}_{feed_item_set_id}_{feed_item_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=feed_item_set_link.FeedItemSetLink, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateFeedItemSetLinksResponse(proto.Message): - r"""Response message for a feed item set link mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedItemSetLinkResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="MutateFeedItemSetLinkResult", - ) - - -class MutateFeedItemSetLinkResult(proto.Message): - r"""The result for the feed item set link mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_item_set_service.py b/google/ads/googleads/v6/services/types/feed_item_set_service.py deleted file mode 100644 index 1b9f124e5..000000000 --- a/google/ads/googleads/v6/services/types/feed_item_set_service.py +++ /dev/null @@ -1,142 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import feed_item_set -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedItemSetRequest", - "MutateFeedItemSetsRequest", - "FeedItemSetOperation", - "MutateFeedItemSetsResponse", - "MutateFeedItemSetResult", - }, -) - - -class GetFeedItemSetRequest(proto.Message): - r"""Request message for - [FeedItemSetService.GetFeedItemSet][google.ads.googleads.v6.services.FeedItemSetService.GetFeedItemSet]. - - Attributes: - resource_name (str): - Required. The resource name of the feed item - set to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedItemSetsRequest(proto.Message): - r"""Request message for - [FeedItemSetService.MutateFeedItemSets][google.ads.googleads.v6.services.FeedItemSetService.MutateFeedItemSets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feed - item sets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedItemSetOperation]): - Required. The list of operations to perform - on individual feed item sets. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedItemSetOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class FeedItemSetOperation(proto.Message): - r"""A single operation (create, remove) on an feed item set. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.FeedItemSet): - Create operation: No resource name is - expected for the new feed item set - update (google.ads.googleads.v6.resources.types.FeedItemSet): - Update operation: The feed item set is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed feed item - is expected, in this format: - ``customers/{customer_id}/feedItems/{feed_id}~{feed_item_set_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=feed_item_set.FeedItemSet, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=feed_item_set.FeedItemSet, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateFeedItemSetsResponse(proto.Message): - r"""Response message for an feed item set mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedItemSetResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="MutateFeedItemSetResult", - ) - - -class MutateFeedItemSetResult(proto.Message): - r"""The result for the feed item set mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_item_target_service.py b/google/ads/googleads/v6/services/types/feed_item_target_service.py deleted file mode 100644 index 4295ff7dc..000000000 --- a/google/ads/googleads/v6/services/types/feed_item_target_service.py +++ /dev/null @@ -1,137 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - feed_item_target as gagr_feed_item_target, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedItemTargetRequest", - "MutateFeedItemTargetsRequest", - "FeedItemTargetOperation", - "MutateFeedItemTargetsResponse", - "MutateFeedItemTargetResult", - }, -) - - -class GetFeedItemTargetRequest(proto.Message): - r"""Request message for - [FeedItemTargetService.GetFeedItemTarget][google.ads.googleads.v6.services.FeedItemTargetService.GetFeedItemTarget]. - - Attributes: - resource_name (str): - Required. The resource name of the feed item - targets to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedItemTargetsRequest(proto.Message): - r"""Request message for - [FeedItemTargetService.MutateFeedItemTargets][google.ads.googleads.v6.services.FeedItemTargetService.MutateFeedItemTargets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feed - item targets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedItemTargetOperation]): - Required. The list of operations to perform - on individual feed item targets. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedItemTargetOperation", - ) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class FeedItemTargetOperation(proto.Message): - r"""A single operation (create, remove) on an feed item target. - - Attributes: - create (google.ads.googleads.v6.resources.types.FeedItemTarget): - Create operation: No resource name is - expected for the new feed item target. - remove (str): - Remove operation: A resource name for the removed feed item - target is expected, in this format: - - ``customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_feed_item_target.FeedItemTarget, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateFeedItemTargetsResponse(proto.Message): - r"""Response message for an feed item target mutate. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedItemTargetResult]): - All results for the mutate. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateFeedItemTargetResult", - ) - - -class MutateFeedItemTargetResult(proto.Message): - r"""The result for the feed item target mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - feed_item_target (google.ads.googleads.v6.resources.types.FeedItemTarget): - The mutated feed item target with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed_item_target = proto.Field( - proto.MESSAGE, number=2, message=gagr_feed_item_target.FeedItemTarget, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_mapping_service.py b/google/ads/googleads/v6/services/types/feed_mapping_service.py deleted file mode 100644 index 58560aa96..000000000 --- a/google/ads/googleads/v6/services/types/feed_mapping_service.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - feed_mapping as gagr_feed_mapping, -) -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedMappingRequest", - "MutateFeedMappingsRequest", - "FeedMappingOperation", - "MutateFeedMappingsResponse", - "MutateFeedMappingResult", - }, -) - - -class GetFeedMappingRequest(proto.Message): - r"""Request message for - [FeedMappingService.GetFeedMapping][google.ads.googleads.v6.services.FeedMappingService.GetFeedMapping]. - - Attributes: - resource_name (str): - Required. The resource name of the feed - mapping to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedMappingsRequest(proto.Message): - r"""Request message for - [FeedMappingService.MutateFeedMappings][google.ads.googleads.v6.services.FeedMappingService.MutateFeedMappings]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feed - mappings are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedMappingOperation]): - Required. The list of operations to perform - on individual feed mappings. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedMappingOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class FeedMappingOperation(proto.Message): - r"""A single operation (create, remove) on a feed mapping. - - Attributes: - create (google.ads.googleads.v6.resources.types.FeedMapping): - Create operation: No resource name is - expected for the new feed mapping. - remove (str): - Remove operation: A resource name for the removed feed - mapping is expected, in this format: - - ``customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_feed_mapping.FeedMapping, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateFeedMappingsResponse(proto.Message): - r"""Response message for a feed mapping mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedMappingResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateFeedMappingResult", - ) - - -class MutateFeedMappingResult(proto.Message): - r"""The result for the feed mapping mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - feed_mapping (google.ads.googleads.v6.resources.types.FeedMapping): - The mutated feed mapping with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed_mapping = proto.Field( - proto.MESSAGE, number=2, message=gagr_feed_mapping.FeedMapping, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_placeholder_view_service.py b/google/ads/googleads/v6/services/types/feed_placeholder_view_service.py deleted file mode 100644 index d54494fcc..000000000 --- a/google/ads/googleads/v6/services/types/feed_placeholder_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetFeedPlaceholderViewRequest",}, -) - - -class GetFeedPlaceholderViewRequest(proto.Message): - r"""Request message for - [FeedPlaceholderViewService.GetFeedPlaceholderView][google.ads.googleads.v6.services.FeedPlaceholderViewService.GetFeedPlaceholderView]. - - Attributes: - resource_name (str): - Required. The resource name of the feed - placeholder view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/feed_service.py b/google/ads/googleads/v6/services/types/feed_service.py deleted file mode 100644 index bd36c5e55..000000000 --- a/google/ads/googleads/v6/services/types/feed_service.py +++ /dev/null @@ -1,164 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import feed as gagr_feed -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetFeedRequest", - "MutateFeedsRequest", - "FeedOperation", - "MutateFeedsResponse", - "MutateFeedResult", - }, -) - - -class GetFeedRequest(proto.Message): - r"""Request message for - [FeedService.GetFeed][google.ads.googleads.v6.services.FeedService.GetFeed]. - - Attributes: - resource_name (str): - Required. The resource name of the feed to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateFeedsRequest(proto.Message): - r"""Request message for - [FeedService.MutateFeeds][google.ads.googleads.v6.services.FeedService.MutateFeeds]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose feeds - are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.FeedOperation]): - Required. The list of operations to perform - on individual feeds. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="FeedOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class FeedOperation(proto.Message): - r"""A single operation (create, update, remove) on an feed. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.Feed): - Create operation: No resource name is - expected for the new feed. - update (google.ads.googleads.v6.resources.types.Feed): - Update operation: The feed is expected to - have a valid resource name. - remove (str): - Remove operation: A resource name for the removed feed is - expected, in this format: - - ``customers/{customer_id}/feeds/{feed_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=gagr_feed.Feed, - ) - update = proto.Field( - proto.MESSAGE, number=2, oneof="operation", message=gagr_feed.Feed, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateFeedsResponse(proto.Message): - r"""Response message for an feed mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateFeedResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateFeedResult", - ) - - -class MutateFeedResult(proto.Message): - r"""The result for the feed mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - feed (google.ads.googleads.v6.resources.types.Feed): - The mutated feed with only mutable fields after mutate. The - field will only be returned when response_content_type is - set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - feed = proto.Field(proto.MESSAGE, number=2, message=gagr_feed.Feed,) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/gender_view_service.py b/google/ads/googleads/v6/services/types/gender_view_service.py deleted file mode 100644 index fb7971951..000000000 --- a/google/ads/googleads/v6/services/types/gender_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetGenderViewRequest",}, -) - - -class GetGenderViewRequest(proto.Message): - r"""Request message for - [GenderViewService.GetGenderView][google.ads.googleads.v6.services.GenderViewService.GetGenderView]. - - Attributes: - resource_name (str): - Required. The resource name of the gender - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/geo_target_constant_service.py b/google/ads/googleads/v6/services/types/geo_target_constant_service.py deleted file mode 100644 index 2b58b984f..000000000 --- a/google/ads/googleads/v6/services/types/geo_target_constant_service.py +++ /dev/null @@ -1,157 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ( - geo_target_constant as gagr_geo_target_constant, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetGeoTargetConstantRequest", - "SuggestGeoTargetConstantsRequest", - "SuggestGeoTargetConstantsResponse", - "GeoTargetConstantSuggestion", - }, -) - - -class GetGeoTargetConstantRequest(proto.Message): - r"""Request message for - [GeoTargetConstantService.GetGeoTargetConstant][google.ads.googleads.v6.services.GeoTargetConstantService.GetGeoTargetConstant]. - - Attributes: - resource_name (str): - Required. The resource name of the geo target - constant to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class SuggestGeoTargetConstantsRequest(proto.Message): - r"""Request message for - [GeoTargetConstantService.SuggestGeoTargetConstants][google.ads.googleads.v6.services.GeoTargetConstantService.SuggestGeoTargetConstants]. - - Attributes: - locale (str): - If possible, returned geo targets are - translated using this locale. If not, en is used - by default. This is also used as a hint for - returned geo targets. - country_code (str): - Returned geo targets are restricted to this - country code. - location_names (google.ads.googleads.v6.services.types.SuggestGeoTargetConstantsRequest.LocationNames): - The location names to search by. At most 25 - names can be set. - geo_targets (google.ads.googleads.v6.services.types.SuggestGeoTargetConstantsRequest.GeoTargets): - The geo target constant resource names to - filter by. - """ - - class LocationNames(proto.Message): - r"""A list of location names. - - Attributes: - names (Sequence[str]): - A list of location names. - """ - - names = proto.RepeatedField(proto.STRING, number=2) - - class GeoTargets(proto.Message): - r"""A list of geo target constant resource names. - - Attributes: - geo_target_constants (Sequence[str]): - A list of geo target constant resource names. - """ - - geo_target_constants = proto.RepeatedField(proto.STRING, number=2) - - locale = proto.Field(proto.STRING, number=6, optional=True) - country_code = proto.Field(proto.STRING, number=7, optional=True) - location_names = proto.Field( - proto.MESSAGE, number=1, oneof="query", message=LocationNames, - ) - geo_targets = proto.Field( - proto.MESSAGE, number=2, oneof="query", message=GeoTargets, - ) - - -class SuggestGeoTargetConstantsResponse(proto.Message): - r"""Response message for - [GeoTargetConstantService.SuggestGeoTargetConstants][google.ads.googleads.v6.services.GeoTargetConstantService.SuggestGeoTargetConstants]. - - Attributes: - geo_target_constant_suggestions (Sequence[google.ads.googleads.v6.services.types.GeoTargetConstantSuggestion]): - Geo target constant suggestions. - """ - - geo_target_constant_suggestions = proto.RepeatedField( - proto.MESSAGE, number=1, message="GeoTargetConstantSuggestion", - ) - - -class GeoTargetConstantSuggestion(proto.Message): - r"""A geo target constant suggestion. - - Attributes: - locale (str): - The language this GeoTargetConstantSuggestion - is currently translated to. It affects the name - of geo target fields. For example, if locale=en, - then name=Spain. If locale=es, then name=España. - The default locale will be returned if no - translation exists for the locale in the - request. - reach (int): - Approximate user population that will be - targeted, rounded to the nearest 100. - search_term (str): - If the request searched by location name, - this is the location name that matched the geo - target. - geo_target_constant (google.ads.googleads.v6.resources.types.GeoTargetConstant): - The GeoTargetConstant result. - geo_target_constant_parents (Sequence[google.ads.googleads.v6.resources.types.GeoTargetConstant]): - The list of parents of the geo target - constant. - """ - - locale = proto.Field(proto.STRING, number=6, optional=True) - reach = proto.Field(proto.INT64, number=7, optional=True) - search_term = proto.Field(proto.STRING, number=8, optional=True) - geo_target_constant = proto.Field( - proto.MESSAGE, - number=4, - message=gagr_geo_target_constant.GeoTargetConstant, - ) - geo_target_constant_parents = proto.RepeatedField( - proto.MESSAGE, - number=5, - message=gagr_geo_target_constant.GeoTargetConstant, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/geographic_view_service.py b/google/ads/googleads/v6/services/types/geographic_view_service.py deleted file mode 100644 index 6101b2e9e..000000000 --- a/google/ads/googleads/v6/services/types/geographic_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetGeographicViewRequest",}, -) - - -class GetGeographicViewRequest(proto.Message): - r"""Request message for - [GeographicViewService.GetGeographicView][google.ads.googleads.v6.services.GeographicViewService.GetGeographicView]. - - Attributes: - resource_name (str): - Required. The resource name of the geographic - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/google_ads_field_service.py b/google/ads/googleads/v6/services/types/google_ads_field_service.py deleted file mode 100644 index e2de089aa..000000000 --- a/google/ads/googleads/v6/services/types/google_ads_field_service.py +++ /dev/null @@ -1,100 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import google_ads_field - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetGoogleAdsFieldRequest", - "SearchGoogleAdsFieldsRequest", - "SearchGoogleAdsFieldsResponse", - }, -) - - -class GetGoogleAdsFieldRequest(proto.Message): - r"""Request message for - [GoogleAdsFieldService.GetGoogleAdsField][google.ads.googleads.v6.services.GoogleAdsFieldService.GetGoogleAdsField]. - - Attributes: - resource_name (str): - Required. The resource name of the field to - get. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class SearchGoogleAdsFieldsRequest(proto.Message): - r"""Request message for - [GoogleAdsFieldService.SearchGoogleAdsFields][google.ads.googleads.v6.services.GoogleAdsFieldService.SearchGoogleAdsFields]. - - Attributes: - query (str): - Required. The query string. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. Use the value obtained - from ``next_page_token`` in the previous response in order - to request the next page of results. - page_size (int): - Number of elements to retrieve in a single - page. When too large a page is requested, the - server may decide to further limit the number of - returned resources. - """ - - query = proto.Field(proto.STRING, number=1) - page_token = proto.Field(proto.STRING, number=2) - page_size = proto.Field(proto.INT32, number=3) - - -class SearchGoogleAdsFieldsResponse(proto.Message): - r"""Response message for - [GoogleAdsFieldService.SearchGoogleAdsFields][google.ads.googleads.v6.services.GoogleAdsFieldService.SearchGoogleAdsFields]. - - Attributes: - results (Sequence[google.ads.googleads.v6.resources.types.GoogleAdsField]): - The list of fields that matched the query. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - total_results_count (int): - Total number of results that match the query - ignoring the LIMIT clause. - """ - - @property - def raw_page(self): - return self - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message=google_ads_field.GoogleAdsField, - ) - next_page_token = proto.Field(proto.STRING, number=2) - total_results_count = proto.Field(proto.INT64, number=3) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/google_ads_service.py b/google/ads/googleads/v6/services/types/google_ads_service.py deleted file mode 100644 index 80b22fe22..000000000 --- a/google/ads/googleads/v6/services/types/google_ads_service.py +++ /dev/null @@ -1,2150 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import metrics as gagc_metrics -from google.ads.googleads.v6.common.types import segments as gagc_segments -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.enums.types import ( - summary_row_setting as gage_summary_row_setting, -) -from google.ads.googleads.v6.resources.types import ( - account_budget as gagr_account_budget, -) -from google.ads.googleads.v6.resources.types import ( - account_budget_proposal as gagr_account_budget_proposal, -) -from google.ads.googleads.v6.resources.types import ( - account_link as gagr_account_link, -) -from google.ads.googleads.v6.resources.types import ad_group as gagr_ad_group -from google.ads.googleads.v6.resources.types import ( - ad_group_ad as gagr_ad_group_ad, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_ad_asset_view as gagr_ad_group_ad_asset_view, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_ad_label as gagr_ad_group_ad_label, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_audience_view as gagr_ad_group_audience_view, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_bid_modifier as gagr_ad_group_bid_modifier, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion as gagr_ad_group_criterion, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion_label as gagr_ad_group_criterion_label, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_criterion_simulation as gagr_ad_group_criterion_simulation, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_extension_setting as gagr_ad_group_extension_setting, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_feed as gagr_ad_group_feed, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_label as gagr_ad_group_label, -) -from google.ads.googleads.v6.resources.types import ( - ad_group_simulation as gagr_ad_group_simulation, -) -from google.ads.googleads.v6.resources.types import ( - ad_parameter as gagr_ad_parameter, -) -from google.ads.googleads.v6.resources.types import ( - ad_schedule_view as gagr_ad_schedule_view, -) -from google.ads.googleads.v6.resources.types import ( - age_range_view as gagr_age_range_view, -) -from google.ads.googleads.v6.resources.types import asset as gagr_asset -from google.ads.googleads.v6.resources.types import batch_job as gagr_batch_job -from google.ads.googleads.v6.resources.types import ( - bidding_strategy as gagr_bidding_strategy, -) -from google.ads.googleads.v6.resources.types import ( - billing_setup as gagr_billing_setup, -) -from google.ads.googleads.v6.resources.types import call_view as gagr_call_view -from google.ads.googleads.v6.resources.types import campaign as gagr_campaign -from google.ads.googleads.v6.resources.types import ( - campaign_asset as gagr_campaign_asset, -) -from google.ads.googleads.v6.resources.types import ( - campaign_audience_view as gagr_campaign_audience_view, -) -from google.ads.googleads.v6.resources.types import ( - campaign_bid_modifier as gagr_campaign_bid_modifier, -) -from google.ads.googleads.v6.resources.types import ( - campaign_budget as gagr_campaign_budget, -) -from google.ads.googleads.v6.resources.types import ( - campaign_criterion as gagr_campaign_criterion, -) -from google.ads.googleads.v6.resources.types import ( - campaign_criterion_simulation as gagr_campaign_criterion_simulation, -) -from google.ads.googleads.v6.resources.types import ( - campaign_draft as gagr_campaign_draft, -) -from google.ads.googleads.v6.resources.types import ( - campaign_experiment as gagr_campaign_experiment, -) -from google.ads.googleads.v6.resources.types import ( - campaign_extension_setting as gagr_campaign_extension_setting, -) -from google.ads.googleads.v6.resources.types import ( - campaign_feed as gagr_campaign_feed, -) -from google.ads.googleads.v6.resources.types import ( - campaign_label as gagr_campaign_label, -) -from google.ads.googleads.v6.resources.types import ( - campaign_shared_set as gagr_campaign_shared_set, -) -from google.ads.googleads.v6.resources.types import ( - carrier_constant as gagr_carrier_constant, -) -from google.ads.googleads.v6.resources.types import ( - change_event as gagr_change_event, -) -from google.ads.googleads.v6.resources.types import ( - change_status as gagr_change_status, -) -from google.ads.googleads.v6.resources.types import ( - click_view as gagr_click_view, -) -from google.ads.googleads.v6.resources.types import ( - combined_audience as gagr_combined_audience, -) -from google.ads.googleads.v6.resources.types import ( - conversion_action as gagr_conversion_action, -) -from google.ads.googleads.v6.resources.types import ( - currency_constant as gagr_currency_constant, -) -from google.ads.googleads.v6.resources.types import ( - custom_audience as gagr_custom_audience, -) -from google.ads.googleads.v6.resources.types import ( - custom_interest as gagr_custom_interest, -) -from google.ads.googleads.v6.resources.types import customer as gagr_customer -from google.ads.googleads.v6.resources.types import ( - customer_client as gagr_customer_client, -) -from google.ads.googleads.v6.resources.types import ( - customer_client_link as gagr_customer_client_link, -) -from google.ads.googleads.v6.resources.types import ( - customer_extension_setting as gagr_customer_extension_setting, -) -from google.ads.googleads.v6.resources.types import ( - customer_feed as gagr_customer_feed, -) -from google.ads.googleads.v6.resources.types import ( - customer_label as gagr_customer_label, -) -from google.ads.googleads.v6.resources.types import ( - customer_manager_link as gagr_customer_manager_link, -) -from google.ads.googleads.v6.resources.types import ( - customer_negative_criterion as gagr_customer_negative_criterion, -) -from google.ads.googleads.v6.resources.types import ( - customer_user_access as gagr_customer_user_access, -) -from google.ads.googleads.v6.resources.types import ( - customer_user_access_invitation as gagr_customer_user_access_invitation, -) -from google.ads.googleads.v6.resources.types import ( - detail_placement_view as gagr_detail_placement_view, -) -from google.ads.googleads.v6.resources.types import ( - display_keyword_view as gagr_display_keyword_view, -) -from google.ads.googleads.v6.resources.types import ( - distance_view as gagr_distance_view, -) -from google.ads.googleads.v6.resources.types import ( - domain_category as gagr_domain_category, -) -from google.ads.googleads.v6.resources.types import ( - dynamic_search_ads_search_term_view as gagr_dynamic_search_ads_search_term_view, -) -from google.ads.googleads.v6.resources.types import ( - expanded_landing_page_view as gagr_expanded_landing_page_view, -) -from google.ads.googleads.v6.resources.types import ( - extension_feed_item as gagr_extension_feed_item, -) -from google.ads.googleads.v6.resources.types import feed as gagr_feed -from google.ads.googleads.v6.resources.types import feed_item as gagr_feed_item -from google.ads.googleads.v6.resources.types import ( - feed_item_set as gagr_feed_item_set, -) -from google.ads.googleads.v6.resources.types import ( - feed_item_set_link as gagr_feed_item_set_link, -) -from google.ads.googleads.v6.resources.types import ( - feed_item_target as gagr_feed_item_target, -) -from google.ads.googleads.v6.resources.types import ( - feed_mapping as gagr_feed_mapping, -) -from google.ads.googleads.v6.resources.types import ( - feed_placeholder_view as gagr_feed_placeholder_view, -) -from google.ads.googleads.v6.resources.types import ( - gender_view as gagr_gender_view, -) -from google.ads.googleads.v6.resources.types import ( - geo_target_constant as gagr_geo_target_constant, -) -from google.ads.googleads.v6.resources.types import ( - geographic_view as gagr_geographic_view, -) -from google.ads.googleads.v6.resources.types import ( - group_placement_view as gagr_group_placement_view, -) -from google.ads.googleads.v6.resources.types import ( - hotel_group_view as gagr_hotel_group_view, -) -from google.ads.googleads.v6.resources.types import ( - hotel_performance_view as gagr_hotel_performance_view, -) -from google.ads.googleads.v6.resources.types import ( - income_range_view as gagr_income_range_view, -) -from google.ads.googleads.v6.resources.types import ( - keyword_plan as gagr_keyword_plan, -) -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group as gagr_keyword_plan_ad_group, -) -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group_keyword as gagr_keyword_plan_ad_group_keyword, -) -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign as gagr_keyword_plan_campaign, -) -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign_keyword as gagr_keyword_plan_campaign_keyword, -) -from google.ads.googleads.v6.resources.types import ( - keyword_view as gagr_keyword_view, -) -from google.ads.googleads.v6.resources.types import label as gagr_label -from google.ads.googleads.v6.resources.types import ( - landing_page_view as gagr_landing_page_view, -) -from google.ads.googleads.v6.resources.types import ( - language_constant as gagr_language_constant, -) -from google.ads.googleads.v6.resources.types import ( - location_view as gagr_location_view, -) -from google.ads.googleads.v6.resources.types import ( - managed_placement_view as gagr_managed_placement_view, -) -from google.ads.googleads.v6.resources.types import ( - media_file as gagr_media_file, -) -from google.ads.googleads.v6.resources.types import ( - mobile_app_category_constant as gagr_mobile_app_category_constant, -) -from google.ads.googleads.v6.resources.types import ( - mobile_device_constant as gagr_mobile_device_constant, -) -from google.ads.googleads.v6.resources.types import ( - offline_user_data_job as gagr_offline_user_data_job, -) -from google.ads.googleads.v6.resources.types import ( - operating_system_version_constant as gagr_operating_system_version_constant, -) -from google.ads.googleads.v6.resources.types import ( - paid_organic_search_term_view as gagr_paid_organic_search_term_view, -) -from google.ads.googleads.v6.resources.types import ( - parental_status_view as gagr_parental_status_view, -) -from google.ads.googleads.v6.resources.types import ( - product_bidding_category_constant as gagr_product_bidding_category_constant, -) -from google.ads.googleads.v6.resources.types import ( - product_group_view as gagr_product_group_view, -) -from google.ads.googleads.v6.resources.types import ( - recommendation as gagr_recommendation, -) -from google.ads.googleads.v6.resources.types import ( - remarketing_action as gagr_remarketing_action, -) -from google.ads.googleads.v6.resources.types import ( - search_term_view as gagr_search_term_view, -) -from google.ads.googleads.v6.resources.types import ( - shared_criterion as gagr_shared_criterion, -) -from google.ads.googleads.v6.resources.types import ( - shared_set as gagr_shared_set, -) -from google.ads.googleads.v6.resources.types import ( - shopping_performance_view as gagr_shopping_performance_view, -) -from google.ads.googleads.v6.resources.types import ( - third_party_app_analytics_link as gagr_third_party_app_analytics_link, -) -from google.ads.googleads.v6.resources.types import ( - topic_constant as gagr_topic_constant, -) -from google.ads.googleads.v6.resources.types import ( - topic_view as gagr_topic_view, -) -from google.ads.googleads.v6.resources.types import ( - user_interest as gagr_user_interest, -) -from google.ads.googleads.v6.resources.types import user_list as gagr_user_list -from google.ads.googleads.v6.resources.types import ( - user_location_view as gagr_user_location_view, -) -from google.ads.googleads.v6.resources.types import video as gagr_video -from google.ads.googleads.v6.services.types import ad_group_ad_label_service -from google.ads.googleads.v6.services.types import ad_group_ad_service -from google.ads.googleads.v6.services.types import ad_group_bid_modifier_service -from google.ads.googleads.v6.services.types import ( - ad_group_criterion_label_service, -) -from google.ads.googleads.v6.services.types import ad_group_criterion_service -from google.ads.googleads.v6.services.types import ( - ad_group_extension_setting_service, -) -from google.ads.googleads.v6.services.types import ad_group_feed_service -from google.ads.googleads.v6.services.types import ad_group_label_service -from google.ads.googleads.v6.services.types import ad_group_service -from google.ads.googleads.v6.services.types import ad_parameter_service -from google.ads.googleads.v6.services.types import ad_service -from google.ads.googleads.v6.services.types import asset_service -from google.ads.googleads.v6.services.types import bidding_strategy_service -from google.ads.googleads.v6.services.types import campaign_asset_service -from google.ads.googleads.v6.services.types import campaign_bid_modifier_service -from google.ads.googleads.v6.services.types import campaign_budget_service -from google.ads.googleads.v6.services.types import campaign_criterion_service -from google.ads.googleads.v6.services.types import campaign_draft_service -from google.ads.googleads.v6.services.types import campaign_experiment_service -from google.ads.googleads.v6.services.types import ( - campaign_extension_setting_service, -) -from google.ads.googleads.v6.services.types import campaign_feed_service -from google.ads.googleads.v6.services.types import campaign_label_service -from google.ads.googleads.v6.services.types import campaign_service -from google.ads.googleads.v6.services.types import campaign_shared_set_service -from google.ads.googleads.v6.services.types import conversion_action_service -from google.ads.googleads.v6.services.types import ( - customer_extension_setting_service, -) -from google.ads.googleads.v6.services.types import customer_feed_service -from google.ads.googleads.v6.services.types import customer_label_service -from google.ads.googleads.v6.services.types import ( - customer_negative_criterion_service, -) -from google.ads.googleads.v6.services.types import customer_service -from google.ads.googleads.v6.services.types import extension_feed_item_service -from google.ads.googleads.v6.services.types import feed_item_service -from google.ads.googleads.v6.services.types import feed_item_set_link_service -from google.ads.googleads.v6.services.types import feed_item_set_service -from google.ads.googleads.v6.services.types import feed_item_target_service -from google.ads.googleads.v6.services.types import feed_mapping_service -from google.ads.googleads.v6.services.types import feed_service -from google.ads.googleads.v6.services.types import ( - keyword_plan_ad_group_keyword_service, -) -from google.ads.googleads.v6.services.types import keyword_plan_ad_group_service -from google.ads.googleads.v6.services.types import ( - keyword_plan_campaign_keyword_service, -) -from google.ads.googleads.v6.services.types import keyword_plan_campaign_service -from google.ads.googleads.v6.services.types import keyword_plan_service -from google.ads.googleads.v6.services.types import label_service -from google.ads.googleads.v6.services.types import media_file_service -from google.ads.googleads.v6.services.types import remarketing_action_service -from google.ads.googleads.v6.services.types import shared_criterion_service -from google.ads.googleads.v6.services.types import shared_set_service -from google.ads.googleads.v6.services.types import user_list_service -from google.protobuf import field_mask_pb2 as gp_field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "SearchGoogleAdsRequest", - "SearchGoogleAdsResponse", - "SearchGoogleAdsStreamRequest", - "SearchGoogleAdsStreamResponse", - "GoogleAdsRow", - "MutateGoogleAdsRequest", - "MutateGoogleAdsResponse", - "MutateOperation", - "MutateOperationResponse", - }, -) - - -class SearchGoogleAdsRequest(proto.Message): - r"""Request message for - [GoogleAdsService.Search][google.ads.googleads.v6.services.GoogleAdsService.Search]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - queried. - query (str): - Required. The query string. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. Use the value obtained - from ``next_page_token`` in the previous response in order - to request the next page of results. - page_size (int): - Number of elements to retrieve in a single - page. When too large a page is requested, the - server may decide to further limit the number of - returned resources. - validate_only (bool): - If true, the request is validated but not - executed. - return_total_results_count (bool): - If true, the total number of results that - match the query ignoring the LIMIT clause will - be included in the response. Default is false. - summary_row_setting (google.ads.googleads.v6.enums.types.SummaryRowSettingEnum.SummaryRowSetting): - Determines whether a summary row will be - returned. By default, summary row is not - returned. If requested, the summary row will be - sent in a response by itself after all other - query results are returned. - """ - - customer_id = proto.Field(proto.STRING, number=1) - query = proto.Field(proto.STRING, number=2) - page_token = proto.Field(proto.STRING, number=3) - page_size = proto.Field(proto.INT32, number=4) - validate_only = proto.Field(proto.BOOL, number=5) - return_total_results_count = proto.Field(proto.BOOL, number=7) - summary_row_setting = proto.Field( - proto.ENUM, - number=8, - enum=gage_summary_row_setting.SummaryRowSettingEnum.SummaryRowSetting, - ) - - -class SearchGoogleAdsResponse(proto.Message): - r"""Response message for - [GoogleAdsService.Search][google.ads.googleads.v6.services.GoogleAdsService.Search]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.GoogleAdsRow]): - The list of rows that matched the query. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - total_results_count (int): - Total number of results that match the query - ignoring the LIMIT clause. - field_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that represents what fields were - requested by the user. - summary_row (google.ads.googleads.v6.services.types.GoogleAdsRow): - Summary row that contains summary of metrics - in results. Summary of metrics means aggregation - of metrics across all results, here aggregation - could be sum, average, rate, etc. - """ - - @property - def raw_page(self): - return self - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="GoogleAdsRow", - ) - next_page_token = proto.Field(proto.STRING, number=2) - total_results_count = proto.Field(proto.INT64, number=3) - field_mask = proto.Field( - proto.MESSAGE, number=5, message=gp_field_mask.FieldMask, - ) - summary_row = proto.Field(proto.MESSAGE, number=6, message="GoogleAdsRow",) - - -class SearchGoogleAdsStreamRequest(proto.Message): - r"""Request message for - [GoogleAdsService.SearchStream][google.ads.googleads.v6.services.GoogleAdsService.SearchStream]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - queried. - query (str): - Required. The query string. - summary_row_setting (google.ads.googleads.v6.enums.types.SummaryRowSettingEnum.SummaryRowSetting): - Determines whether a summary row will be - returned. By default, summary row is not - returned. If requested, the summary row will be - sent in a response by itself after all other - query results are returned. - """ - - customer_id = proto.Field(proto.STRING, number=1) - query = proto.Field(proto.STRING, number=2) - summary_row_setting = proto.Field( - proto.ENUM, - number=3, - enum=gage_summary_row_setting.SummaryRowSettingEnum.SummaryRowSetting, - ) - - -class SearchGoogleAdsStreamResponse(proto.Message): - r"""Response message for - [GoogleAdsService.SearchStream][google.ads.googleads.v6.services.GoogleAdsService.SearchStream]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.GoogleAdsRow]): - The list of rows that matched the query. - field_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that represents what fields were - requested by the user. - summary_row (google.ads.googleads.v6.services.types.GoogleAdsRow): - Summary row that contains summary of metrics - in results. Summary of metrics means aggregation - of metrics across all results, here aggregation - could be sum, average, rate, etc. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="GoogleAdsRow", - ) - field_mask = proto.Field( - proto.MESSAGE, number=2, message=gp_field_mask.FieldMask, - ) - summary_row = proto.Field(proto.MESSAGE, number=3, message="GoogleAdsRow",) - - -class GoogleAdsRow(proto.Message): - r"""A returned row from the query. - - Attributes: - account_budget (google.ads.googleads.v6.resources.types.AccountBudget): - The account budget in the query. - account_budget_proposal (google.ads.googleads.v6.resources.types.AccountBudgetProposal): - The account budget proposal referenced in the - query. - account_link (google.ads.googleads.v6.resources.types.AccountLink): - The AccountLink referenced in the query. - ad_group (google.ads.googleads.v6.resources.types.AdGroup): - The ad group referenced in the query. - ad_group_ad (google.ads.googleads.v6.resources.types.AdGroupAd): - The ad referenced in the query. - ad_group_ad_asset_view (google.ads.googleads.v6.resources.types.AdGroupAdAssetView): - The ad group ad asset view in the query. - ad_group_ad_label (google.ads.googleads.v6.resources.types.AdGroupAdLabel): - The ad group ad label referenced in the - query. - ad_group_audience_view (google.ads.googleads.v6.resources.types.AdGroupAudienceView): - The ad group audience view referenced in the - query. - ad_group_bid_modifier (google.ads.googleads.v6.resources.types.AdGroupBidModifier): - The bid modifier referenced in the query. - ad_group_criterion (google.ads.googleads.v6.resources.types.AdGroupCriterion): - The criterion referenced in the query. - ad_group_criterion_label (google.ads.googleads.v6.resources.types.AdGroupCriterionLabel): - The ad group criterion label referenced in - the query. - ad_group_criterion_simulation (google.ads.googleads.v6.resources.types.AdGroupCriterionSimulation): - The ad group criterion simulation referenced - in the query. - ad_group_extension_setting (google.ads.googleads.v6.resources.types.AdGroupExtensionSetting): - The ad group extension setting referenced in - the query. - ad_group_feed (google.ads.googleads.v6.resources.types.AdGroupFeed): - The ad group feed referenced in the query. - ad_group_label (google.ads.googleads.v6.resources.types.AdGroupLabel): - The ad group label referenced in the query. - ad_group_simulation (google.ads.googleads.v6.resources.types.AdGroupSimulation): - The ad group simulation referenced in the - query. - ad_parameter (google.ads.googleads.v6.resources.types.AdParameter): - The ad parameter referenced in the query. - age_range_view (google.ads.googleads.v6.resources.types.AgeRangeView): - The age range view referenced in the query. - ad_schedule_view (google.ads.googleads.v6.resources.types.AdScheduleView): - The ad schedule view referenced in the query. - domain_category (google.ads.googleads.v6.resources.types.DomainCategory): - The domain category referenced in the query. - asset (google.ads.googleads.v6.resources.types.Asset): - The asset referenced in the query. - batch_job (google.ads.googleads.v6.resources.types.BatchJob): - The batch job referenced in the query. - bidding_strategy (google.ads.googleads.v6.resources.types.BiddingStrategy): - The bidding strategy referenced in the query. - billing_setup (google.ads.googleads.v6.resources.types.BillingSetup): - The billing setup referenced in the query. - call_view (google.ads.googleads.v6.resources.types.CallView): - The call view referenced in the query. - campaign_budget (google.ads.googleads.v6.resources.types.CampaignBudget): - The campaign budget referenced in the query. - campaign (google.ads.googleads.v6.resources.types.Campaign): - The campaign referenced in the query. - campaign_asset (google.ads.googleads.v6.resources.types.CampaignAsset): - The campaign asset referenced in the query. - campaign_audience_view (google.ads.googleads.v6.resources.types.CampaignAudienceView): - The campaign audience view referenced in the - query. - campaign_bid_modifier (google.ads.googleads.v6.resources.types.CampaignBidModifier): - The campaign bid modifier referenced in the - query. - campaign_criterion (google.ads.googleads.v6.resources.types.CampaignCriterion): - The campaign criterion referenced in the - query. - campaign_criterion_simulation (google.ads.googleads.v6.resources.types.CampaignCriterionSimulation): - The campaign criterion simulation referenced - in the query. - campaign_draft (google.ads.googleads.v6.resources.types.CampaignDraft): - The campaign draft referenced in the query. - campaign_experiment (google.ads.googleads.v6.resources.types.CampaignExperiment): - The campaign experiment referenced in the - query. - campaign_extension_setting (google.ads.googleads.v6.resources.types.CampaignExtensionSetting): - The campaign extension setting referenced in - the query. - campaign_feed (google.ads.googleads.v6.resources.types.CampaignFeed): - The campaign feed referenced in the query. - campaign_label (google.ads.googleads.v6.resources.types.CampaignLabel): - The campaign label referenced in the query. - campaign_shared_set (google.ads.googleads.v6.resources.types.CampaignSharedSet): - Campaign Shared Set referenced in AWQL query. - carrier_constant (google.ads.googleads.v6.resources.types.CarrierConstant): - The carrier constant referenced in the query. - change_event (google.ads.googleads.v6.resources.types.ChangeEvent): - The ChangeEvent referenced in the query. - change_status (google.ads.googleads.v6.resources.types.ChangeStatus): - The ChangeStatus referenced in the query. - combined_audience (google.ads.googleads.v6.resources.types.CombinedAudience): - The CombinedAudience referenced in the query. - conversion_action (google.ads.googleads.v6.resources.types.ConversionAction): - The conversion action referenced in the - query. - click_view (google.ads.googleads.v6.resources.types.ClickView): - The ClickView referenced in the query. - currency_constant (google.ads.googleads.v6.resources.types.CurrencyConstant): - The currency constant referenced in the - query. - custom_audience (google.ads.googleads.v6.resources.types.CustomAudience): - The CustomAudience referenced in the query. - custom_interest (google.ads.googleads.v6.resources.types.CustomInterest): - The CustomInterest referenced in the query. - customer (google.ads.googleads.v6.resources.types.Customer): - The customer referenced in the query. - customer_manager_link (google.ads.googleads.v6.resources.types.CustomerManagerLink): - The CustomerManagerLink referenced in the - query. - customer_client_link (google.ads.googleads.v6.resources.types.CustomerClientLink): - The CustomerClientLink referenced in the - query. - customer_client (google.ads.googleads.v6.resources.types.CustomerClient): - The CustomerClient referenced in the query. - customer_extension_setting (google.ads.googleads.v6.resources.types.CustomerExtensionSetting): - The customer extension setting referenced in - the query. - customer_feed (google.ads.googleads.v6.resources.types.CustomerFeed): - The customer feed referenced in the query. - customer_label (google.ads.googleads.v6.resources.types.CustomerLabel): - The customer label referenced in the query. - customer_negative_criterion (google.ads.googleads.v6.resources.types.CustomerNegativeCriterion): - The customer negative criterion referenced in - the query. - customer_user_access (google.ads.googleads.v6.resources.types.CustomerUserAccess): - The CustomerUserAccess referenced in the - query. - customer_user_access_invitation (google.ads.googleads.v6.resources.types.CustomerUserAccessInvitation): - The CustomerUserAccessInvitation referenced - in the query. - detail_placement_view (google.ads.googleads.v6.resources.types.DetailPlacementView): - The detail placement view referenced in the - query. - display_keyword_view (google.ads.googleads.v6.resources.types.DisplayKeywordView): - The display keyword view referenced in the - query. - distance_view (google.ads.googleads.v6.resources.types.DistanceView): - The distance view referenced in the query. - dynamic_search_ads_search_term_view (google.ads.googleads.v6.resources.types.DynamicSearchAdsSearchTermView): - The dynamic search ads search term view - referenced in the query. - expanded_landing_page_view (google.ads.googleads.v6.resources.types.ExpandedLandingPageView): - The expanded landing page view referenced in - the query. - extension_feed_item (google.ads.googleads.v6.resources.types.ExtensionFeedItem): - The extension feed item referenced in the - query. - feed (google.ads.googleads.v6.resources.types.Feed): - The feed referenced in the query. - feed_item (google.ads.googleads.v6.resources.types.FeedItem): - The feed item referenced in the query. - feed_item_set (google.ads.googleads.v6.resources.types.FeedItemSet): - The feed item set referenced in the query. - feed_item_set_link (google.ads.googleads.v6.resources.types.FeedItemSetLink): - The feed item set link referenced in the - query. - feed_item_target (google.ads.googleads.v6.resources.types.FeedItemTarget): - The feed item target referenced in the query. - feed_mapping (google.ads.googleads.v6.resources.types.FeedMapping): - The feed mapping referenced in the query. - feed_placeholder_view (google.ads.googleads.v6.resources.types.FeedPlaceholderView): - The feed placeholder view referenced in the - query. - gender_view (google.ads.googleads.v6.resources.types.GenderView): - The gender view referenced in the query. - geo_target_constant (google.ads.googleads.v6.resources.types.GeoTargetConstant): - The geo target constant referenced in the - query. - geographic_view (google.ads.googleads.v6.resources.types.GeographicView): - The geographic view referenced in the query. - group_placement_view (google.ads.googleads.v6.resources.types.GroupPlacementView): - The group placement view referenced in the - query. - hotel_group_view (google.ads.googleads.v6.resources.types.HotelGroupView): - The hotel group view referenced in the query. - hotel_performance_view (google.ads.googleads.v6.resources.types.HotelPerformanceView): - The hotel performance view referenced in the - query. - income_range_view (google.ads.googleads.v6.resources.types.IncomeRangeView): - The income range view referenced in the - query. - keyword_view (google.ads.googleads.v6.resources.types.KeywordView): - The keyword view referenced in the query. - keyword_plan (google.ads.googleads.v6.resources.types.KeywordPlan): - The keyword plan referenced in the query. - keyword_plan_campaign (google.ads.googleads.v6.resources.types.KeywordPlanCampaign): - The keyword plan campaign referenced in the - query. - keyword_plan_campaign_keyword (google.ads.googleads.v6.resources.types.KeywordPlanCampaignKeyword): - The keyword plan campaign keyword referenced - in the query. - keyword_plan_ad_group (google.ads.googleads.v6.resources.types.KeywordPlanAdGroup): - The keyword plan ad group referenced in the - query. - keyword_plan_ad_group_keyword (google.ads.googleads.v6.resources.types.KeywordPlanAdGroupKeyword): - The keyword plan ad group referenced in the - query. - label (google.ads.googleads.v6.resources.types.Label): - The label referenced in the query. - landing_page_view (google.ads.googleads.v6.resources.types.LandingPageView): - The landing page view referenced in the - query. - language_constant (google.ads.googleads.v6.resources.types.LanguageConstant): - The language constant referenced in the - query. - location_view (google.ads.googleads.v6.resources.types.LocationView): - The location view referenced in the query. - managed_placement_view (google.ads.googleads.v6.resources.types.ManagedPlacementView): - The managed placement view referenced in the - query. - media_file (google.ads.googleads.v6.resources.types.MediaFile): - The media file referenced in the query. - mobile_app_category_constant (google.ads.googleads.v6.resources.types.MobileAppCategoryConstant): - The mobile app category constant referenced - in the query. - mobile_device_constant (google.ads.googleads.v6.resources.types.MobileDeviceConstant): - The mobile device constant referenced in the - query. - offline_user_data_job (google.ads.googleads.v6.resources.types.OfflineUserDataJob): - The offline user data job referenced in the - query. - operating_system_version_constant (google.ads.googleads.v6.resources.types.OperatingSystemVersionConstant): - The operating system version constant - referenced in the query. - paid_organic_search_term_view (google.ads.googleads.v6.resources.types.PaidOrganicSearchTermView): - The paid organic search term view referenced - in the query. - parental_status_view (google.ads.googleads.v6.resources.types.ParentalStatusView): - The parental status view referenced in the - query. - product_bidding_category_constant (google.ads.googleads.v6.resources.types.ProductBiddingCategoryConstant): - The Product Bidding Category referenced in - the query. - product_group_view (google.ads.googleads.v6.resources.types.ProductGroupView): - The product group view referenced in the - query. - recommendation (google.ads.googleads.v6.resources.types.Recommendation): - The recommendation referenced in the query. - search_term_view (google.ads.googleads.v6.resources.types.SearchTermView): - The search term view referenced in the query. - shared_criterion (google.ads.googleads.v6.resources.types.SharedCriterion): - The shared set referenced in the query. - shared_set (google.ads.googleads.v6.resources.types.SharedSet): - The shared set referenced in the query. - shopping_performance_view (google.ads.googleads.v6.resources.types.ShoppingPerformanceView): - The shopping performance view referenced in - the query. - third_party_app_analytics_link (google.ads.googleads.v6.resources.types.ThirdPartyAppAnalyticsLink): - The AccountLink referenced in the query. - topic_view (google.ads.googleads.v6.resources.types.TopicView): - The topic view referenced in the query. - user_interest (google.ads.googleads.v6.resources.types.UserInterest): - The user interest referenced in the query. - user_list (google.ads.googleads.v6.resources.types.UserList): - The user list referenced in the query. - user_location_view (google.ads.googleads.v6.resources.types.UserLocationView): - The user location view referenced in the - query. - remarketing_action (google.ads.googleads.v6.resources.types.RemarketingAction): - The remarketing action referenced in the - query. - topic_constant (google.ads.googleads.v6.resources.types.TopicConstant): - The topic constant referenced in the query. - video (google.ads.googleads.v6.resources.types.Video): - The video referenced in the query. - metrics (google.ads.googleads.v6.common.types.Metrics): - The metrics. - segments (google.ads.googleads.v6.common.types.Segments): - The segments. - """ - - account_budget = proto.Field( - proto.MESSAGE, number=42, message=gagr_account_budget.AccountBudget, - ) - account_budget_proposal = proto.Field( - proto.MESSAGE, - number=43, - message=gagr_account_budget_proposal.AccountBudgetProposal, - ) - account_link = proto.Field( - proto.MESSAGE, number=143, message=gagr_account_link.AccountLink, - ) - ad_group = proto.Field( - proto.MESSAGE, number=3, message=gagr_ad_group.AdGroup, - ) - ad_group_ad = proto.Field( - proto.MESSAGE, number=16, message=gagr_ad_group_ad.AdGroupAd, - ) - ad_group_ad_asset_view = proto.Field( - proto.MESSAGE, - number=131, - message=gagr_ad_group_ad_asset_view.AdGroupAdAssetView, - ) - ad_group_ad_label = proto.Field( - proto.MESSAGE, - number=120, - message=gagr_ad_group_ad_label.AdGroupAdLabel, - ) - ad_group_audience_view = proto.Field( - proto.MESSAGE, - number=57, - message=gagr_ad_group_audience_view.AdGroupAudienceView, - ) - ad_group_bid_modifier = proto.Field( - proto.MESSAGE, - number=24, - message=gagr_ad_group_bid_modifier.AdGroupBidModifier, - ) - ad_group_criterion = proto.Field( - proto.MESSAGE, - number=17, - message=gagr_ad_group_criterion.AdGroupCriterion, - ) - ad_group_criterion_label = proto.Field( - proto.MESSAGE, - number=121, - message=gagr_ad_group_criterion_label.AdGroupCriterionLabel, - ) - ad_group_criterion_simulation = proto.Field( - proto.MESSAGE, - number=110, - message=gagr_ad_group_criterion_simulation.AdGroupCriterionSimulation, - ) - ad_group_extension_setting = proto.Field( - proto.MESSAGE, - number=112, - message=gagr_ad_group_extension_setting.AdGroupExtensionSetting, - ) - ad_group_feed = proto.Field( - proto.MESSAGE, number=67, message=gagr_ad_group_feed.AdGroupFeed, - ) - ad_group_label = proto.Field( - proto.MESSAGE, number=115, message=gagr_ad_group_label.AdGroupLabel, - ) - ad_group_simulation = proto.Field( - proto.MESSAGE, - number=107, - message=gagr_ad_group_simulation.AdGroupSimulation, - ) - ad_parameter = proto.Field( - proto.MESSAGE, number=130, message=gagr_ad_parameter.AdParameter, - ) - age_range_view = proto.Field( - proto.MESSAGE, number=48, message=gagr_age_range_view.AgeRangeView, - ) - ad_schedule_view = proto.Field( - proto.MESSAGE, number=89, message=gagr_ad_schedule_view.AdScheduleView, - ) - domain_category = proto.Field( - proto.MESSAGE, number=91, message=gagr_domain_category.DomainCategory, - ) - asset = proto.Field(proto.MESSAGE, number=105, message=gagr_asset.Asset,) - batch_job = proto.Field( - proto.MESSAGE, number=139, message=gagr_batch_job.BatchJob, - ) - bidding_strategy = proto.Field( - proto.MESSAGE, number=18, message=gagr_bidding_strategy.BiddingStrategy, - ) - billing_setup = proto.Field( - proto.MESSAGE, number=41, message=gagr_billing_setup.BillingSetup, - ) - call_view = proto.Field( - proto.MESSAGE, number=152, message=gagr_call_view.CallView, - ) - campaign_budget = proto.Field( - proto.MESSAGE, number=19, message=gagr_campaign_budget.CampaignBudget, - ) - campaign = proto.Field( - proto.MESSAGE, number=2, message=gagr_campaign.Campaign, - ) - campaign_asset = proto.Field( - proto.MESSAGE, number=142, message=gagr_campaign_asset.CampaignAsset, - ) - campaign_audience_view = proto.Field( - proto.MESSAGE, - number=69, - message=gagr_campaign_audience_view.CampaignAudienceView, - ) - campaign_bid_modifier = proto.Field( - proto.MESSAGE, - number=26, - message=gagr_campaign_bid_modifier.CampaignBidModifier, - ) - campaign_criterion = proto.Field( - proto.MESSAGE, - number=20, - message=gagr_campaign_criterion.CampaignCriterion, - ) - campaign_criterion_simulation = proto.Field( - proto.MESSAGE, - number=111, - message=gagr_campaign_criterion_simulation.CampaignCriterionSimulation, - ) - campaign_draft = proto.Field( - proto.MESSAGE, number=49, message=gagr_campaign_draft.CampaignDraft, - ) - campaign_experiment = proto.Field( - proto.MESSAGE, - number=84, - message=gagr_campaign_experiment.CampaignExperiment, - ) - campaign_extension_setting = proto.Field( - proto.MESSAGE, - number=113, - message=gagr_campaign_extension_setting.CampaignExtensionSetting, - ) - campaign_feed = proto.Field( - proto.MESSAGE, number=63, message=gagr_campaign_feed.CampaignFeed, - ) - campaign_label = proto.Field( - proto.MESSAGE, number=108, message=gagr_campaign_label.CampaignLabel, - ) - campaign_shared_set = proto.Field( - proto.MESSAGE, - number=30, - message=gagr_campaign_shared_set.CampaignSharedSet, - ) - carrier_constant = proto.Field( - proto.MESSAGE, number=66, message=gagr_carrier_constant.CarrierConstant, - ) - change_event = proto.Field( - proto.MESSAGE, number=145, message=gagr_change_event.ChangeEvent, - ) - change_status = proto.Field( - proto.MESSAGE, number=37, message=gagr_change_status.ChangeStatus, - ) - combined_audience = proto.Field( - proto.MESSAGE, - number=148, - message=gagr_combined_audience.CombinedAudience, - ) - conversion_action = proto.Field( - proto.MESSAGE, - number=103, - message=gagr_conversion_action.ConversionAction, - ) - click_view = proto.Field( - proto.MESSAGE, number=122, message=gagr_click_view.ClickView, - ) - currency_constant = proto.Field( - proto.MESSAGE, - number=134, - message=gagr_currency_constant.CurrencyConstant, - ) - custom_audience = proto.Field( - proto.MESSAGE, number=147, message=gagr_custom_audience.CustomAudience, - ) - custom_interest = proto.Field( - proto.MESSAGE, number=104, message=gagr_custom_interest.CustomInterest, - ) - customer = proto.Field( - proto.MESSAGE, number=1, message=gagr_customer.Customer, - ) - customer_manager_link = proto.Field( - proto.MESSAGE, - number=61, - message=gagr_customer_manager_link.CustomerManagerLink, - ) - customer_client_link = proto.Field( - proto.MESSAGE, - number=62, - message=gagr_customer_client_link.CustomerClientLink, - ) - customer_client = proto.Field( - proto.MESSAGE, number=70, message=gagr_customer_client.CustomerClient, - ) - customer_extension_setting = proto.Field( - proto.MESSAGE, - number=114, - message=gagr_customer_extension_setting.CustomerExtensionSetting, - ) - customer_feed = proto.Field( - proto.MESSAGE, number=64, message=gagr_customer_feed.CustomerFeed, - ) - customer_label = proto.Field( - proto.MESSAGE, number=124, message=gagr_customer_label.CustomerLabel, - ) - customer_negative_criterion = proto.Field( - proto.MESSAGE, - number=88, - message=gagr_customer_negative_criterion.CustomerNegativeCriterion, - ) - customer_user_access = proto.Field( - proto.MESSAGE, - number=146, - message=gagr_customer_user_access.CustomerUserAccess, - ) - customer_user_access_invitation = proto.Field( - proto.MESSAGE, - number=150, - message=gagr_customer_user_access_invitation.CustomerUserAccessInvitation, - ) - detail_placement_view = proto.Field( - proto.MESSAGE, - number=118, - message=gagr_detail_placement_view.DetailPlacementView, - ) - display_keyword_view = proto.Field( - proto.MESSAGE, - number=47, - message=gagr_display_keyword_view.DisplayKeywordView, - ) - distance_view = proto.Field( - proto.MESSAGE, number=132, message=gagr_distance_view.DistanceView, - ) - dynamic_search_ads_search_term_view = proto.Field( - proto.MESSAGE, - number=106, - message=gagr_dynamic_search_ads_search_term_view.DynamicSearchAdsSearchTermView, - ) - expanded_landing_page_view = proto.Field( - proto.MESSAGE, - number=128, - message=gagr_expanded_landing_page_view.ExpandedLandingPageView, - ) - extension_feed_item = proto.Field( - proto.MESSAGE, - number=85, - message=gagr_extension_feed_item.ExtensionFeedItem, - ) - feed = proto.Field(proto.MESSAGE, number=46, message=gagr_feed.Feed,) - feed_item = proto.Field( - proto.MESSAGE, number=50, message=gagr_feed_item.FeedItem, - ) - feed_item_set = proto.Field( - proto.MESSAGE, number=149, message=gagr_feed_item_set.FeedItemSet, - ) - feed_item_set_link = proto.Field( - proto.MESSAGE, - number=151, - message=gagr_feed_item_set_link.FeedItemSetLink, - ) - feed_item_target = proto.Field( - proto.MESSAGE, number=116, message=gagr_feed_item_target.FeedItemTarget, - ) - feed_mapping = proto.Field( - proto.MESSAGE, number=58, message=gagr_feed_mapping.FeedMapping, - ) - feed_placeholder_view = proto.Field( - proto.MESSAGE, - number=97, - message=gagr_feed_placeholder_view.FeedPlaceholderView, - ) - gender_view = proto.Field( - proto.MESSAGE, number=40, message=gagr_gender_view.GenderView, - ) - geo_target_constant = proto.Field( - proto.MESSAGE, - number=23, - message=gagr_geo_target_constant.GeoTargetConstant, - ) - geographic_view = proto.Field( - proto.MESSAGE, number=125, message=gagr_geographic_view.GeographicView, - ) - group_placement_view = proto.Field( - proto.MESSAGE, - number=119, - message=gagr_group_placement_view.GroupPlacementView, - ) - hotel_group_view = proto.Field( - proto.MESSAGE, number=51, message=gagr_hotel_group_view.HotelGroupView, - ) - hotel_performance_view = proto.Field( - proto.MESSAGE, - number=71, - message=gagr_hotel_performance_view.HotelPerformanceView, - ) - income_range_view = proto.Field( - proto.MESSAGE, - number=138, - message=gagr_income_range_view.IncomeRangeView, - ) - keyword_view = proto.Field( - proto.MESSAGE, number=21, message=gagr_keyword_view.KeywordView, - ) - keyword_plan = proto.Field( - proto.MESSAGE, number=32, message=gagr_keyword_plan.KeywordPlan, - ) - keyword_plan_campaign = proto.Field( - proto.MESSAGE, - number=33, - message=gagr_keyword_plan_campaign.KeywordPlanCampaign, - ) - keyword_plan_campaign_keyword = proto.Field( - proto.MESSAGE, - number=140, - message=gagr_keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword, - ) - keyword_plan_ad_group = proto.Field( - proto.MESSAGE, - number=35, - message=gagr_keyword_plan_ad_group.KeywordPlanAdGroup, - ) - keyword_plan_ad_group_keyword = proto.Field( - proto.MESSAGE, - number=141, - message=gagr_keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword, - ) - label = proto.Field(proto.MESSAGE, number=52, message=gagr_label.Label,) - landing_page_view = proto.Field( - proto.MESSAGE, - number=126, - message=gagr_landing_page_view.LandingPageView, - ) - language_constant = proto.Field( - proto.MESSAGE, - number=55, - message=gagr_language_constant.LanguageConstant, - ) - location_view = proto.Field( - proto.MESSAGE, number=123, message=gagr_location_view.LocationView, - ) - managed_placement_view = proto.Field( - proto.MESSAGE, - number=53, - message=gagr_managed_placement_view.ManagedPlacementView, - ) - media_file = proto.Field( - proto.MESSAGE, number=90, message=gagr_media_file.MediaFile, - ) - mobile_app_category_constant = proto.Field( - proto.MESSAGE, - number=87, - message=gagr_mobile_app_category_constant.MobileAppCategoryConstant, - ) - mobile_device_constant = proto.Field( - proto.MESSAGE, - number=98, - message=gagr_mobile_device_constant.MobileDeviceConstant, - ) - offline_user_data_job = proto.Field( - proto.MESSAGE, - number=137, - message=gagr_offline_user_data_job.OfflineUserDataJob, - ) - operating_system_version_constant = proto.Field( - proto.MESSAGE, - number=86, - message=gagr_operating_system_version_constant.OperatingSystemVersionConstant, - ) - paid_organic_search_term_view = proto.Field( - proto.MESSAGE, - number=129, - message=gagr_paid_organic_search_term_view.PaidOrganicSearchTermView, - ) - parental_status_view = proto.Field( - proto.MESSAGE, - number=45, - message=gagr_parental_status_view.ParentalStatusView, - ) - product_bidding_category_constant = proto.Field( - proto.MESSAGE, - number=109, - message=gagr_product_bidding_category_constant.ProductBiddingCategoryConstant, - ) - product_group_view = proto.Field( - proto.MESSAGE, - number=54, - message=gagr_product_group_view.ProductGroupView, - ) - recommendation = proto.Field( - proto.MESSAGE, number=22, message=gagr_recommendation.Recommendation, - ) - search_term_view = proto.Field( - proto.MESSAGE, number=68, message=gagr_search_term_view.SearchTermView, - ) - shared_criterion = proto.Field( - proto.MESSAGE, number=29, message=gagr_shared_criterion.SharedCriterion, - ) - shared_set = proto.Field( - proto.MESSAGE, number=27, message=gagr_shared_set.SharedSet, - ) - shopping_performance_view = proto.Field( - proto.MESSAGE, - number=117, - message=gagr_shopping_performance_view.ShoppingPerformanceView, - ) - third_party_app_analytics_link = proto.Field( - proto.MESSAGE, - number=144, - message=gagr_third_party_app_analytics_link.ThirdPartyAppAnalyticsLink, - ) - topic_view = proto.Field( - proto.MESSAGE, number=44, message=gagr_topic_view.TopicView, - ) - user_interest = proto.Field( - proto.MESSAGE, number=59, message=gagr_user_interest.UserInterest, - ) - user_list = proto.Field( - proto.MESSAGE, number=38, message=gagr_user_list.UserList, - ) - user_location_view = proto.Field( - proto.MESSAGE, - number=135, - message=gagr_user_location_view.UserLocationView, - ) - remarketing_action = proto.Field( - proto.MESSAGE, - number=60, - message=gagr_remarketing_action.RemarketingAction, - ) - topic_constant = proto.Field( - proto.MESSAGE, number=31, message=gagr_topic_constant.TopicConstant, - ) - video = proto.Field(proto.MESSAGE, number=39, message=gagr_video.Video,) - metrics = proto.Field( - proto.MESSAGE, number=4, message=gagc_metrics.Metrics, - ) - segments = proto.Field( - proto.MESSAGE, number=102, message=gagc_segments.Segments, - ) - - -class MutateGoogleAdsRequest(proto.Message): - r"""Request message for - [GoogleAdsService.Mutate][google.ads.googleads.v6.services.GoogleAdsService.Mutate]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - resources are being modified. - mutate_operations (Sequence[google.ads.googleads.v6.services.types.MutateOperation]): - Required. The list of operations to perform - on individual resources. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - The mutable resource will only be returned if - the resource has the appropriate response field. - E.g. MutateCampaignResult.campaign. - """ - - customer_id = proto.Field(proto.STRING, number=1) - mutate_operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class MutateGoogleAdsResponse(proto.Message): - r"""Response message for - [GoogleAdsService.Mutate][google.ads.googleads.v6.services.GoogleAdsService.Mutate]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g., auth errors), we return an RPC - level error. - mutate_operation_responses (Sequence[google.ads.googleads.v6.services.types.MutateOperationResponse]): - All responses for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - mutate_operation_responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="MutateOperationResponse", - ) - - -class MutateOperation(proto.Message): - r"""A single operation (create, update, remove) on a resource. - - Attributes: - ad_group_ad_label_operation (google.ads.googleads.v6.services.types.AdGroupAdLabelOperation): - An ad group ad label mutate operation. - ad_group_ad_operation (google.ads.googleads.v6.services.types.AdGroupAdOperation): - An ad group ad mutate operation. - ad_group_bid_modifier_operation (google.ads.googleads.v6.services.types.AdGroupBidModifierOperation): - An ad group bid modifier mutate operation. - ad_group_criterion_label_operation (google.ads.googleads.v6.services.types.AdGroupCriterionLabelOperation): - An ad group criterion label mutate operation. - ad_group_criterion_operation (google.ads.googleads.v6.services.types.AdGroupCriterionOperation): - An ad group criterion mutate operation. - ad_group_extension_setting_operation (google.ads.googleads.v6.services.types.AdGroupExtensionSettingOperation): - An ad group extension setting mutate - operation. - ad_group_feed_operation (google.ads.googleads.v6.services.types.AdGroupFeedOperation): - An ad group feed mutate operation. - ad_group_label_operation (google.ads.googleads.v6.services.types.AdGroupLabelOperation): - An ad group label mutate operation. - ad_group_operation (google.ads.googleads.v6.services.types.AdGroupOperation): - An ad group mutate operation. - ad_operation (google.ads.googleads.v6.services.types.AdOperation): - An ad mutate operation. - ad_parameter_operation (google.ads.googleads.v6.services.types.AdParameterOperation): - An ad parameter mutate operation. - asset_operation (google.ads.googleads.v6.services.types.AssetOperation): - An asset mutate operation. - bidding_strategy_operation (google.ads.googleads.v6.services.types.BiddingStrategyOperation): - A bidding strategy mutate operation. - campaign_asset_operation (google.ads.googleads.v6.services.types.CampaignAssetOperation): - A campaign asset mutate operation. - campaign_bid_modifier_operation (google.ads.googleads.v6.services.types.CampaignBidModifierOperation): - A campaign bid modifier mutate operation. - campaign_budget_operation (google.ads.googleads.v6.services.types.CampaignBudgetOperation): - A campaign budget mutate operation. - campaign_criterion_operation (google.ads.googleads.v6.services.types.CampaignCriterionOperation): - A campaign criterion mutate operation. - campaign_draft_operation (google.ads.googleads.v6.services.types.CampaignDraftOperation): - A campaign draft mutate operation. - campaign_experiment_operation (google.ads.googleads.v6.services.types.CampaignExperimentOperation): - A campaign experiment mutate operation. - campaign_extension_setting_operation (google.ads.googleads.v6.services.types.CampaignExtensionSettingOperation): - A campaign extension setting mutate - operation. - campaign_feed_operation (google.ads.googleads.v6.services.types.CampaignFeedOperation): - A campaign feed mutate operation. - campaign_label_operation (google.ads.googleads.v6.services.types.CampaignLabelOperation): - A campaign label mutate operation. - campaign_operation (google.ads.googleads.v6.services.types.CampaignOperation): - A campaign mutate operation. - campaign_shared_set_operation (google.ads.googleads.v6.services.types.CampaignSharedSetOperation): - A campaign shared set mutate operation. - conversion_action_operation (google.ads.googleads.v6.services.types.ConversionActionOperation): - A conversion action mutate operation. - customer_extension_setting_operation (google.ads.googleads.v6.services.types.CustomerExtensionSettingOperation): - A customer extension setting mutate - operation. - customer_feed_operation (google.ads.googleads.v6.services.types.CustomerFeedOperation): - A customer feed mutate operation. - customer_label_operation (google.ads.googleads.v6.services.types.CustomerLabelOperation): - A customer label mutate operation. - customer_negative_criterion_operation (google.ads.googleads.v6.services.types.CustomerNegativeCriterionOperation): - A customer negative criterion mutate - operation. - customer_operation (google.ads.googleads.v6.services.types.CustomerOperation): - A customer mutate operation. - extension_feed_item_operation (google.ads.googleads.v6.services.types.ExtensionFeedItemOperation): - An extension feed item mutate operation. - feed_item_operation (google.ads.googleads.v6.services.types.FeedItemOperation): - A feed item mutate operation. - feed_item_set_operation (google.ads.googleads.v6.services.types.FeedItemSetOperation): - A feed item set mutate operation. - feed_item_set_link_operation (google.ads.googleads.v6.services.types.FeedItemSetLinkOperation): - A feed item set link mutate operation. - feed_item_target_operation (google.ads.googleads.v6.services.types.FeedItemTargetOperation): - A feed item target mutate operation. - feed_mapping_operation (google.ads.googleads.v6.services.types.FeedMappingOperation): - A feed mapping mutate operation. - feed_operation (google.ads.googleads.v6.services.types.FeedOperation): - A feed mutate operation. - keyword_plan_ad_group_operation (google.ads.googleads.v6.services.types.KeywordPlanAdGroupOperation): - A keyword plan ad group operation. - keyword_plan_ad_group_keyword_operation (google.ads.googleads.v6.services.types.KeywordPlanAdGroupKeywordOperation): - A keyword plan ad group keyword operation. - keyword_plan_campaign_keyword_operation (google.ads.googleads.v6.services.types.KeywordPlanCampaignKeywordOperation): - A keyword plan campaign keyword operation. - keyword_plan_campaign_operation (google.ads.googleads.v6.services.types.KeywordPlanCampaignOperation): - A keyword plan campaign operation. - keyword_plan_operation (google.ads.googleads.v6.services.types.KeywordPlanOperation): - A keyword plan operation. - label_operation (google.ads.googleads.v6.services.types.LabelOperation): - A label mutate operation. - media_file_operation (google.ads.googleads.v6.services.types.MediaFileOperation): - A media file mutate operation. - remarketing_action_operation (google.ads.googleads.v6.services.types.RemarketingActionOperation): - A remarketing action mutate operation. - shared_criterion_operation (google.ads.googleads.v6.services.types.SharedCriterionOperation): - A shared criterion mutate operation. - shared_set_operation (google.ads.googleads.v6.services.types.SharedSetOperation): - A shared set mutate operation. - user_list_operation (google.ads.googleads.v6.services.types.UserListOperation): - A user list mutate operation. - """ - - ad_group_ad_label_operation = proto.Field( - proto.MESSAGE, - number=17, - oneof="operation", - message=ad_group_ad_label_service.AdGroupAdLabelOperation, - ) - ad_group_ad_operation = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=ad_group_ad_service.AdGroupAdOperation, - ) - ad_group_bid_modifier_operation = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=ad_group_bid_modifier_service.AdGroupBidModifierOperation, - ) - ad_group_criterion_label_operation = proto.Field( - proto.MESSAGE, - number=18, - oneof="operation", - message=ad_group_criterion_label_service.AdGroupCriterionLabelOperation, - ) - ad_group_criterion_operation = proto.Field( - proto.MESSAGE, - number=3, - oneof="operation", - message=ad_group_criterion_service.AdGroupCriterionOperation, - ) - ad_group_extension_setting_operation = proto.Field( - proto.MESSAGE, - number=19, - oneof="operation", - message=ad_group_extension_setting_service.AdGroupExtensionSettingOperation, - ) - ad_group_feed_operation = proto.Field( - proto.MESSAGE, - number=20, - oneof="operation", - message=ad_group_feed_service.AdGroupFeedOperation, - ) - ad_group_label_operation = proto.Field( - proto.MESSAGE, - number=21, - oneof="operation", - message=ad_group_label_service.AdGroupLabelOperation, - ) - ad_group_operation = proto.Field( - proto.MESSAGE, - number=5, - oneof="operation", - message=ad_group_service.AdGroupOperation, - ) - ad_operation = proto.Field( - proto.MESSAGE, - number=49, - oneof="operation", - message=ad_service.AdOperation, - ) - ad_parameter_operation = proto.Field( - proto.MESSAGE, - number=22, - oneof="operation", - message=ad_parameter_service.AdParameterOperation, - ) - asset_operation = proto.Field( - proto.MESSAGE, - number=23, - oneof="operation", - message=asset_service.AssetOperation, - ) - bidding_strategy_operation = proto.Field( - proto.MESSAGE, - number=6, - oneof="operation", - message=bidding_strategy_service.BiddingStrategyOperation, - ) - campaign_asset_operation = proto.Field( - proto.MESSAGE, - number=52, - oneof="operation", - message=campaign_asset_service.CampaignAssetOperation, - ) - campaign_bid_modifier_operation = proto.Field( - proto.MESSAGE, - number=7, - oneof="operation", - message=campaign_bid_modifier_service.CampaignBidModifierOperation, - ) - campaign_budget_operation = proto.Field( - proto.MESSAGE, - number=8, - oneof="operation", - message=campaign_budget_service.CampaignBudgetOperation, - ) - campaign_criterion_operation = proto.Field( - proto.MESSAGE, - number=13, - oneof="operation", - message=campaign_criterion_service.CampaignCriterionOperation, - ) - campaign_draft_operation = proto.Field( - proto.MESSAGE, - number=24, - oneof="operation", - message=campaign_draft_service.CampaignDraftOperation, - ) - campaign_experiment_operation = proto.Field( - proto.MESSAGE, - number=25, - oneof="operation", - message=campaign_experiment_service.CampaignExperimentOperation, - ) - campaign_extension_setting_operation = proto.Field( - proto.MESSAGE, - number=26, - oneof="operation", - message=campaign_extension_setting_service.CampaignExtensionSettingOperation, - ) - campaign_feed_operation = proto.Field( - proto.MESSAGE, - number=27, - oneof="operation", - message=campaign_feed_service.CampaignFeedOperation, - ) - campaign_label_operation = proto.Field( - proto.MESSAGE, - number=28, - oneof="operation", - message=campaign_label_service.CampaignLabelOperation, - ) - campaign_operation = proto.Field( - proto.MESSAGE, - number=10, - oneof="operation", - message=campaign_service.CampaignOperation, - ) - campaign_shared_set_operation = proto.Field( - proto.MESSAGE, - number=11, - oneof="operation", - message=campaign_shared_set_service.CampaignSharedSetOperation, - ) - conversion_action_operation = proto.Field( - proto.MESSAGE, - number=12, - oneof="operation", - message=conversion_action_service.ConversionActionOperation, - ) - customer_extension_setting_operation = proto.Field( - proto.MESSAGE, - number=30, - oneof="operation", - message=customer_extension_setting_service.CustomerExtensionSettingOperation, - ) - customer_feed_operation = proto.Field( - proto.MESSAGE, - number=31, - oneof="operation", - message=customer_feed_service.CustomerFeedOperation, - ) - customer_label_operation = proto.Field( - proto.MESSAGE, - number=32, - oneof="operation", - message=customer_label_service.CustomerLabelOperation, - ) - customer_negative_criterion_operation = proto.Field( - proto.MESSAGE, - number=34, - oneof="operation", - message=customer_negative_criterion_service.CustomerNegativeCriterionOperation, - ) - customer_operation = proto.Field( - proto.MESSAGE, - number=35, - oneof="operation", - message=customer_service.CustomerOperation, - ) - extension_feed_item_operation = proto.Field( - proto.MESSAGE, - number=36, - oneof="operation", - message=extension_feed_item_service.ExtensionFeedItemOperation, - ) - feed_item_operation = proto.Field( - proto.MESSAGE, - number=37, - oneof="operation", - message=feed_item_service.FeedItemOperation, - ) - feed_item_set_operation = proto.Field( - proto.MESSAGE, - number=53, - oneof="operation", - message=feed_item_set_service.FeedItemSetOperation, - ) - feed_item_set_link_operation = proto.Field( - proto.MESSAGE, - number=54, - oneof="operation", - message=feed_item_set_link_service.FeedItemSetLinkOperation, - ) - feed_item_target_operation = proto.Field( - proto.MESSAGE, - number=38, - oneof="operation", - message=feed_item_target_service.FeedItemTargetOperation, - ) - feed_mapping_operation = proto.Field( - proto.MESSAGE, - number=39, - oneof="operation", - message=feed_mapping_service.FeedMappingOperation, - ) - feed_operation = proto.Field( - proto.MESSAGE, - number=40, - oneof="operation", - message=feed_service.FeedOperation, - ) - keyword_plan_ad_group_operation = proto.Field( - proto.MESSAGE, - number=44, - oneof="operation", - message=keyword_plan_ad_group_service.KeywordPlanAdGroupOperation, - ) - keyword_plan_ad_group_keyword_operation = proto.Field( - proto.MESSAGE, - number=50, - oneof="operation", - message=keyword_plan_ad_group_keyword_service.KeywordPlanAdGroupKeywordOperation, - ) - keyword_plan_campaign_keyword_operation = proto.Field( - proto.MESSAGE, - number=51, - oneof="operation", - message=keyword_plan_campaign_keyword_service.KeywordPlanCampaignKeywordOperation, - ) - keyword_plan_campaign_operation = proto.Field( - proto.MESSAGE, - number=45, - oneof="operation", - message=keyword_plan_campaign_service.KeywordPlanCampaignOperation, - ) - keyword_plan_operation = proto.Field( - proto.MESSAGE, - number=48, - oneof="operation", - message=keyword_plan_service.KeywordPlanOperation, - ) - label_operation = proto.Field( - proto.MESSAGE, - number=41, - oneof="operation", - message=label_service.LabelOperation, - ) - media_file_operation = proto.Field( - proto.MESSAGE, - number=42, - oneof="operation", - message=media_file_service.MediaFileOperation, - ) - remarketing_action_operation = proto.Field( - proto.MESSAGE, - number=43, - oneof="operation", - message=remarketing_action_service.RemarketingActionOperation, - ) - shared_criterion_operation = proto.Field( - proto.MESSAGE, - number=14, - oneof="operation", - message=shared_criterion_service.SharedCriterionOperation, - ) - shared_set_operation = proto.Field( - proto.MESSAGE, - number=15, - oneof="operation", - message=shared_set_service.SharedSetOperation, - ) - user_list_operation = proto.Field( - proto.MESSAGE, - number=16, - oneof="operation", - message=user_list_service.UserListOperation, - ) - - -class MutateOperationResponse(proto.Message): - r"""Response message for the resource mutate. - - Attributes: - ad_group_ad_label_result (google.ads.googleads.v6.services.types.MutateAdGroupAdLabelResult): - The result for the ad group ad label mutate. - ad_group_ad_result (google.ads.googleads.v6.services.types.MutateAdGroupAdResult): - The result for the ad group ad mutate. - ad_group_bid_modifier_result (google.ads.googleads.v6.services.types.MutateAdGroupBidModifierResult): - The result for the ad group bid modifier - mutate. - ad_group_criterion_label_result (google.ads.googleads.v6.services.types.MutateAdGroupCriterionLabelResult): - The result for the ad group criterion label - mutate. - ad_group_criterion_result (google.ads.googleads.v6.services.types.MutateAdGroupCriterionResult): - The result for the ad group criterion mutate. - ad_group_extension_setting_result (google.ads.googleads.v6.services.types.MutateAdGroupExtensionSettingResult): - The result for the ad group extension setting - mutate. - ad_group_feed_result (google.ads.googleads.v6.services.types.MutateAdGroupFeedResult): - The result for the ad group feed mutate. - ad_group_label_result (google.ads.googleads.v6.services.types.MutateAdGroupLabelResult): - The result for the ad group label mutate. - ad_group_result (google.ads.googleads.v6.services.types.MutateAdGroupResult): - The result for the ad group mutate. - ad_parameter_result (google.ads.googleads.v6.services.types.MutateAdParameterResult): - The result for the ad parameter mutate. - ad_result (google.ads.googleads.v6.services.types.MutateAdResult): - The result for the ad mutate. - asset_result (google.ads.googleads.v6.services.types.MutateAssetResult): - The result for the asset mutate. - bidding_strategy_result (google.ads.googleads.v6.services.types.MutateBiddingStrategyResult): - The result for the bidding strategy mutate. - campaign_asset_result (google.ads.googleads.v6.services.types.MutateCampaignAssetResult): - The result for the campaign asset mutate. - campaign_bid_modifier_result (google.ads.googleads.v6.services.types.MutateCampaignBidModifierResult): - The result for the campaign bid modifier - mutate. - campaign_budget_result (google.ads.googleads.v6.services.types.MutateCampaignBudgetResult): - The result for the campaign budget mutate. - campaign_criterion_result (google.ads.googleads.v6.services.types.MutateCampaignCriterionResult): - The result for the campaign criterion mutate. - campaign_draft_result (google.ads.googleads.v6.services.types.MutateCampaignDraftResult): - The result for the campaign draft mutate. - campaign_experiment_result (google.ads.googleads.v6.services.types.MutateCampaignExperimentResult): - The result for the campaign experiment - mutate. - campaign_extension_setting_result (google.ads.googleads.v6.services.types.MutateCampaignExtensionSettingResult): - The result for the campaign extension setting - mutate. - campaign_feed_result (google.ads.googleads.v6.services.types.MutateCampaignFeedResult): - The result for the campaign feed mutate. - campaign_label_result (google.ads.googleads.v6.services.types.MutateCampaignLabelResult): - The result for the campaign label mutate. - campaign_result (google.ads.googleads.v6.services.types.MutateCampaignResult): - The result for the campaign mutate. - campaign_shared_set_result (google.ads.googleads.v6.services.types.MutateCampaignSharedSetResult): - The result for the campaign shared set - mutate. - conversion_action_result (google.ads.googleads.v6.services.types.MutateConversionActionResult): - The result for the conversion action mutate. - customer_extension_setting_result (google.ads.googleads.v6.services.types.MutateCustomerExtensionSettingResult): - The result for the customer extension setting - mutate. - customer_feed_result (google.ads.googleads.v6.services.types.MutateCustomerFeedResult): - The result for the customer feed mutate. - customer_label_result (google.ads.googleads.v6.services.types.MutateCustomerLabelResult): - The result for the customer label mutate. - customer_negative_criterion_result (google.ads.googleads.v6.services.types.MutateCustomerNegativeCriteriaResult): - The result for the customer negative - criterion mutate. - customer_result (google.ads.googleads.v6.services.types.MutateCustomerResult): - The result for the customer mutate. - extension_feed_item_result (google.ads.googleads.v6.services.types.MutateExtensionFeedItemResult): - The result for the extension feed item - mutate. - feed_item_result (google.ads.googleads.v6.services.types.MutateFeedItemResult): - The result for the feed item mutate. - feed_item_set_result (google.ads.googleads.v6.services.types.MutateFeedItemSetResult): - The result for the feed item set mutate. - feed_item_set_link_result (google.ads.googleads.v6.services.types.MutateFeedItemSetLinkResult): - The result for the feed item set link mutate. - feed_item_target_result (google.ads.googleads.v6.services.types.MutateFeedItemTargetResult): - The result for the feed item target mutate. - feed_mapping_result (google.ads.googleads.v6.services.types.MutateFeedMappingResult): - The result for the feed mapping mutate. - feed_result (google.ads.googleads.v6.services.types.MutateFeedResult): - The result for the feed mutate. - keyword_plan_ad_group_result (google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupResult): - The result for the keyword plan ad group - mutate. - keyword_plan_campaign_result (google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignResult): - The result for the keyword plan campaign - mutate. - keyword_plan_ad_group_keyword_result (google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupKeywordResult): - The result for the keyword plan ad group - keyword mutate. - keyword_plan_campaign_keyword_result (google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignKeywordResult): - The result for the keyword plan campaign - keyword mutate. - keyword_plan_result (google.ads.googleads.v6.services.types.MutateKeywordPlansResult): - The result for the keyword plan mutate. - label_result (google.ads.googleads.v6.services.types.MutateLabelResult): - The result for the label mutate. - media_file_result (google.ads.googleads.v6.services.types.MutateMediaFileResult): - The result for the media file mutate. - remarketing_action_result (google.ads.googleads.v6.services.types.MutateRemarketingActionResult): - The result for the remarketing action mutate. - shared_criterion_result (google.ads.googleads.v6.services.types.MutateSharedCriterionResult): - The result for the shared criterion mutate. - shared_set_result (google.ads.googleads.v6.services.types.MutateSharedSetResult): - The result for the shared set mutate. - user_list_result (google.ads.googleads.v6.services.types.MutateUserListResult): - The result for the user list mutate. - """ - - ad_group_ad_label_result = proto.Field( - proto.MESSAGE, - number=17, - oneof="response", - message=ad_group_ad_label_service.MutateAdGroupAdLabelResult, - ) - ad_group_ad_result = proto.Field( - proto.MESSAGE, - number=1, - oneof="response", - message=ad_group_ad_service.MutateAdGroupAdResult, - ) - ad_group_bid_modifier_result = proto.Field( - proto.MESSAGE, - number=2, - oneof="response", - message=ad_group_bid_modifier_service.MutateAdGroupBidModifierResult, - ) - ad_group_criterion_label_result = proto.Field( - proto.MESSAGE, - number=18, - oneof="response", - message=ad_group_criterion_label_service.MutateAdGroupCriterionLabelResult, - ) - ad_group_criterion_result = proto.Field( - proto.MESSAGE, - number=3, - oneof="response", - message=ad_group_criterion_service.MutateAdGroupCriterionResult, - ) - ad_group_extension_setting_result = proto.Field( - proto.MESSAGE, - number=19, - oneof="response", - message=ad_group_extension_setting_service.MutateAdGroupExtensionSettingResult, - ) - ad_group_feed_result = proto.Field( - proto.MESSAGE, - number=20, - oneof="response", - message=ad_group_feed_service.MutateAdGroupFeedResult, - ) - ad_group_label_result = proto.Field( - proto.MESSAGE, - number=21, - oneof="response", - message=ad_group_label_service.MutateAdGroupLabelResult, - ) - ad_group_result = proto.Field( - proto.MESSAGE, - number=5, - oneof="response", - message=ad_group_service.MutateAdGroupResult, - ) - ad_parameter_result = proto.Field( - proto.MESSAGE, - number=22, - oneof="response", - message=ad_parameter_service.MutateAdParameterResult, - ) - ad_result = proto.Field( - proto.MESSAGE, - number=49, - oneof="response", - message=ad_service.MutateAdResult, - ) - asset_result = proto.Field( - proto.MESSAGE, - number=23, - oneof="response", - message=asset_service.MutateAssetResult, - ) - bidding_strategy_result = proto.Field( - proto.MESSAGE, - number=6, - oneof="response", - message=bidding_strategy_service.MutateBiddingStrategyResult, - ) - campaign_asset_result = proto.Field( - proto.MESSAGE, - number=52, - oneof="response", - message=campaign_asset_service.MutateCampaignAssetResult, - ) - campaign_bid_modifier_result = proto.Field( - proto.MESSAGE, - number=7, - oneof="response", - message=campaign_bid_modifier_service.MutateCampaignBidModifierResult, - ) - campaign_budget_result = proto.Field( - proto.MESSAGE, - number=8, - oneof="response", - message=campaign_budget_service.MutateCampaignBudgetResult, - ) - campaign_criterion_result = proto.Field( - proto.MESSAGE, - number=13, - oneof="response", - message=campaign_criterion_service.MutateCampaignCriterionResult, - ) - campaign_draft_result = proto.Field( - proto.MESSAGE, - number=24, - oneof="response", - message=campaign_draft_service.MutateCampaignDraftResult, - ) - campaign_experiment_result = proto.Field( - proto.MESSAGE, - number=25, - oneof="response", - message=campaign_experiment_service.MutateCampaignExperimentResult, - ) - campaign_extension_setting_result = proto.Field( - proto.MESSAGE, - number=26, - oneof="response", - message=campaign_extension_setting_service.MutateCampaignExtensionSettingResult, - ) - campaign_feed_result = proto.Field( - proto.MESSAGE, - number=27, - oneof="response", - message=campaign_feed_service.MutateCampaignFeedResult, - ) - campaign_label_result = proto.Field( - proto.MESSAGE, - number=28, - oneof="response", - message=campaign_label_service.MutateCampaignLabelResult, - ) - campaign_result = proto.Field( - proto.MESSAGE, - number=10, - oneof="response", - message=campaign_service.MutateCampaignResult, - ) - campaign_shared_set_result = proto.Field( - proto.MESSAGE, - number=11, - oneof="response", - message=campaign_shared_set_service.MutateCampaignSharedSetResult, - ) - conversion_action_result = proto.Field( - proto.MESSAGE, - number=12, - oneof="response", - message=conversion_action_service.MutateConversionActionResult, - ) - customer_extension_setting_result = proto.Field( - proto.MESSAGE, - number=30, - oneof="response", - message=customer_extension_setting_service.MutateCustomerExtensionSettingResult, - ) - customer_feed_result = proto.Field( - proto.MESSAGE, - number=31, - oneof="response", - message=customer_feed_service.MutateCustomerFeedResult, - ) - customer_label_result = proto.Field( - proto.MESSAGE, - number=32, - oneof="response", - message=customer_label_service.MutateCustomerLabelResult, - ) - customer_negative_criterion_result = proto.Field( - proto.MESSAGE, - number=34, - oneof="response", - message=customer_negative_criterion_service.MutateCustomerNegativeCriteriaResult, - ) - customer_result = proto.Field( - proto.MESSAGE, - number=35, - oneof="response", - message=customer_service.MutateCustomerResult, - ) - extension_feed_item_result = proto.Field( - proto.MESSAGE, - number=36, - oneof="response", - message=extension_feed_item_service.MutateExtensionFeedItemResult, - ) - feed_item_result = proto.Field( - proto.MESSAGE, - number=37, - oneof="response", - message=feed_item_service.MutateFeedItemResult, - ) - feed_item_set_result = proto.Field( - proto.MESSAGE, - number=53, - oneof="response", - message=feed_item_set_service.MutateFeedItemSetResult, - ) - feed_item_set_link_result = proto.Field( - proto.MESSAGE, - number=54, - oneof="response", - message=feed_item_set_link_service.MutateFeedItemSetLinkResult, - ) - feed_item_target_result = proto.Field( - proto.MESSAGE, - number=38, - oneof="response", - message=feed_item_target_service.MutateFeedItemTargetResult, - ) - feed_mapping_result = proto.Field( - proto.MESSAGE, - number=39, - oneof="response", - message=feed_mapping_service.MutateFeedMappingResult, - ) - feed_result = proto.Field( - proto.MESSAGE, - number=40, - oneof="response", - message=feed_service.MutateFeedResult, - ) - keyword_plan_ad_group_result = proto.Field( - proto.MESSAGE, - number=44, - oneof="response", - message=keyword_plan_ad_group_service.MutateKeywordPlanAdGroupResult, - ) - keyword_plan_campaign_result = proto.Field( - proto.MESSAGE, - number=45, - oneof="response", - message=keyword_plan_campaign_service.MutateKeywordPlanCampaignResult, - ) - keyword_plan_ad_group_keyword_result = proto.Field( - proto.MESSAGE, - number=50, - oneof="response", - message=keyword_plan_ad_group_keyword_service.MutateKeywordPlanAdGroupKeywordResult, - ) - keyword_plan_campaign_keyword_result = proto.Field( - proto.MESSAGE, - number=51, - oneof="response", - message=keyword_plan_campaign_keyword_service.MutateKeywordPlanCampaignKeywordResult, - ) - keyword_plan_result = proto.Field( - proto.MESSAGE, - number=48, - oneof="response", - message=keyword_plan_service.MutateKeywordPlansResult, - ) - label_result = proto.Field( - proto.MESSAGE, - number=41, - oneof="response", - message=label_service.MutateLabelResult, - ) - media_file_result = proto.Field( - proto.MESSAGE, - number=42, - oneof="response", - message=media_file_service.MutateMediaFileResult, - ) - remarketing_action_result = proto.Field( - proto.MESSAGE, - number=43, - oneof="response", - message=remarketing_action_service.MutateRemarketingActionResult, - ) - shared_criterion_result = proto.Field( - proto.MESSAGE, - number=14, - oneof="response", - message=shared_criterion_service.MutateSharedCriterionResult, - ) - shared_set_result = proto.Field( - proto.MESSAGE, - number=15, - oneof="response", - message=shared_set_service.MutateSharedSetResult, - ) - user_list_result = proto.Field( - proto.MESSAGE, - number=16, - oneof="response", - message=user_list_service.MutateUserListResult, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/group_placement_view_service.py b/google/ads/googleads/v6/services/types/group_placement_view_service.py deleted file mode 100644 index cec8b9161..000000000 --- a/google/ads/googleads/v6/services/types/group_placement_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetGroupPlacementViewRequest",}, -) - - -class GetGroupPlacementViewRequest(proto.Message): - r"""Request message for - [GroupPlacementViewService.GetGroupPlacementView][google.ads.googleads.v6.services.GroupPlacementViewService.GetGroupPlacementView]. - - Attributes: - resource_name (str): - Required. The resource name of the Group - Placement view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/hotel_group_view_service.py b/google/ads/googleads/v6/services/types/hotel_group_view_service.py deleted file mode 100644 index 6214b15af..000000000 --- a/google/ads/googleads/v6/services/types/hotel_group_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetHotelGroupViewRequest",}, -) - - -class GetHotelGroupViewRequest(proto.Message): - r"""Request message for - [HotelGroupViewService.GetHotelGroupView][google.ads.googleads.v6.services.HotelGroupViewService.GetHotelGroupView]. - - Attributes: - resource_name (str): - Required. Resource name of the Hotel Group - View to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/hotel_performance_view_service.py b/google/ads/googleads/v6/services/types/hotel_performance_view_service.py deleted file mode 100644 index 2ef11df99..000000000 --- a/google/ads/googleads/v6/services/types/hotel_performance_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetHotelPerformanceViewRequest",}, -) - - -class GetHotelPerformanceViewRequest(proto.Message): - r"""Request message for - [HotelPerformanceViewService.GetHotelPerformanceView][google.ads.googleads.v6.services.HotelPerformanceViewService.GetHotelPerformanceView]. - - Attributes: - resource_name (str): - Required. Resource name of the Hotel - Performance View to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/income_range_view_service.py b/google/ads/googleads/v6/services/types/income_range_view_service.py deleted file mode 100644 index 568d66127..000000000 --- a/google/ads/googleads/v6/services/types/income_range_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetIncomeRangeViewRequest",}, -) - - -class GetIncomeRangeViewRequest(proto.Message): - r"""Request message for - [IncomeRangeViewService.GetIncomeRangeView][google.ads.googleads.v6.services.IncomeRangeViewService.GetIncomeRangeView]. - - Attributes: - resource_name (str): - Required. The resource name of the income - range view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/invoice_service.py b/google/ads/googleads/v6/services/types/invoice_service.py deleted file mode 100644 index c03c715b1..000000000 --- a/google/ads/googleads/v6/services/types/invoice_service.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import month_of_year -from google.ads.googleads.v6.resources.types import invoice - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"ListInvoicesRequest", "ListInvoicesResponse",}, -) - - -class ListInvoicesRequest(proto.Message): - r"""Request message for fetching the invoices of a given billing - setup that were issued during a given month. - - Attributes: - customer_id (str): - Required. The ID of the customer to fetch - invoices for. - billing_setup (str): - Required. The billing setup resource name of the requested - invoices. - - ``customers/{customer_id}/billingSetups/{billing_setup_id}`` - issue_year (str): - Required. The issue year to retrieve - invoices, in yyyy format. Only invoices issued - in 2019 or later can be retrieved. - issue_month (google.ads.googleads.v6.enums.types.MonthOfYearEnum.MonthOfYear): - Required. The issue month to retrieve - invoices. - """ - - customer_id = proto.Field(proto.STRING, number=1) - billing_setup = proto.Field(proto.STRING, number=2) - issue_year = proto.Field(proto.STRING, number=3) - issue_month = proto.Field( - proto.ENUM, number=4, enum=month_of_year.MonthOfYearEnum.MonthOfYear, - ) - - -class ListInvoicesResponse(proto.Message): - r"""Response message for - [InvoiceService.ListInvoices][google.ads.googleads.v6.services.InvoiceService.ListInvoices]. - - Attributes: - invoices (Sequence[google.ads.googleads.v6.resources.types.Invoice]): - The list of invoices that match the billing - setup and time period. - """ - - invoices = proto.RepeatedField( - proto.MESSAGE, number=1, message=invoice.Invoice, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_ad_group_keyword_service.py b/google/ads/googleads/v6/services/types/keyword_plan_ad_group_keyword_service.py deleted file mode 100644 index 5dbc1a171..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_ad_group_keyword_service.py +++ /dev/null @@ -1,161 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_ad_group_keyword, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetKeywordPlanAdGroupKeywordRequest", - "MutateKeywordPlanAdGroupKeywordsRequest", - "KeywordPlanAdGroupKeywordOperation", - "MutateKeywordPlanAdGroupKeywordsResponse", - "MutateKeywordPlanAdGroupKeywordResult", - }, -) - - -class GetKeywordPlanAdGroupKeywordRequest(proto.Message): - r"""Request message for - [KeywordPlanAdGroupKeywordService.GetKeywordPlanAdGroupKeyword][google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService.GetKeywordPlanAdGroupKeyword]. - - Attributes: - resource_name (str): - Required. The resource name of the ad group - keyword to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateKeywordPlanAdGroupKeywordsRequest(proto.Message): - r"""Request message for - [KeywordPlanAdGroupKeywordService.MutateKeywordPlanAdGroupKeywords][google.ads.googleads.v6.services.KeywordPlanAdGroupKeywordService.MutateKeywordPlanAdGroupKeywords]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - Keyword Plan ad group keywords are being - modified. - operations (Sequence[google.ads.googleads.v6.services.types.KeywordPlanAdGroupKeywordOperation]): - Required. The list of operations to perform - on individual Keyword Plan ad group keywords. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanAdGroupKeywordOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class KeywordPlanAdGroupKeywordOperation(proto.Message): - r"""A single operation (create, update, remove) on a Keyword Plan - ad group keyword. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.KeywordPlanAdGroupKeyword): - Create operation: No resource name is - expected for the new Keyword Plan ad group - keyword. - update (google.ads.googleads.v6.resources.types.KeywordPlanAdGroupKeyword): - Update operation: The Keyword Plan ad group - keyword is expected to have a valid resource - name. - remove (str): - Remove operation: A resource name for the removed Keyword - Plan ad group keyword is expected, in this format: - - ``customers/{customer_id}/keywordPlanAdGroupKeywords/{kp_ad_group_keyword_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=keyword_plan_ad_group_keyword.KeywordPlanAdGroupKeyword, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateKeywordPlanAdGroupKeywordsResponse(proto.Message): - r"""Response message for a Keyword Plan ad group keyword mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupKeywordResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, - number=2, - message="MutateKeywordPlanAdGroupKeywordResult", - ) - - -class MutateKeywordPlanAdGroupKeywordResult(proto.Message): - r"""The result for the Keyword Plan ad group keyword mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_ad_group_service.py b/google/ads/googleads/v6/services/types/keyword_plan_ad_group_service.py deleted file mode 100644 index 7188f6c9c..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_ad_group_service.py +++ /dev/null @@ -1,156 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import keyword_plan_ad_group -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetKeywordPlanAdGroupRequest", - "MutateKeywordPlanAdGroupsRequest", - "KeywordPlanAdGroupOperation", - "MutateKeywordPlanAdGroupsResponse", - "MutateKeywordPlanAdGroupResult", - }, -) - - -class GetKeywordPlanAdGroupRequest(proto.Message): - r"""Request message for - [KeywordPlanAdGroupService.GetKeywordPlanAdGroup][google.ads.googleads.v6.services.KeywordPlanAdGroupService.GetKeywordPlanAdGroup]. - - Attributes: - resource_name (str): - Required. The resource name of the Keyword - Plan ad group to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateKeywordPlanAdGroupsRequest(proto.Message): - r"""Request message for - [KeywordPlanAdGroupService.MutateKeywordPlanAdGroups][google.ads.googleads.v6.services.KeywordPlanAdGroupService.MutateKeywordPlanAdGroups]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - Keyword Plan ad groups are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.KeywordPlanAdGroupOperation]): - Required. The list of operations to perform - on individual Keyword Plan ad groups. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanAdGroupOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class KeywordPlanAdGroupOperation(proto.Message): - r"""A single operation (create, update, remove) on a Keyword Plan - ad group. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.KeywordPlanAdGroup): - Create operation: No resource name is - expected for the new Keyword Plan ad group. - update (google.ads.googleads.v6.resources.types.KeywordPlanAdGroup): - Update operation: The Keyword Plan ad group - is expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed Keyword - Plan ad group is expected, in this format: - - ``customers/{customer_id}/keywordPlanAdGroups/{kp_ad_group_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=keyword_plan_ad_group.KeywordPlanAdGroup, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=keyword_plan_ad_group.KeywordPlanAdGroup, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateKeywordPlanAdGroupsResponse(proto.Message): - r"""Response message for a Keyword Plan ad group mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateKeywordPlanAdGroupResult]): - All results for the mutate. The order of the - results is determined by the order of the - keywords in the original request. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateKeywordPlanAdGroupResult", - ) - - -class MutateKeywordPlanAdGroupResult(proto.Message): - r"""The result for the Keyword Plan ad group mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_campaign_keyword_service.py b/google/ads/googleads/v6/services/types/keyword_plan_campaign_keyword_service.py deleted file mode 100644 index d56f95cc3..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_campaign_keyword_service.py +++ /dev/null @@ -1,159 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import ( - keyword_plan_campaign_keyword, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetKeywordPlanCampaignKeywordRequest", - "MutateKeywordPlanCampaignKeywordsRequest", - "KeywordPlanCampaignKeywordOperation", - "MutateKeywordPlanCampaignKeywordsResponse", - "MutateKeywordPlanCampaignKeywordResult", - }, -) - - -class GetKeywordPlanCampaignKeywordRequest(proto.Message): - r"""Request message for - [KeywordPlanCampaignKeywordService.GetKeywordPlanCampaignKeyword][google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService.GetKeywordPlanCampaignKeyword]. - - Attributes: - resource_name (str): - Required. The resource name of the plan to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateKeywordPlanCampaignKeywordsRequest(proto.Message): - r"""Request message for - [KeywordPlanCampaignKeywordService.MutateKeywordPlanCampaignKeywords][google.ads.googleads.v6.services.KeywordPlanCampaignKeywordService.MutateKeywordPlanCampaignKeywords]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - campaign keywords are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignKeywordOperation]): - Required. The list of operations to perform - on individual Keyword Plan campaign keywords. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanCampaignKeywordOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class KeywordPlanCampaignKeywordOperation(proto.Message): - r"""A single operation (create, update, remove) on a Keyword Plan - campaign keyword. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.KeywordPlanCampaignKeyword): - Create operation: No resource name is - expected for the new Keyword Plan campaign - keyword. - update (google.ads.googleads.v6.resources.types.KeywordPlanCampaignKeyword): - Update operation: The Keyword Plan campaign - keyword expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed Keyword - Plan campaign keywords expected in this format: - - ``customers/{customer_id}/keywordPlanCampaignKeywords/{kp_campaign_keyword_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=keyword_plan_campaign_keyword.KeywordPlanCampaignKeyword, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateKeywordPlanCampaignKeywordsResponse(proto.Message): - r"""Response message for a Keyword Plan campaign keyword mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignKeywordResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, - number=2, - message="MutateKeywordPlanCampaignKeywordResult", - ) - - -class MutateKeywordPlanCampaignKeywordResult(proto.Message): - r"""The result for the Keyword Plan campaign keyword mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_campaign_service.py b/google/ads/googleads/v6/services/types/keyword_plan_campaign_service.py deleted file mode 100644 index 5a9d18951..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_campaign_service.py +++ /dev/null @@ -1,154 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import keyword_plan_campaign -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetKeywordPlanCampaignRequest", - "MutateKeywordPlanCampaignsRequest", - "KeywordPlanCampaignOperation", - "MutateKeywordPlanCampaignsResponse", - "MutateKeywordPlanCampaignResult", - }, -) - - -class GetKeywordPlanCampaignRequest(proto.Message): - r"""Request message for - [KeywordPlanCampaignService.GetKeywordPlanCampaign][google.ads.googleads.v6.services.KeywordPlanCampaignService.GetKeywordPlanCampaign]. - - Attributes: - resource_name (str): - Required. The resource name of the Keyword - Plan campaign to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateKeywordPlanCampaignsRequest(proto.Message): - r"""Request message for - [KeywordPlanCampaignService.MutateKeywordPlanCampaigns][google.ads.googleads.v6.services.KeywordPlanCampaignService.MutateKeywordPlanCampaigns]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - Keyword Plan campaigns are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignOperation]): - Required. The list of operations to perform - on individual Keyword Plan campaigns. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanCampaignOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class KeywordPlanCampaignOperation(proto.Message): - r"""A single operation (create, update, remove) on a Keyword Plan - campaign. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.KeywordPlanCampaign): - Create operation: No resource name is - expected for the new Keyword Plan campaign. - update (google.ads.googleads.v6.resources.types.KeywordPlanCampaign): - Update operation: The Keyword Plan campaign - is expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed Keyword - Plan campaign is expected, in this format: - - ``customers/{customer_id}/keywordPlanCampaigns/{keywordPlan_campaign_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=keyword_plan_campaign.KeywordPlanCampaign, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=keyword_plan_campaign.KeywordPlanCampaign, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateKeywordPlanCampaignsResponse(proto.Message): - r"""Response message for a Keyword Plan campaign mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateKeywordPlanCampaignResult", - ) - - -class MutateKeywordPlanCampaignResult(proto.Message): - r"""The result for the Keyword Plan campaign mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_idea_service.py b/google/ads/googleads/v6/services/types/keyword_plan_idea_service.py deleted file mode 100644 index 2d05412a1..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_idea_service.py +++ /dev/null @@ -1,215 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import keyword_plan_common -from google.ads.googleads.v6.enums.types import ( - keyword_plan_network as gage_keyword_plan_network, -) - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GenerateKeywordIdeasRequest", - "KeywordAndUrlSeed", - "KeywordSeed", - "SiteSeed", - "UrlSeed", - "GenerateKeywordIdeaResponse", - "GenerateKeywordIdeaResult", - }, -) - - -class GenerateKeywordIdeasRequest(proto.Message): - r"""Request message for - [KeywordPlanIdeaService.GenerateKeywordIdeas][google.ads.googleads.v6.services.KeywordPlanIdeaService.GenerateKeywordIdeas]. - - Attributes: - customer_id (str): - The ID of the customer with the - recommendation. - language (str): - The resource name of the language to target. - Required - geo_target_constants (Sequence[str]): - The resource names of the location to target. - Max 10 - include_adult_keywords (bool): - If true, adult keywords will be included in - response. The default value is false. - page_token (str): - Token of the page to retrieve. If not specified, the first - page of results will be returned. To request next page of - results use the value obtained from ``next_page_token`` in - the previous response. The request fields must match across - pages. - page_size (int): - Number of results to retrieve in a single page. A maximum of - 10,000 results may be returned, if the page_size exceeds - this, it is ignored. If unspecified, at most 10,000 results - will be returned. The server may decide to further limit the - number of returned resources. If the response contains fewer - than 10,000 results it may not be assumed as last page of - results. - keyword_plan_network (google.ads.googleads.v6.enums.types.KeywordPlanNetworkEnum.KeywordPlanNetwork): - Targeting network. - keyword_and_url_seed (google.ads.googleads.v6.services.types.KeywordAndUrlSeed): - A Keyword and a specific Url to generate - ideas from e.g. cars, www.example.com/cars. - keyword_seed (google.ads.googleads.v6.services.types.KeywordSeed): - A Keyword or phrase to generate ideas from, - e.g. cars. - url_seed (google.ads.googleads.v6.services.types.UrlSeed): - A specific url to generate ideas from, e.g. - www.example.com/cars. - site_seed (google.ads.googleads.v6.services.types.SiteSeed): - The site to generate ideas from, e.g. - www.example.com. - """ - - customer_id = proto.Field(proto.STRING, number=1) - language = proto.Field(proto.STRING, number=14, optional=True) - geo_target_constants = proto.RepeatedField(proto.STRING, number=15) - include_adult_keywords = proto.Field(proto.BOOL, number=10) - page_token = proto.Field(proto.STRING, number=12) - page_size = proto.Field(proto.INT32, number=13) - keyword_plan_network = proto.Field( - proto.ENUM, - number=9, - enum=gage_keyword_plan_network.KeywordPlanNetworkEnum.KeywordPlanNetwork, - ) - keyword_and_url_seed = proto.Field( - proto.MESSAGE, number=2, oneof="seed", message="KeywordAndUrlSeed", - ) - keyword_seed = proto.Field( - proto.MESSAGE, number=3, oneof="seed", message="KeywordSeed", - ) - url_seed = proto.Field( - proto.MESSAGE, number=5, oneof="seed", message="UrlSeed", - ) - site_seed = proto.Field( - proto.MESSAGE, number=11, oneof="seed", message="SiteSeed", - ) - - -class KeywordAndUrlSeed(proto.Message): - r"""Keyword And Url Seed - - Attributes: - url (str): - The URL to crawl in order to generate keyword - ideas. - keywords (Sequence[str]): - Requires at least one keyword. - """ - - url = proto.Field(proto.STRING, number=3, optional=True) - keywords = proto.RepeatedField(proto.STRING, number=4) - - -class KeywordSeed(proto.Message): - r"""Keyword Seed - - Attributes: - keywords (Sequence[str]): - Requires at least one keyword. - """ - - keywords = proto.RepeatedField(proto.STRING, number=2) - - -class SiteSeed(proto.Message): - r"""Site Seed - - Attributes: - site (str): - The domain name of the site. If the customer - requesting the ideas doesn't own the site - provided only public information is returned. - """ - - site = proto.Field(proto.STRING, number=2, optional=True) - - -class UrlSeed(proto.Message): - r"""Url Seed - - Attributes: - url (str): - The URL to crawl in order to generate keyword - ideas. - """ - - url = proto.Field(proto.STRING, number=2, optional=True) - - -class GenerateKeywordIdeaResponse(proto.Message): - r"""Response message for - [KeywordPlanIdeaService.GenerateKeywordIdeas][google.ads.googleads.v6.services.KeywordPlanIdeaService.GenerateKeywordIdeas]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.GenerateKeywordIdeaResult]): - Results of generating keyword ideas. - next_page_token (str): - Pagination token used to retrieve the next page of results. - Pass the content of this string as the ``page_token`` - attribute of the next request. ``next_page_token`` is not - returned for the last page. - total_size (int): - Total number of results available. - """ - - @property - def raw_page(self): - return self - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="GenerateKeywordIdeaResult", - ) - next_page_token = proto.Field(proto.STRING, number=2) - total_size = proto.Field(proto.INT64, number=3) - - -class GenerateKeywordIdeaResult(proto.Message): - r"""The result of generating keyword ideas. - - Attributes: - text (str): - Text of the keyword idea. - As in Keyword Plan historical metrics, this text - may not be an actual keyword, but the canonical - form of multiple keywords. See - KeywordPlanKeywordHistoricalMetrics message in - KeywordPlanService. - keyword_idea_metrics (google.ads.googleads.v6.common.types.KeywordPlanHistoricalMetrics): - The historical metrics for the keyword. - """ - - text = proto.Field(proto.STRING, number=5, optional=True) - keyword_idea_metrics = proto.Field( - proto.MESSAGE, - number=3, - message=keyword_plan_common.KeywordPlanHistoricalMetrics, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_plan_service.py b/google/ads/googleads/v6/services/types/keyword_plan_service.py deleted file mode 100644 index 9dfe292d7..000000000 --- a/google/ads/googleads/v6/services/types/keyword_plan_service.py +++ /dev/null @@ -1,497 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import keyword_plan_common -from google.ads.googleads.v6.resources.types import ( - keyword_plan as gagr_keyword_plan, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetKeywordPlanRequest", - "MutateKeywordPlansRequest", - "KeywordPlanOperation", - "MutateKeywordPlansResponse", - "MutateKeywordPlansResult", - "GenerateForecastCurveRequest", - "GenerateForecastCurveResponse", - "GenerateForecastTimeSeriesRequest", - "GenerateForecastTimeSeriesResponse", - "GenerateForecastMetricsRequest", - "GenerateForecastMetricsResponse", - "KeywordPlanCampaignForecast", - "KeywordPlanAdGroupForecast", - "KeywordPlanKeywordForecast", - "KeywordPlanCampaignForecastCurve", - "KeywordPlanMaxCpcBidForecastCurve", - "KeywordPlanMaxCpcBidForecast", - "KeywordPlanWeeklyTimeSeriesForecast", - "KeywordPlanWeeklyForecast", - "ForecastMetrics", - "GenerateHistoricalMetricsRequest", - "GenerateHistoricalMetricsResponse", - "KeywordPlanKeywordHistoricalMetrics", - }, -) - - -class GetKeywordPlanRequest(proto.Message): - r"""Request message for - [KeywordPlanService.GetKeywordPlan][google.ads.googleads.v6.services.KeywordPlanService.GetKeywordPlan]. - - Attributes: - resource_name (str): - Required. The resource name of the plan to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateKeywordPlansRequest(proto.Message): - r"""Request message for - [KeywordPlanService.MutateKeywordPlans][google.ads.googleads.v6.services.KeywordPlanService.MutateKeywordPlans]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - keyword plans are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.KeywordPlanOperation]): - Required. The list of operations to perform - on individual keyword plans. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class KeywordPlanOperation(proto.Message): - r"""A single operation (create, update, remove) on a keyword - plan. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - The FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.KeywordPlan): - Create operation: No resource name is - expected for the new keyword plan. - update (google.ads.googleads.v6.resources.types.KeywordPlan): - Update operation: The keyword plan is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed keyword - plan is expected in this format: - - ``customers/{customer_id}/keywordPlans/{keyword_plan_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_keyword_plan.KeywordPlan, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_keyword_plan.KeywordPlan, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateKeywordPlansResponse(proto.Message): - r"""Response message for a keyword plan mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateKeywordPlansResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateKeywordPlansResult", - ) - - -class MutateKeywordPlansResult(proto.Message): - r"""The result for the keyword plan mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class GenerateForecastCurveRequest(proto.Message): - r"""Request message for - [KeywordPlanService.GenerateForecastCurve][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastCurve]. - - Attributes: - keyword_plan (str): - Required. The resource name of the keyword - plan to be forecasted. - """ - - keyword_plan = proto.Field(proto.STRING, number=1) - - -class GenerateForecastCurveResponse(proto.Message): - r"""Response message for - [KeywordPlanService.GenerateForecastCurve][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastCurve]. - - Attributes: - campaign_forecast_curves (Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignForecastCurve]): - List of forecast curves for the keyword plan - campaign. One maximum. - """ - - campaign_forecast_curves = proto.RepeatedField( - proto.MESSAGE, number=1, message="KeywordPlanCampaignForecastCurve", - ) - - -class GenerateForecastTimeSeriesRequest(proto.Message): - r"""Request message for - [KeywordPlanService.GenerateForecastTimeSeries][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastTimeSeries]. - - Attributes: - keyword_plan (str): - Required. The resource name of the keyword - plan to be forecasted. - """ - - keyword_plan = proto.Field(proto.STRING, number=1) - - -class GenerateForecastTimeSeriesResponse(proto.Message): - r"""Response message for - [KeywordPlanService.GenerateForecastTimeSeries][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastTimeSeries]. - - Attributes: - weekly_time_series_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanWeeklyTimeSeriesForecast]): - List of weekly time series forecasts for the - keyword plan campaign. One maximum. - """ - - weekly_time_series_forecasts = proto.RepeatedField( - proto.MESSAGE, number=1, message="KeywordPlanWeeklyTimeSeriesForecast", - ) - - -class GenerateForecastMetricsRequest(proto.Message): - r"""Request message for - [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastMetrics]. - - Attributes: - keyword_plan (str): - Required. The resource name of the keyword - plan to be forecasted. - """ - - keyword_plan = proto.Field(proto.STRING, number=1) - - -class GenerateForecastMetricsResponse(proto.Message): - r"""Response message for - [KeywordPlanService.GenerateForecastMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateForecastMetrics]. - - Attributes: - campaign_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignForecast]): - List of campaign forecasts. - One maximum. - ad_group_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanAdGroupForecast]): - List of ad group forecasts. - keyword_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanKeywordForecast]): - List of keyword forecasts. - """ - - campaign_forecasts = proto.RepeatedField( - proto.MESSAGE, number=1, message="KeywordPlanCampaignForecast", - ) - ad_group_forecasts = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanAdGroupForecast", - ) - keyword_forecasts = proto.RepeatedField( - proto.MESSAGE, number=3, message="KeywordPlanKeywordForecast", - ) - - -class KeywordPlanCampaignForecast(proto.Message): - r"""A campaign forecast. - - Attributes: - keyword_plan_campaign (str): - The resource name of the Keyword Plan campaign related to - the forecast. - - ``customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}`` - campaign_forecast (google.ads.googleads.v6.services.types.ForecastMetrics): - The forecast for the Keyword Plan campaign. - """ - - keyword_plan_campaign = proto.Field(proto.STRING, number=3, optional=True) - campaign_forecast = proto.Field( - proto.MESSAGE, number=2, message="ForecastMetrics", - ) - - -class KeywordPlanAdGroupForecast(proto.Message): - r"""An ad group forecast. - - Attributes: - keyword_plan_ad_group (str): - The resource name of the Keyword Plan ad group related to - the forecast. - - ``customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}`` - ad_group_forecast (google.ads.googleads.v6.services.types.ForecastMetrics): - The forecast for the Keyword Plan ad group. - """ - - keyword_plan_ad_group = proto.Field(proto.STRING, number=3, optional=True) - ad_group_forecast = proto.Field( - proto.MESSAGE, number=2, message="ForecastMetrics", - ) - - -class KeywordPlanKeywordForecast(proto.Message): - r"""A keyword forecast. - - Attributes: - keyword_plan_ad_group_keyword (str): - The resource name of the Keyword Plan keyword related to the - forecast. - - ``customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}`` - keyword_forecast (google.ads.googleads.v6.services.types.ForecastMetrics): - The forecast for the Keyword Plan keyword. - """ - - keyword_plan_ad_group_keyword = proto.Field( - proto.STRING, number=3, optional=True - ) - keyword_forecast = proto.Field( - proto.MESSAGE, number=2, message="ForecastMetrics", - ) - - -class KeywordPlanCampaignForecastCurve(proto.Message): - r"""The forecast curve for the campaign. - - Attributes: - keyword_plan_campaign (str): - The resource name of the Keyword Plan campaign related to - the forecast. - - ``customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}`` - max_cpc_bid_forecast_curve (google.ads.googleads.v6.services.types.KeywordPlanMaxCpcBidForecastCurve): - The max cpc bid forecast curve for the - campaign. - """ - - keyword_plan_campaign = proto.Field(proto.STRING, number=3, optional=True) - max_cpc_bid_forecast_curve = proto.Field( - proto.MESSAGE, number=2, message="KeywordPlanMaxCpcBidForecastCurve", - ) - - -class KeywordPlanMaxCpcBidForecastCurve(proto.Message): - r"""The max cpc bid forecast curve. - - Attributes: - max_cpc_bid_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanMaxCpcBidForecast]): - The forecasts for the Keyword Plan campaign - at different max CPC bids. - """ - - max_cpc_bid_forecasts = proto.RepeatedField( - proto.MESSAGE, number=1, message="KeywordPlanMaxCpcBidForecast", - ) - - -class KeywordPlanMaxCpcBidForecast(proto.Message): - r"""The forecast of the campaign at a specific bid. - - Attributes: - max_cpc_bid_micros (int): - The max cpc bid in micros. - max_cpc_bid_forecast (google.ads.googleads.v6.services.types.ForecastMetrics): - The forecast for the Keyword Plan campaign at - the specific bid. - """ - - max_cpc_bid_micros = proto.Field(proto.INT64, number=3, optional=True) - max_cpc_bid_forecast = proto.Field( - proto.MESSAGE, number=2, message="ForecastMetrics", - ) - - -class KeywordPlanWeeklyTimeSeriesForecast(proto.Message): - r"""The weekly time series forecast for the keyword plan - campaign. - - Attributes: - keyword_plan_campaign (str): - The resource name of the Keyword Plan campaign related to - the forecast. - - ``customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}`` - weekly_forecasts (Sequence[google.ads.googleads.v6.services.types.KeywordPlanWeeklyForecast]): - The forecasts for the Keyword Plan campaign - at different max CPC bids. - """ - - keyword_plan_campaign = proto.Field(proto.STRING, number=1, optional=True) - weekly_forecasts = proto.RepeatedField( - proto.MESSAGE, number=2, message="KeywordPlanWeeklyForecast", - ) - - -class KeywordPlanWeeklyForecast(proto.Message): - r"""The forecast of the campaign for the week starting start_date. - - Attributes: - start_date (str): - The start date, in yyyy-mm-dd format. This - date is inclusive. - forecast (google.ads.googleads.v6.services.types.ForecastMetrics): - The forecast for the Keyword Plan campaign - for the week. - """ - - start_date = proto.Field(proto.STRING, number=1, optional=True) - forecast = proto.Field(proto.MESSAGE, number=2, message="ForecastMetrics",) - - -class ForecastMetrics(proto.Message): - r"""Forecast metrics. - - Attributes: - impressions (float): - Impressions - ctr (float): - Ctr - average_cpc (int): - AVG cpc - clicks (float): - Clicks - cost_micros (int): - Cost - """ - - impressions = proto.Field(proto.DOUBLE, number=7, optional=True) - ctr = proto.Field(proto.DOUBLE, number=8, optional=True) - average_cpc = proto.Field(proto.INT64, number=9, optional=True) - clicks = proto.Field(proto.DOUBLE, number=10, optional=True) - cost_micros = proto.Field(proto.INT64, number=11, optional=True) - - -class GenerateHistoricalMetricsRequest(proto.Message): - r"""Request message for - [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateHistoricalMetrics]. - - Attributes: - keyword_plan (str): - Required. The resource name of the keyword - plan of which historical metrics are requested. - """ - - keyword_plan = proto.Field(proto.STRING, number=1) - - -class GenerateHistoricalMetricsResponse(proto.Message): - r"""Response message for - [KeywordPlanService.GenerateHistoricalMetrics][google.ads.googleads.v6.services.KeywordPlanService.GenerateHistoricalMetrics]. - - Attributes: - metrics (Sequence[google.ads.googleads.v6.services.types.KeywordPlanKeywordHistoricalMetrics]): - List of keyword historical metrics. - """ - - metrics = proto.RepeatedField( - proto.MESSAGE, number=1, message="KeywordPlanKeywordHistoricalMetrics", - ) - - -class KeywordPlanKeywordHistoricalMetrics(proto.Message): - r"""A keyword historical metrics. - - Attributes: - search_query (str): - The text of the query associated with one or more - ad_group_keywords in the plan. - - Note that we de-dupe your keywords list, eliminating close - variants before returning the plan's keywords as text. For - example, if your plan originally contained the keywords - 'car' and 'cars', the returned search query will only - contain 'cars'. Starting V5, the list of de-duped queries - will be included in close_variants field. - close_variants (Sequence[str]): - The list of close variant queries for search_query whose - search results are combined into the search_query. - keyword_metrics (google.ads.googleads.v6.common.types.KeywordPlanHistoricalMetrics): - The historical metrics for the query associated with one or - more ad_group_keywords in the plan. - """ - - search_query = proto.Field(proto.STRING, number=4, optional=True) - close_variants = proto.RepeatedField(proto.STRING, number=3) - keyword_metrics = proto.Field( - proto.MESSAGE, - number=2, - message=keyword_plan_common.KeywordPlanHistoricalMetrics, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/keyword_view_service.py b/google/ads/googleads/v6/services/types/keyword_view_service.py deleted file mode 100644 index 9bdc80695..000000000 --- a/google/ads/googleads/v6/services/types/keyword_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetKeywordViewRequest",}, -) - - -class GetKeywordViewRequest(proto.Message): - r"""Request message for - [KeywordViewService.GetKeywordView][google.ads.googleads.v6.services.KeywordViewService.GetKeywordView]. - - Attributes: - resource_name (str): - Required. The resource name of the keyword - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/label_service.py b/google/ads/googleads/v6/services/types/label_service.py deleted file mode 100644 index dce5b0f43..000000000 --- a/google/ads/googleads/v6/services/types/label_service.py +++ /dev/null @@ -1,164 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import label as gagr_label -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetLabelRequest", - "MutateLabelsRequest", - "LabelOperation", - "MutateLabelsResponse", - "MutateLabelResult", - }, -) - - -class GetLabelRequest(proto.Message): - r"""Request message for - [LabelService.GetLabel][google.ads.googleads.v6.services.LabelService.GetLabel]. - - Attributes: - resource_name (str): - Required. The resource name of the label to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateLabelsRequest(proto.Message): - r"""Request message for - [LabelService.MutateLabels][google.ads.googleads.v6.services.LabelService.MutateLabels]. - - Attributes: - customer_id (str): - Required. ID of the customer whose labels are - being modified. - operations (Sequence[google.ads.googleads.v6.services.types.LabelOperation]): - Required. The list of operations to perform - on labels. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="LabelOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class LabelOperation(proto.Message): - r"""A single operation (create, remove, update) on a label. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.Label): - Create operation: No resource name is - expected for the new label. - update (google.ads.googleads.v6.resources.types.Label): - Update operation: The label is expected to - have a valid resource name. - remove (str): - Remove operation: A resource name for the label being - removed, in this format: - - ``customers/{customer_id}/labels/{label_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=gagr_label.Label, - ) - update = proto.Field( - proto.MESSAGE, number=2, oneof="operation", message=gagr_label.Label, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateLabelsResponse(proto.Message): - r"""Response message for a labels mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateLabelResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateLabelResult", - ) - - -class MutateLabelResult(proto.Message): - r"""The result for a label mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - label (google.ads.googleads.v6.resources.types.Label): - The mutated label with only mutable fields after mutate. The - field will only be returned when response_content_type is - set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - label = proto.Field(proto.MESSAGE, number=2, message=gagr_label.Label,) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/landing_page_view_service.py b/google/ads/googleads/v6/services/types/landing_page_view_service.py deleted file mode 100644 index 94c1d5ddc..000000000 --- a/google/ads/googleads/v6/services/types/landing_page_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetLandingPageViewRequest",}, -) - - -class GetLandingPageViewRequest(proto.Message): - r"""Request message for - [LandingPageViewService.GetLandingPageView][google.ads.googleads.v6.services.LandingPageViewService.GetLandingPageView]. - - Attributes: - resource_name (str): - Required. The resource name of the landing - page view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/language_constant_service.py b/google/ads/googleads/v6/services/types/language_constant_service.py deleted file mode 100644 index a7f3e1f09..000000000 --- a/google/ads/googleads/v6/services/types/language_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetLanguageConstantRequest",}, -) - - -class GetLanguageConstantRequest(proto.Message): - r"""Request message for - [LanguageConstantService.GetLanguageConstant][google.ads.googleads.v6.services.LanguageConstantService.GetLanguageConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the language - constant to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/location_view_service.py b/google/ads/googleads/v6/services/types/location_view_service.py deleted file mode 100644 index 5d87c2af5..000000000 --- a/google/ads/googleads/v6/services/types/location_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetLocationViewRequest",}, -) - - -class GetLocationViewRequest(proto.Message): - r"""Request message for - [LocationViewService.GetLocationView][google.ads.googleads.v6.services.LocationViewService.GetLocationView]. - - Attributes: - resource_name (str): - Required. The resource name of the location - view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/managed_placement_view_service.py b/google/ads/googleads/v6/services/types/managed_placement_view_service.py deleted file mode 100644 index 99a1ea918..000000000 --- a/google/ads/googleads/v6/services/types/managed_placement_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetManagedPlacementViewRequest",}, -) - - -class GetManagedPlacementViewRequest(proto.Message): - r"""Request message for - [ManagedPlacementViewService.GetManagedPlacementView][google.ads.googleads.v6.services.ManagedPlacementViewService.GetManagedPlacementView]. - - Attributes: - resource_name (str): - Required. The resource name of the Managed - Placement View to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/media_file_service.py b/google/ads/googleads/v6/services/types/media_file_service.py deleted file mode 100644 index 714c45c76..000000000 --- a/google/ads/googleads/v6/services/types/media_file_service.py +++ /dev/null @@ -1,153 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - media_file as gagr_media_file, -) -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetMediaFileRequest", - "MutateMediaFilesRequest", - "MediaFileOperation", - "MutateMediaFilesResponse", - "MutateMediaFileResult", - }, -) - - -class GetMediaFileRequest(proto.Message): - r"""Request message for - [MediaFileService.GetMediaFile][google.ads.googleads.v6.services.MediaFileService.GetMediaFile] - - Attributes: - resource_name (str): - Required. The resource name of the media file - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateMediaFilesRequest(proto.Message): - r"""Request message for - [MediaFileService.MutateMediaFiles][google.ads.googleads.v6.services.MediaFileService.MutateMediaFiles] - - Attributes: - customer_id (str): - Required. The ID of the customer whose media - files are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.MediaFileOperation]): - Required. The list of operations to perform - on individual media file. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="MediaFileOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class MediaFileOperation(proto.Message): - r"""A single operation to create media file. - - Attributes: - create (google.ads.googleads.v6.resources.types.MediaFile): - Create operation: No resource name is - expected for the new media file. - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_media_file.MediaFile, - ) - - -class MutateMediaFilesResponse(proto.Message): - r"""Response message for a media file mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateMediaFileResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateMediaFileResult", - ) - - -class MutateMediaFileResult(proto.Message): - r"""The result for the media file mutate. - - Attributes: - resource_name (str): - The resource name returned for successful - operations. - media_file (google.ads.googleads.v6.resources.types.MediaFile): - The mutated media file with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - media_file = proto.Field( - proto.MESSAGE, number=2, message=gagr_media_file.MediaFile, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/merchant_center_link_service.py b/google/ads/googleads/v6/services/types/merchant_center_link_service.py deleted file mode 100644 index fa1807c08..000000000 --- a/google/ads/googleads/v6/services/types/merchant_center_link_service.py +++ /dev/null @@ -1,156 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import merchant_center_link -from google.protobuf import field_mask_pb2 as field_mask # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "ListMerchantCenterLinksRequest", - "ListMerchantCenterLinksResponse", - "GetMerchantCenterLinkRequest", - "MutateMerchantCenterLinkRequest", - "MerchantCenterLinkOperation", - "MutateMerchantCenterLinkResponse", - "MutateMerchantCenterLinkResult", - }, -) - - -class ListMerchantCenterLinksRequest(proto.Message): - r"""Request message for - [MerchantCenterLinkService.ListMerchantCenterLinks][google.ads.googleads.v6.services.MerchantCenterLinkService.ListMerchantCenterLinks]. - - Attributes: - customer_id (str): - Required. The ID of the customer onto which - to apply the Merchant Center link list - operation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - - -class ListMerchantCenterLinksResponse(proto.Message): - r"""Response message for - [MerchantCenterLinkService.ListMerchantCenterLinks][google.ads.googleads.v6.services.MerchantCenterLinkService.ListMerchantCenterLinks]. - - Attributes: - merchant_center_links (Sequence[google.ads.googleads.v6.resources.types.MerchantCenterLink]): - Merchant Center links available for the - requested customer - """ - - merchant_center_links = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=merchant_center_link.MerchantCenterLink, - ) - - -class GetMerchantCenterLinkRequest(proto.Message): - r"""Request message for - [MerchantCenterLinkService.GetMerchantCenterLink][google.ads.googleads.v6.services.MerchantCenterLinkService.GetMerchantCenterLink]. - - Attributes: - resource_name (str): - Required. Resource name of the Merchant - Center link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateMerchantCenterLinkRequest(proto.Message): - r"""Request message for - [MerchantCenterLinkService.MutateMerchantCenterLink][google.ads.googleads.v6.services.MerchantCenterLinkService.MutateMerchantCenterLink]. - - Attributes: - customer_id (str): - Required. The ID of the customer being - modified. - operation (google.ads.googleads.v6.services.types.MerchantCenterLinkOperation): - Required. The operation to perform on the - link - """ - - customer_id = proto.Field(proto.STRING, number=1) - operation = proto.Field( - proto.MESSAGE, number=2, message="MerchantCenterLinkOperation", - ) - - -class MerchantCenterLinkOperation(proto.Message): - r"""A single update on a Merchant Center link. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - update (google.ads.googleads.v6.resources.types.MerchantCenterLink): - Update operation: The merchant center link is - expected to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed merchant - center link is expected, in this format: - - ``customers/{customer_id}/merchantCenterLinks/{merchant_center_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=3, message=field_mask.FieldMask, - ) - update = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=merchant_center_link.MerchantCenterLink, - ) - remove = proto.Field(proto.STRING, number=2, oneof="operation") - - -class MutateMerchantCenterLinkResponse(proto.Message): - r"""Response message for Merchant Center link mutate. - - Attributes: - result (google.ads.googleads.v6.services.types.MutateMerchantCenterLinkResult): - Result for the mutate. - """ - - result = proto.Field( - proto.MESSAGE, number=2, message="MutateMerchantCenterLinkResult", - ) - - -class MutateMerchantCenterLinkResult(proto.Message): - r"""The result for the Merchant Center link mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/mobile_app_category_constant_service.py b/google/ads/googleads/v6/services/types/mobile_app_category_constant_service.py deleted file mode 100644 index b987221ef..000000000 --- a/google/ads/googleads/v6/services/types/mobile_app_category_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetMobileAppCategoryConstantRequest",}, -) - - -class GetMobileAppCategoryConstantRequest(proto.Message): - r"""Request message for - [MobileAppCategoryConstantService.GetMobileAppCategoryConstant][google.ads.googleads.v6.services.MobileAppCategoryConstantService.GetMobileAppCategoryConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the mobile app - category constant to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/mobile_device_constant_service.py b/google/ads/googleads/v6/services/types/mobile_device_constant_service.py deleted file mode 100644 index c4db80ddf..000000000 --- a/google/ads/googleads/v6/services/types/mobile_device_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetMobileDeviceConstantRequest",}, -) - - -class GetMobileDeviceConstantRequest(proto.Message): - r"""Request message for - [MobileDeviceConstantService.GetMobileDeviceConstant][google.ads.googleads.v6.services.MobileDeviceConstantService.GetMobileDeviceConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the mobile device - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/offline_user_data_job_service.py b/google/ads/googleads/v6/services/types/offline_user_data_job_service.py deleted file mode 100644 index eb48e3853..000000000 --- a/google/ads/googleads/v6/services/types/offline_user_data_job_service.py +++ /dev/null @@ -1,172 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import offline_user_data -from google.ads.googleads.v6.resources.types import offline_user_data_job -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "CreateOfflineUserDataJobRequest", - "CreateOfflineUserDataJobResponse", - "GetOfflineUserDataJobRequest", - "RunOfflineUserDataJobRequest", - "AddOfflineUserDataJobOperationsRequest", - "OfflineUserDataJobOperation", - "AddOfflineUserDataJobOperationsResponse", - }, -) - - -class CreateOfflineUserDataJobRequest(proto.Message): - r"""Request message for - [OfflineUserDataJobService.CreateOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.CreateOfflineUserDataJob]. - - Attributes: - customer_id (str): - Required. The ID of the customer for which to - create an offline user data job. - job (google.ads.googleads.v6.resources.types.OfflineUserDataJob): - Required. The offline user data job to be - created. - """ - - customer_id = proto.Field(proto.STRING, number=1) - job = proto.Field( - proto.MESSAGE, - number=2, - message=offline_user_data_job.OfflineUserDataJob, - ) - - -class CreateOfflineUserDataJobResponse(proto.Message): - r"""Response message for - [OfflineUserDataJobService.CreateOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.CreateOfflineUserDataJob]. - - Attributes: - resource_name (str): - The resource name of the OfflineUserDataJob. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class GetOfflineUserDataJobRequest(proto.Message): - r"""Request message for - [OfflineUserDataJobService.GetOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.GetOfflineUserDataJob]. - - Attributes: - resource_name (str): - Required. The resource name of the - OfflineUserDataJob to get. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class RunOfflineUserDataJobRequest(proto.Message): - r"""Request message for - [OfflineUserDataJobService.RunOfflineUserDataJob][google.ads.googleads.v6.services.OfflineUserDataJobService.RunOfflineUserDataJob]. - - Attributes: - resource_name (str): - Required. The resource name of the - OfflineUserDataJob to run. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class AddOfflineUserDataJobOperationsRequest(proto.Message): - r"""Request message for - [OfflineUserDataJobService.AddOfflineUserDataJobOperations][google.ads.googleads.v6.services.OfflineUserDataJobService.AddOfflineUserDataJobOperations]. - - Attributes: - resource_name (str): - Required. The resource name of the - OfflineUserDataJob. - enable_partial_failure (bool): - True to enable partial failure for the - offline user data job. - operations (Sequence[google.ads.googleads.v6.services.types.OfflineUserDataJobOperation]): - Required. The list of operations to be done. - """ - - resource_name = proto.Field(proto.STRING, number=1) - enable_partial_failure = proto.Field(proto.BOOL, number=4, optional=True) - operations = proto.RepeatedField( - proto.MESSAGE, number=3, message="OfflineUserDataJobOperation", - ) - - -class OfflineUserDataJobOperation(proto.Message): - r"""Operation to be made for the - AddOfflineUserDataJobOperationsRequest. - - Attributes: - create (google.ads.googleads.v6.common.types.UserData): - Add the provided data to the transaction. - Data cannot be retrieved after being uploaded. - remove (google.ads.googleads.v6.common.types.UserData): - Remove the provided data from the - transaction. Data cannot be retrieved after - being uploaded. - remove_all (bool): - Remove all previously provided data. This is - only supported for Customer Match. - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=offline_user_data.UserData, - ) - remove = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=offline_user_data.UserData, - ) - remove_all = proto.Field(proto.BOOL, number=3, oneof="operation") - - -class AddOfflineUserDataJobOperationsResponse(proto.Message): - r"""Response message for - [OfflineUserDataJobService.AddOfflineUserDataJobOperations][google.ads.googleads.v6.services.OfflineUserDataJobService.AddOfflineUserDataJobOperations]. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=1, message=status.Status, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/operating_system_version_constant_service.py b/google/ads/googleads/v6/services/types/operating_system_version_constant_service.py deleted file mode 100644 index 90e1c5464..000000000 --- a/google/ads/googleads/v6/services/types/operating_system_version_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetOperatingSystemVersionConstantRequest",}, -) - - -class GetOperatingSystemVersionConstantRequest(proto.Message): - r"""Request message for - [OperatingSystemVersionConstantService.GetOperatingSystemVersionConstant][google.ads.googleads.v6.services.OperatingSystemVersionConstantService.GetOperatingSystemVersionConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the OS version to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/paid_organic_search_term_view_service.py b/google/ads/googleads/v6/services/types/paid_organic_search_term_view_service.py deleted file mode 100644 index 859ef8d43..000000000 --- a/google/ads/googleads/v6/services/types/paid_organic_search_term_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetPaidOrganicSearchTermViewRequest",}, -) - - -class GetPaidOrganicSearchTermViewRequest(proto.Message): - r"""Request message for - [PaidOrganicSearchTermViewService.GetPaidOrganicSearchTermView][google.ads.googleads.v6.services.PaidOrganicSearchTermViewService.GetPaidOrganicSearchTermView]. - - Attributes: - resource_name (str): - Required. The resource name of the paid - organic search term view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/parental_status_view_service.py b/google/ads/googleads/v6/services/types/parental_status_view_service.py deleted file mode 100644 index 5ebb17757..000000000 --- a/google/ads/googleads/v6/services/types/parental_status_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetParentalStatusViewRequest",}, -) - - -class GetParentalStatusViewRequest(proto.Message): - r"""Request message for - [ParentalStatusViewService.GetParentalStatusView][google.ads.googleads.v6.services.ParentalStatusViewService.GetParentalStatusView]. - - Attributes: - resource_name (str): - Required. The resource name of the parental - status view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/payments_account_service.py b/google/ads/googleads/v6/services/types/payments_account_service.py deleted file mode 100644 index 1757b2f9a..000000000 --- a/google/ads/googleads/v6/services/types/payments_account_service.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import payments_account - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"ListPaymentsAccountsRequest", "ListPaymentsAccountsResponse",}, -) - - -class ListPaymentsAccountsRequest(proto.Message): - r"""Request message for fetching all accessible payments - accounts. - - Attributes: - customer_id (str): - Required. The ID of the customer to apply the - PaymentsAccount list operation to. - """ - - customer_id = proto.Field(proto.STRING, number=1) - - -class ListPaymentsAccountsResponse(proto.Message): - r"""Response message for - [PaymentsAccountService.ListPaymentsAccounts][google.ads.googleads.v6.services.PaymentsAccountService.ListPaymentsAccounts]. - - Attributes: - payments_accounts (Sequence[google.ads.googleads.v6.resources.types.PaymentsAccount]): - The list of accessible payments accounts. - """ - - payments_accounts = proto.RepeatedField( - proto.MESSAGE, number=1, message=payments_account.PaymentsAccount, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/product_bidding_category_constant_service.py b/google/ads/googleads/v6/services/types/product_bidding_category_constant_service.py deleted file mode 100644 index 38af0050c..000000000 --- a/google/ads/googleads/v6/services/types/product_bidding_category_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetProductBiddingCategoryConstantRequest",}, -) - - -class GetProductBiddingCategoryConstantRequest(proto.Message): - r"""Request message for - [ProductBiddingCategoryConstantService.GetProductBiddingCategoryConstant][google.ads.googleads.v6.services.ProductBiddingCategoryConstantService.GetProductBiddingCategoryConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the Product - Bidding Category to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/product_group_view_service.py b/google/ads/googleads/v6/services/types/product_group_view_service.py deleted file mode 100644 index 0e36d4ab6..000000000 --- a/google/ads/googleads/v6/services/types/product_group_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetProductGroupViewRequest",}, -) - - -class GetProductGroupViewRequest(proto.Message): - r"""Request message for - [ProductGroupViewService.GetProductGroupView][google.ads.googleads.v6.services.ProductGroupViewService.GetProductGroupView]. - - Attributes: - resource_name (str): - Required. The resource name of the product - group view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/reach_plan_service.py b/google/ads/googleads/v6/services/types/reach_plan_service.py deleted file mode 100644 index 9f540df51..000000000 --- a/google/ads/googleads/v6/services/types/reach_plan_service.py +++ /dev/null @@ -1,609 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import criteria -from google.ads.googleads.v6.enums.types import frequency_cap_time_unit -from google.ads.googleads.v6.enums.types import reach_plan_ad_length -from google.ads.googleads.v6.enums.types import reach_plan_age_range -from google.ads.googleads.v6.enums.types import reach_plan_network - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "ListPlannableLocationsRequest", - "ListPlannableLocationsResponse", - "PlannableLocation", - "ListPlannableProductsRequest", - "ListPlannableProductsResponse", - "ProductMetadata", - "PlannableTargeting", - "GenerateProductMixIdeasRequest", - "Preferences", - "GenerateProductMixIdeasResponse", - "ProductAllocation", - "GenerateReachForecastRequest", - "FrequencyCap", - "Targeting", - "CampaignDuration", - "PlannedProduct", - "GenerateReachForecastResponse", - "ReachCurve", - "ReachForecast", - "Forecast", - "PlannedProductReachForecast", - "PlannedProductForecast", - "OnTargetAudienceMetrics", - }, -) - - -class ListPlannableLocationsRequest(proto.Message): - r"""Request message for - [ReachPlanService.ListPlannableLocations][google.ads.googleads.v6.services.ReachPlanService.ListPlannableLocations]. - """ - - -class ListPlannableLocationsResponse(proto.Message): - r"""The list of plannable locations. - - Attributes: - plannable_locations (Sequence[google.ads.googleads.v6.services.types.PlannableLocation]): - The list of locations available for planning - (Countries, DMAs, sub-countries). - For locations like Countries, DMAs see - https://developers.google.com/adwords/api/docs/appendix/geotargeting - for more information. - """ - - plannable_locations = proto.RepeatedField( - proto.MESSAGE, number=1, message="PlannableLocation", - ) - - -class PlannableLocation(proto.Message): - r"""A plannable location: a country, a DMA, a metro region, a tv - region, a province. - - Attributes: - id (str): - The location identifier. - name (str): - The unique location name in english. - parent_country_id (int): - The parent country code, not present if - location is a country. If present will always be - a criterion id: additional information, such as - country name are returned both via - ListPlannableLocations or directly by accessing - GeoTargetConstantService with the criterion id. - """ - - id = proto.Field(proto.STRING, number=4, optional=True) - name = proto.Field(proto.STRING, number=5, optional=True) - parent_country_id = proto.Field(proto.INT64, number=6, optional=True) - - -class ListPlannableProductsRequest(proto.Message): - r"""Request to list available products in a given location. - - Attributes: - plannable_location_id (str): - Required. The ID of the selected location for - planning. To list the available plannable - location ids use ListPlannableLocations. - """ - - plannable_location_id = proto.Field(proto.STRING, number=2) - - -class ListPlannableProductsResponse(proto.Message): - r"""A response with all available products. - - Attributes: - product_metadata (Sequence[google.ads.googleads.v6.services.types.ProductMetadata]): - The list of products available for planning - and related targeting metadata. - """ - - product_metadata = proto.RepeatedField( - proto.MESSAGE, number=1, message="ProductMetadata", - ) - - -class ProductMetadata(proto.Message): - r"""The metadata associated with an available plannable product. - - Attributes: - plannable_product_code (str): - The code associated with the ad product. E.g. BUMPER, - TRUEVIEW_IN_STREAM To list the available plannable product - codes use ListPlannableProducts. - plannable_product_name (str): - The name associated with the ad product. - plannable_targeting (google.ads.googleads.v6.services.types.PlannableTargeting): - The allowed plannable targeting for this - product. - """ - - plannable_product_code = proto.Field(proto.STRING, number=4, optional=True) - plannable_product_name = proto.Field(proto.STRING, number=3) - plannable_targeting = proto.Field( - proto.MESSAGE, number=2, message="PlannableTargeting", - ) - - -class PlannableTargeting(proto.Message): - r"""The targeting for which traffic metrics will be reported. - - Attributes: - age_ranges (Sequence[google.ads.googleads.v6.enums.types.ReachPlanAgeRangeEnum.ReachPlanAgeRange]): - Allowed plannable age ranges for the product - for which metrics will be reported. Actual - targeting is computed by mapping this age range - onto standard Google common.AgeRangeInfo values. - genders (Sequence[google.ads.googleads.v6.common.types.GenderInfo]): - Targetable genders for the ad product. - devices (Sequence[google.ads.googleads.v6.common.types.DeviceInfo]): - Targetable devices for the ad product. - networks (Sequence[google.ads.googleads.v6.enums.types.ReachPlanNetworkEnum.ReachPlanNetwork]): - Targetable networks for the ad product. - """ - - age_ranges = proto.RepeatedField( - proto.ENUM, - number=1, - enum=reach_plan_age_range.ReachPlanAgeRangeEnum.ReachPlanAgeRange, - ) - genders = proto.RepeatedField( - proto.MESSAGE, number=2, message=criteria.GenderInfo, - ) - devices = proto.RepeatedField( - proto.MESSAGE, number=3, message=criteria.DeviceInfo, - ) - networks = proto.RepeatedField( - proto.ENUM, - number=4, - enum=reach_plan_network.ReachPlanNetworkEnum.ReachPlanNetwork, - ) - - -class GenerateProductMixIdeasRequest(proto.Message): - r"""Request message for - [ReachPlanService.GenerateProductMixIdeas][google.ads.googleads.v6.services.ReachPlanService.GenerateProductMixIdeas]. - - Attributes: - customer_id (str): - Required. The ID of the customer. - plannable_location_id (str): - Required. The ID of the location, this is one - of the ids returned by ListPlannableLocations. - currency_code (str): - Required. Currency code. - Three-character ISO 4217 currency code. - budget_micros (int): - Required. Total budget. - Amount in micros. One million is equivalent to - one unit. - preferences (google.ads.googleads.v6.services.types.Preferences): - The preferences of the suggested product mix. - An unset preference is interpreted as all - possible values are allowed, unless explicitly - specified. - """ - - customer_id = proto.Field(proto.STRING, number=1) - plannable_location_id = proto.Field(proto.STRING, number=6) - currency_code = proto.Field(proto.STRING, number=7) - budget_micros = proto.Field(proto.INT64, number=8) - preferences = proto.Field(proto.MESSAGE, number=5, message="Preferences",) - - -class Preferences(proto.Message): - r"""Set of preferences about the planned mix. - - Attributes: - is_skippable (bool): - True if ad skippable. - If not set, default is any value. - starts_with_sound (bool): - True if ad start with sound. - If not set, default is any value. - ad_length (google.ads.googleads.v6.enums.types.ReachPlanAdLengthEnum.ReachPlanAdLength): - The length of the ad. - If not set, default is any value. - top_content_only (bool): - True if ad will only show on the top content. - If not set, default is false. - has_guaranteed_price (bool): - True if the price guaranteed. The cost of - serving the ad is agreed upfront and not subject - to an auction. If not set, default is any value. - """ - - is_skippable = proto.Field(proto.BOOL, number=6, optional=True) - starts_with_sound = proto.Field(proto.BOOL, number=7, optional=True) - ad_length = proto.Field( - proto.ENUM, - number=3, - enum=reach_plan_ad_length.ReachPlanAdLengthEnum.ReachPlanAdLength, - ) - top_content_only = proto.Field(proto.BOOL, number=8, optional=True) - has_guaranteed_price = proto.Field(proto.BOOL, number=9, optional=True) - - -class GenerateProductMixIdeasResponse(proto.Message): - r"""The suggested product mix. - - Attributes: - product_allocation (Sequence[google.ads.googleads.v6.services.types.ProductAllocation]): - A list of products (ad formats) and the - associated budget allocation idea. - """ - - product_allocation = proto.RepeatedField( - proto.MESSAGE, number=1, message="ProductAllocation", - ) - - -class ProductAllocation(proto.Message): - r"""An allocation of a part of the budget on a given product. - - Attributes: - plannable_product_code (str): - Selected product for planning. The product - codes returned are within the set of the ones - returned by ListPlannableProducts when using the - same location id. - budget_micros (int): - The value to be allocated for the suggested - product in requested currency. Amount in micros. - One million is equivalent to one unit. - """ - - plannable_product_code = proto.Field(proto.STRING, number=3, optional=True) - budget_micros = proto.Field(proto.INT64, number=4, optional=True) - - -class GenerateReachForecastRequest(proto.Message): - r"""Request message for - [ReachPlanService.GenerateReachForecast][google.ads.googleads.v6.services.ReachPlanService.GenerateReachForecast]. - - Attributes: - customer_id (str): - Required. The ID of the customer. - currency_code (str): - The currency code. - Three-character ISO 4217 currency code. - campaign_duration (google.ads.googleads.v6.services.types.CampaignDuration): - Required. Campaign duration. - cookie_frequency_cap (int): - Desired cookie frequency cap that will be applied to each - planned product. This is equivalent to the frequency cap - exposed in Google Ads when creating a campaign, it - represents the maximum number of times an ad can be shown to - the same user. If not specified no cap is applied. - - This field is deprecated in v4 and will eventually be - removed. Please use cookie_frequency_cap_setting instead. - cookie_frequency_cap_setting (google.ads.googleads.v6.services.types.FrequencyCap): - Desired cookie frequency cap that will be applied to each - planned product. This is equivalent to the frequency cap - exposed in Google Ads when creating a campaign, it - represents the maximum number of times an ad can be shown to - the same user during a specified time interval. If not - specified, no cap is applied. - - This field replaces the deprecated cookie_frequency_cap - field. - min_effective_frequency (int): - Desired minimum effective frequency (the number of times a - person was exposed to the ad) for the reported reach metrics - [1-10]. This won't affect the targeting, but just the - reporting. If not specified, a default of 1 is applied. - targeting (google.ads.googleads.v6.services.types.Targeting): - The targeting to be applied to all products selected in the - product mix. - - This is planned targeting: execution details might vary - based on the advertising product, please consult an - implementation specialist. - - See specific metrics for details on how targeting affects - them. - - In some cases, targeting may be overridden using the - PlannedProduct.advanced_product_targeting field. - planned_products (Sequence[google.ads.googleads.v6.services.types.PlannedProduct]): - Required. The products to be forecast. - The max number of allowed planned products is - 15. - """ - - customer_id = proto.Field(proto.STRING, number=1) - currency_code = proto.Field(proto.STRING, number=9, optional=True) - campaign_duration = proto.Field( - proto.MESSAGE, number=3, message="CampaignDuration", - ) - cookie_frequency_cap = proto.Field(proto.INT32, number=10, optional=True) - cookie_frequency_cap_setting = proto.Field( - proto.MESSAGE, number=8, message="FrequencyCap", - ) - min_effective_frequency = proto.Field(proto.INT32, number=11, optional=True) - targeting = proto.Field(proto.MESSAGE, number=6, message="Targeting",) - planned_products = proto.RepeatedField( - proto.MESSAGE, number=7, message="PlannedProduct", - ) - - -class FrequencyCap(proto.Message): - r"""A rule specifying the maximum number of times an ad can be - shown to a user over a particular time period. - - Attributes: - impressions (int): - Required. The number of impressions, - inclusive. - time_unit (google.ads.googleads.v6.enums.types.FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit): - Required. The type of time unit. - """ - - impressions = proto.Field(proto.INT32, number=3) - time_unit = proto.Field( - proto.ENUM, - number=2, - enum=frequency_cap_time_unit.FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit, - ) - - -class Targeting(proto.Message): - r"""The targeting for which traffic metrics will be reported. - - Attributes: - plannable_location_id (str): - Required. The ID of the selected location. - Plannable locations ID can be obtained from - ListPlannableLocations. - age_range (google.ads.googleads.v6.enums.types.ReachPlanAgeRangeEnum.ReachPlanAgeRange): - Targeted age range. - If not specified, targets all age ranges. - genders (Sequence[google.ads.googleads.v6.common.types.GenderInfo]): - Targeted genders. - If not specified, targets all genders. - devices (Sequence[google.ads.googleads.v6.common.types.DeviceInfo]): - Targeted devices. - If not specified, targets all applicable - devices. Applicable devices vary by product and - region and can be obtained from - ListPlannableProducts. - network (google.ads.googleads.v6.enums.types.ReachPlanNetworkEnum.ReachPlanNetwork): - Targetable network for the ad product. - If not specified, targets all applicable - networks. Applicable networks vary by product - and region and can be obtained from - ListPlannableProducts. - """ - - plannable_location_id = proto.Field(proto.STRING, number=6, optional=True) - age_range = proto.Field( - proto.ENUM, - number=2, - enum=reach_plan_age_range.ReachPlanAgeRangeEnum.ReachPlanAgeRange, - ) - genders = proto.RepeatedField( - proto.MESSAGE, number=3, message=criteria.GenderInfo, - ) - devices = proto.RepeatedField( - proto.MESSAGE, number=4, message=criteria.DeviceInfo, - ) - network = proto.Field( - proto.ENUM, - number=5, - enum=reach_plan_network.ReachPlanNetworkEnum.ReachPlanNetwork, - ) - - -class CampaignDuration(proto.Message): - r"""The duration of a planned campaign. - - Attributes: - duration_in_days (int): - The duration value in days. - """ - - duration_in_days = proto.Field(proto.INT32, number=2, optional=True) - - -class PlannedProduct(proto.Message): - r"""A product being planned for reach. - - Attributes: - plannable_product_code (str): - Required. Selected product for planning. - The code associated with the ad product. E.g. - Trueview, Bumper To list the available plannable - product codes use ListPlannableProducts. - budget_micros (int): - Required. Maximum budget allocation in micros for the - selected product. The value is specified in the selected - planning currency_code. E.g. 1 000 000$ = 1 000 000 000 000 - micros. - """ - - plannable_product_code = proto.Field(proto.STRING, number=3, optional=True) - budget_micros = proto.Field(proto.INT64, number=4, optional=True) - - -class GenerateReachForecastResponse(proto.Message): - r"""Response message containing the generated reach curve. - - Attributes: - on_target_audience_metrics (google.ads.googleads.v6.services.types.OnTargetAudienceMetrics): - Reference on target audiences for this curve. - reach_curve (google.ads.googleads.v6.services.types.ReachCurve): - The generated reach curve for the planned - product mix. - """ - - on_target_audience_metrics = proto.Field( - proto.MESSAGE, number=1, message="OnTargetAudienceMetrics", - ) - reach_curve = proto.Field(proto.MESSAGE, number=2, message="ReachCurve",) - - -class ReachCurve(proto.Message): - r"""The reach curve for the planned products. - - Attributes: - reach_forecasts (Sequence[google.ads.googleads.v6.services.types.ReachForecast]): - All points on the reach curve. - """ - - reach_forecasts = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReachForecast", - ) - - -class ReachForecast(proto.Message): - r"""A point on reach curve. - - Attributes: - cost_micros (int): - The cost in micros. - forecast (google.ads.googleads.v6.services.types.Forecast): - Forecasted traffic metrics for this point. - planned_product_reach_forecasts (Sequence[google.ads.googleads.v6.services.types.PlannedProductReachForecast]): - The forecasted allocation and traffic metrics - for each planned product at this point on the - reach curve. - """ - - cost_micros = proto.Field(proto.INT64, number=5) - forecast = proto.Field(proto.MESSAGE, number=2, message="Forecast",) - planned_product_reach_forecasts = proto.RepeatedField( - proto.MESSAGE, number=4, message="PlannedProductReachForecast", - ) - - -class Forecast(proto.Message): - r"""Forecasted traffic metrics for the planned products and - targeting. - - Attributes: - on_target_reach (int): - Number of unique people reached at least - GenerateReachForecastRequest.min_effective_frequency times - that exactly matches the Targeting. - total_reach (int): - Total number of unique people reached at least - GenerateReachForecastRequest.min_effective_frequency times. - This includes people that may fall outside the specified - Targeting. - on_target_impressions (int): - Number of ad impressions that exactly matches - the Targeting. - total_impressions (int): - Total number of ad impressions. This includes - impressions that may fall outside the specified - Targeting, due to insufficient information on - signed-in users. - """ - - on_target_reach = proto.Field(proto.INT64, number=5, optional=True) - total_reach = proto.Field(proto.INT64, number=6, optional=True) - on_target_impressions = proto.Field(proto.INT64, number=7, optional=True) - total_impressions = proto.Field(proto.INT64, number=8, optional=True) - - -class PlannedProductReachForecast(proto.Message): - r"""The forecasted allocation and traffic metrics for a specific - product at a point on the reach curve. - - Attributes: - plannable_product_code (str): - Selected product for planning. The product - codes returned are within the set of the ones - returned by ListPlannableProducts when using the - same location id. - cost_micros (int): - The cost in micros. This may differ from the - product's input allocation if one or more - planned products cannot fulfill the budget - because of limited inventory. - planned_product_forecast (google.ads.googleads.v6.services.types.PlannedProductForecast): - Forecasted traffic metrics for this product. - """ - - plannable_product_code = proto.Field(proto.STRING, number=1) - cost_micros = proto.Field(proto.INT64, number=2) - planned_product_forecast = proto.Field( - proto.MESSAGE, number=3, message="PlannedProductForecast", - ) - - -class PlannedProductForecast(proto.Message): - r"""Forecasted traffic metrics for a planned product. - - Attributes: - on_target_reach (int): - Number of unique people reached that exactly - matches the Targeting. - total_reach (int): - Number of unique people reached. This - includes people that may fall outside the - specified Targeting. - on_target_impressions (int): - Number of ad impressions that exactly matches - the Targeting. - total_impressions (int): - Total number of ad impressions. This includes - impressions that may fall outside the specified - Targeting, due to insufficient information on - signed-in users. - """ - - on_target_reach = proto.Field(proto.INT64, number=1) - total_reach = proto.Field(proto.INT64, number=2) - on_target_impressions = proto.Field(proto.INT64, number=3) - total_impressions = proto.Field(proto.INT64, number=4) - - -class OnTargetAudienceMetrics(proto.Message): - r"""Audience metrics for the planned products. - These metrics consider the following targeting dimensions: - - Location - - PlannableAgeRange - - Gender - - Attributes: - youtube_audience_size (int): - Reference audience size matching the - considered targeting for YouTube. - census_audience_size (int): - Reference audience size matching the - considered targeting for Census. - """ - - youtube_audience_size = proto.Field(proto.INT64, number=3, optional=True) - census_audience_size = proto.Field(proto.INT64, number=4, optional=True) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/recommendation_service.py b/google/ads/googleads/v6/services/types/recommendation_service.py deleted file mode 100644 index be785e4dd..000000000 --- a/google/ads/googleads/v6/services/types/recommendation_service.py +++ /dev/null @@ -1,450 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import extensions -from google.ads.googleads.v6.enums.types import keyword_match_type -from google.ads.googleads.v6.resources.types import ad as gagr_ad -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetRecommendationRequest", - "ApplyRecommendationRequest", - "ApplyRecommendationOperation", - "ApplyRecommendationResponse", - "ApplyRecommendationResult", - "DismissRecommendationRequest", - "DismissRecommendationResponse", - }, -) - - -class GetRecommendationRequest(proto.Message): - r"""Request message for - [RecommendationService.GetRecommendation][google.ads.googleads.v6.services.RecommendationService.GetRecommendation]. - - Attributes: - resource_name (str): - Required. The resource name of the - recommendation to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class ApplyRecommendationRequest(proto.Message): - r"""Request message for - [RecommendationService.ApplyRecommendation][google.ads.googleads.v6.services.RecommendationService.ApplyRecommendation]. - - Attributes: - customer_id (str): - Required. The ID of the customer with the - recommendation. - operations (Sequence[google.ads.googleads.v6.services.types.ApplyRecommendationOperation]): - Required. The list of operations to apply recommendations. - If partial_failure=false all recommendations should be of - the same type There is a limit of 100 operations per - request. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, operations will be carried out - as a transaction if and only if they are all - valid. Default is false. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="ApplyRecommendationOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - - -class ApplyRecommendationOperation(proto.Message): - r"""Information about the operation to apply a recommendation and - any parameters to customize it. - - Attributes: - resource_name (str): - The resource name of the recommendation to - apply. - campaign_budget (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.CampaignBudgetParameters): - Optional parameters to use when applying a - campaign budget recommendation. - text_ad (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.TextAdParameters): - Optional parameters to use when applying a - text ad recommendation. - keyword (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.KeywordParameters): - Optional parameters to use when applying - keyword recommendation. - target_cpa_opt_in (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.TargetCpaOptInParameters): - Optional parameters to use when applying - target CPA opt-in recommendation. - target_roas_opt_in (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.TargetRoasOptInParameters): - Optional parameters to use when applying - target ROAS opt-in recommendation. - callout_extension (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.CalloutExtensionParameters): - Parameters to use when applying callout - extension recommendation. - call_extension (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.CallExtensionParameters): - Parameters to use when applying call - extension recommendation. - sitelink_extension (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.SitelinkExtensionParameters): - Parameters to use when applying sitelink - extension recommendation. - move_unused_budget (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.MoveUnusedBudgetParameters): - Parameters to use when applying move unused - budget recommendation. - responsive_search_ad (google.ads.googleads.v6.services.types.ApplyRecommendationOperation.ResponsiveSearchAdParameters): - Parameters to use when applying a responsive - search ad recommendation. - """ - - class CampaignBudgetParameters(proto.Message): - r"""Parameters to use when applying a campaign budget - recommendation. - - Attributes: - new_budget_amount_micros (int): - New budget amount to set for target budget - resource. This is a required field. - """ - - new_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True - ) - - class TextAdParameters(proto.Message): - r"""Parameters to use when applying a text ad recommendation. - - Attributes: - ad (google.ads.googleads.v6.resources.types.Ad): - New ad to add to recommended ad group. All - necessary fields need to be set in this message. - This is a required field. - """ - - ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) - - class KeywordParameters(proto.Message): - r"""Parameters to use when applying keyword recommendation. - - Attributes: - ad_group (str): - The ad group resource to add keyword to. This - is a required field. - match_type (google.ads.googleads.v6.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - The match type of the keyword. This is a - required field. - cpc_bid_micros (int): - Optional, CPC bid to set for the keyword. If - not set, keyword will use bid based on bidding - strategy used by target ad group. - """ - - ad_group = proto.Field(proto.STRING, number=4, optional=True) - match_type = proto.Field( - proto.ENUM, - number=2, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - cpc_bid_micros = proto.Field(proto.INT64, number=5, optional=True) - - class TargetCpaOptInParameters(proto.Message): - r"""Parameters to use when applying Target CPA recommendation. - - Attributes: - target_cpa_micros (int): - Average CPA to use for Target CPA bidding - strategy. This is a required field. - new_campaign_budget_amount_micros (int): - Optional, budget amount to set for the - campaign. - """ - - target_cpa_micros = proto.Field(proto.INT64, number=3, optional=True) - new_campaign_budget_amount_micros = proto.Field( - proto.INT64, number=4, optional=True - ) - - class TargetRoasOptInParameters(proto.Message): - r"""Parameters to use when applying a Target ROAS opt-in - recommendation. - - Attributes: - target_roas (float): - Average ROAS (revenue per unit of spend) to - use for Target ROAS bidding strategy. The value - is between 0.01 and 1000.0, inclusive. This is a - required field. - new_campaign_budget_amount_micros (int): - Optional, budget amount to set for the - campaign. - """ - - target_roas = proto.Field(proto.DOUBLE, number=1, optional=True) - new_campaign_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True - ) - - class CalloutExtensionParameters(proto.Message): - r"""Parameters to use when applying callout extension - recommendation. - - Attributes: - callout_extensions (Sequence[google.ads.googleads.v6.common.types.CalloutFeedItem]): - Callout extensions to be added. This is a - required field. - """ - - callout_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CalloutFeedItem, - ) - - class CallExtensionParameters(proto.Message): - r"""Parameters to use when applying call extension - recommendation. - - Attributes: - call_extensions (Sequence[google.ads.googleads.v6.common.types.CallFeedItem]): - Call extensions to be added. This is a - required field. - """ - - call_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CallFeedItem, - ) - - class SitelinkExtensionParameters(proto.Message): - r"""Parameters to use when applying sitelink extension - recommendation. - - Attributes: - sitelink_extensions (Sequence[google.ads.googleads.v6.common.types.SitelinkFeedItem]): - Sitelink extensions to be added. This is a - required field. - """ - - sitelink_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.SitelinkFeedItem, - ) - - class MoveUnusedBudgetParameters(proto.Message): - r"""Parameters to use when applying move unused budget - recommendation. - - Attributes: - budget_micros_to_move (int): - Budget amount to move from excess budget to - constrained budget. This is a required field. - """ - - budget_micros_to_move = proto.Field( - proto.INT64, number=2, optional=True - ) - - class ResponsiveSearchAdParameters(proto.Message): - r"""Parameters to use when applying a responsive search ad - recommendation. - - Attributes: - ad (google.ads.googleads.v6.resources.types.Ad): - Required. New ad to add to recommended ad - group. - """ - - ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) - - resource_name = proto.Field(proto.STRING, number=1) - campaign_budget = proto.Field( - proto.MESSAGE, - number=2, - oneof="apply_parameters", - message=CampaignBudgetParameters, - ) - text_ad = proto.Field( - proto.MESSAGE, - number=3, - oneof="apply_parameters", - message=TextAdParameters, - ) - keyword = proto.Field( - proto.MESSAGE, - number=4, - oneof="apply_parameters", - message=KeywordParameters, - ) - target_cpa_opt_in = proto.Field( - proto.MESSAGE, - number=5, - oneof="apply_parameters", - message=TargetCpaOptInParameters, - ) - target_roas_opt_in = proto.Field( - proto.MESSAGE, - number=10, - oneof="apply_parameters", - message=TargetRoasOptInParameters, - ) - callout_extension = proto.Field( - proto.MESSAGE, - number=6, - oneof="apply_parameters", - message=CalloutExtensionParameters, - ) - call_extension = proto.Field( - proto.MESSAGE, - number=7, - oneof="apply_parameters", - message=CallExtensionParameters, - ) - sitelink_extension = proto.Field( - proto.MESSAGE, - number=8, - oneof="apply_parameters", - message=SitelinkExtensionParameters, - ) - move_unused_budget = proto.Field( - proto.MESSAGE, - number=9, - oneof="apply_parameters", - message=MoveUnusedBudgetParameters, - ) - responsive_search_ad = proto.Field( - proto.MESSAGE, - number=11, - oneof="apply_parameters", - message=ResponsiveSearchAdParameters, - ) - - -class ApplyRecommendationResponse(proto.Message): - r"""Response message for - [RecommendationService.ApplyRecommendation][google.ads.googleads.v6.services.RecommendationService.ApplyRecommendation]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.ApplyRecommendationResult]): - Results of operations to apply - recommendations. - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors) we return the RPC - level error. - """ - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message="ApplyRecommendationResult", - ) - partial_failure_error = proto.Field( - proto.MESSAGE, number=2, message=status.Status, - ) - - -class ApplyRecommendationResult(proto.Message): - r"""The result of applying a recommendation. - - Attributes: - resource_name (str): - Returned for successful applies. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class DismissRecommendationRequest(proto.Message): - r"""Request message for - [RecommendationService.DismissRecommendation][google.ads.googleads.v6.services.RecommendationService.DismissRecommendation]. - - Attributes: - customer_id (str): - Required. The ID of the customer with the - recommendation. - operations (Sequence[google.ads.googleads.v6.services.types.DismissRecommendationRequest.DismissRecommendationOperation]): - Required. The list of operations to dismiss recommendations. - If partial_failure=false all recommendations should be of - the same type There is a limit of 100 operations per - request. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, operations will be carried in - a single transaction if and only if they are all - valid. Default is false. - """ - - class DismissRecommendationOperation(proto.Message): - r"""Operation to dismiss a single recommendation identified by - resource_name. - - Attributes: - resource_name (str): - The resource name of the recommendation to - dismiss. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=3, message=DismissRecommendationOperation, - ) - partial_failure = proto.Field(proto.BOOL, number=2) - - -class DismissRecommendationResponse(proto.Message): - r"""Response message for - [RecommendationService.DismissRecommendation][google.ads.googleads.v6.services.RecommendationService.DismissRecommendation]. - - Attributes: - results (Sequence[google.ads.googleads.v6.services.types.DismissRecommendationResponse.DismissRecommendationResult]): - Results of operations to dismiss - recommendations. - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors) we return the RPC - level error. - """ - - class DismissRecommendationResult(proto.Message): - r"""The result of dismissing a recommendation. - - Attributes: - resource_name (str): - Returned for successful dismissals. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - results = proto.RepeatedField( - proto.MESSAGE, number=1, message=DismissRecommendationResult, - ) - partial_failure_error = proto.Field( - proto.MESSAGE, number=2, message=status.Status, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/remarketing_action_service.py b/google/ads/googleads/v6/services/types/remarketing_action_service.py deleted file mode 100644 index 89cbbdca1..000000000 --- a/google/ads/googleads/v6/services/types/remarketing_action_service.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import remarketing_action -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetRemarketingActionRequest", - "MutateRemarketingActionsRequest", - "RemarketingActionOperation", - "MutateRemarketingActionsResponse", - "MutateRemarketingActionResult", - }, -) - - -class GetRemarketingActionRequest(proto.Message): - r"""Request message for - [RemarketingActionService.GetRemarketingAction][google.ads.googleads.v6.services.RemarketingActionService.GetRemarketingAction]. - - Attributes: - resource_name (str): - Required. The resource name of the - remarketing action to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateRemarketingActionsRequest(proto.Message): - r"""Request message for - [RemarketingActionService.MutateRemarketingActions][google.ads.googleads.v6.services.RemarketingActionService.MutateRemarketingActions]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose - remarketing actions are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.RemarketingActionOperation]): - Required. The list of operations to perform - on individual remarketing actions. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="RemarketingActionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class RemarketingActionOperation(proto.Message): - r"""A single operation (create, update) on a remarketing action. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.RemarketingAction): - Create operation: No resource name is - expected for the new remarketing action. - update (google.ads.googleads.v6.resources.types.RemarketingAction): - Update operation: The remarketing action is - expected to have a valid resource name. - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=remarketing_action.RemarketingAction, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=remarketing_action.RemarketingAction, - ) - - -class MutateRemarketingActionsResponse(proto.Message): - r"""Response message for remarketing action mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateRemarketingActionResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateRemarketingActionResult", - ) - - -class MutateRemarketingActionResult(proto.Message): - r"""The result for the remarketing action mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/search_term_view_service.py b/google/ads/googleads/v6/services/types/search_term_view_service.py deleted file mode 100644 index 75445f0e8..000000000 --- a/google/ads/googleads/v6/services/types/search_term_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetSearchTermViewRequest",}, -) - - -class GetSearchTermViewRequest(proto.Message): - r"""Request message for - [SearchTermViewService.GetSearchTermView][google.ads.googleads.v6.services.SearchTermViewService.GetSearchTermView]. - - Attributes: - resource_name (str): - Required. The resource name of the search - term view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/shared_criterion_service.py b/google/ads/googleads/v6/services/types/shared_criterion_service.py deleted file mode 100644 index a701c4f9b..000000000 --- a/google/ads/googleads/v6/services/types/shared_criterion_service.py +++ /dev/null @@ -1,158 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - shared_criterion as gagr_shared_criterion, -) -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetSharedCriterionRequest", - "MutateSharedCriteriaRequest", - "SharedCriterionOperation", - "MutateSharedCriteriaResponse", - "MutateSharedCriterionResult", - }, -) - - -class GetSharedCriterionRequest(proto.Message): - r"""Request message for - [SharedCriterionService.GetSharedCriterion][google.ads.googleads.v6.services.SharedCriterionService.GetSharedCriterion]. - - Attributes: - resource_name (str): - Required. The resource name of the shared - criterion to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateSharedCriteriaRequest(proto.Message): - r"""Request message for - [SharedCriterionService.MutateSharedCriteria][google.ads.googleads.v6.services.SharedCriterionService.MutateSharedCriteria]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose shared - criteria are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.SharedCriterionOperation]): - Required. The list of operations to perform - on individual shared criteria. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="SharedCriterionOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class SharedCriterionOperation(proto.Message): - r"""A single operation (create, remove) on an shared criterion. - - Attributes: - create (google.ads.googleads.v6.resources.types.SharedCriterion): - Create operation: No resource name is - expected for the new shared criterion. - remove (str): - Remove operation: A resource name for the removed shared - criterion is expected, in this format: - - ``customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}`` - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_shared_criterion.SharedCriterion, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateSharedCriteriaResponse(proto.Message): - r"""Response message for a shared criterion mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateSharedCriterionResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateSharedCriterionResult", - ) - - -class MutateSharedCriterionResult(proto.Message): - r"""The result for the shared criterion mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - shared_criterion (google.ads.googleads.v6.resources.types.SharedCriterion): - The mutated shared criterion with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - shared_criterion = proto.Field( - proto.MESSAGE, number=2, message=gagr_shared_criterion.SharedCriterion, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/shared_set_service.py b/google/ads/googleads/v6/services/types/shared_set_service.py deleted file mode 100644 index ed66979f6..000000000 --- a/google/ads/googleads/v6/services/types/shared_set_service.py +++ /dev/null @@ -1,174 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.enums.types import ( - response_content_type as gage_response_content_type, -) -from google.ads.googleads.v6.resources.types import ( - shared_set as gagr_shared_set, -) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetSharedSetRequest", - "MutateSharedSetsRequest", - "SharedSetOperation", - "MutateSharedSetsResponse", - "MutateSharedSetResult", - }, -) - - -class GetSharedSetRequest(proto.Message): - r"""Request message for - [SharedSetService.GetSharedSet][google.ads.googleads.v6.services.SharedSetService.GetSharedSet]. - - Attributes: - resource_name (str): - Required. The resource name of the shared set - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateSharedSetsRequest(proto.Message): - r"""Request message for - [SharedSetService.MutateSharedSets][google.ads.googleads.v6.services.SharedSetService.MutateSharedSets]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose shared - sets are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.SharedSetOperation]): - Required. The list of operations to perform - on individual shared sets. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): - The response content type setting. Determines - whether the mutable resource or just the - resource name should be returned post mutation. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="SharedSetOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - response_content_type = proto.Field( - proto.ENUM, - number=5, - enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, - ) - - -class SharedSetOperation(proto.Message): - r"""A single operation (create, update, remove) on an shared set. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.SharedSet): - Create operation: No resource name is - expected for the new shared set. - update (google.ads.googleads.v6.resources.types.SharedSet): - Update operation: The shared set is expected - to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed shared set - is expected, in this format: - - ``customers/{customer_id}/sharedSets/{shared_set_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=gagr_shared_set.SharedSet, - ) - update = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=gagr_shared_set.SharedSet, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateSharedSetsResponse(proto.Message): - r"""Response message for a shared set mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateSharedSetResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateSharedSetResult", - ) - - -class MutateSharedSetResult(proto.Message): - r"""The result for the shared set mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - shared_set (google.ads.googleads.v6.resources.types.SharedSet): - The mutated shared set with only mutable fields after - mutate. The field will only be returned when - response_content_type is set to "MUTABLE_RESOURCE". - """ - - resource_name = proto.Field(proto.STRING, number=1) - shared_set = proto.Field( - proto.MESSAGE, number=2, message=gagr_shared_set.SharedSet, - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/shopping_performance_view_service.py b/google/ads/googleads/v6/services/types/shopping_performance_view_service.py deleted file mode 100644 index 2da08b668..000000000 --- a/google/ads/googleads/v6/services/types/shopping_performance_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetShoppingPerformanceViewRequest",}, -) - - -class GetShoppingPerformanceViewRequest(proto.Message): - r"""Request message for - [ShoppingPerformanceViewService.GetShoppingPerformanceView][google.ads.googleads.v6.services.ShoppingPerformanceViewService.GetShoppingPerformanceView]. - - Attributes: - resource_name (str): - Required. The resource name of the Shopping - performance view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/third_party_app_analytics_link_service.py b/google/ads/googleads/v6/services/types/third_party_app_analytics_link_service.py deleted file mode 100644 index 6025ef991..000000000 --- a/google/ads/googleads/v6/services/types/third_party_app_analytics_link_service.py +++ /dev/null @@ -1,64 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetThirdPartyAppAnalyticsLinkRequest", - "RegenerateShareableLinkIdRequest", - "RegenerateShareableLinkIdResponse", - }, -) - - -class GetThirdPartyAppAnalyticsLinkRequest(proto.Message): - r"""Request message for - [ThirdPartyAppAnalyticsLinkService.GetThirdPartyAppAnalyticsLink][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.GetThirdPartyAppAnalyticsLink]. - - Attributes: - resource_name (str): - Resource name of the third party app - analytics link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class RegenerateShareableLinkIdRequest(proto.Message): - r"""Request message for - [ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId]. - - Attributes: - resource_name (str): - Resource name of the third party app - analytics link. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class RegenerateShareableLinkIdResponse(proto.Message): - r"""Response message for - [ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId][google.ads.googleads.v6.services.ThirdPartyAppAnalyticsLinkService.RegenerateShareableLinkId]. - """ - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/topic_constant_service.py b/google/ads/googleads/v6/services/types/topic_constant_service.py deleted file mode 100644 index 005535070..000000000 --- a/google/ads/googleads/v6/services/types/topic_constant_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetTopicConstantRequest",}, -) - - -class GetTopicConstantRequest(proto.Message): - r"""Request message for - [TopicConstantService.GetTopicConstant][google.ads.googleads.v6.services.TopicConstantService.GetTopicConstant]. - - Attributes: - resource_name (str): - Required. Resource name of the Topic to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/topic_view_service.py b/google/ads/googleads/v6/services/types/topic_view_service.py deleted file mode 100644 index 28c552a4e..000000000 --- a/google/ads/googleads/v6/services/types/topic_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetTopicViewRequest",}, -) - - -class GetTopicViewRequest(proto.Message): - r"""Request message for - [TopicViewService.GetTopicView][google.ads.googleads.v6.services.TopicViewService.GetTopicView]. - - Attributes: - resource_name (str): - Required. The resource name of the topic view - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/user_data_service.py b/google/ads/googleads/v6/services/types/user_data_service.py deleted file mode 100644 index 873f1bbc0..000000000 --- a/google/ads/googleads/v6/services/types/user_data_service.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.common.types import offline_user_data - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "UploadUserDataRequest", - "UserDataOperation", - "UploadUserDataResponse", - }, -) - - -class UploadUserDataRequest(proto.Message): - r"""Request message for - [UserDataService.UploadUserData][google.ads.googleads.v6.services.UserDataService.UploadUserData] - - Attributes: - customer_id (str): - Required. The ID of the customer for which to - update the user data. - operations (Sequence[google.ads.googleads.v6.services.types.UserDataOperation]): - Required. The list of operations to be done. - customer_match_user_list_metadata (google.ads.googleads.v6.common.types.CustomerMatchUserListMetadata): - Metadata for data updates to a Customer Match - user list. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=3, message="UserDataOperation", - ) - customer_match_user_list_metadata = proto.Field( - proto.MESSAGE, - number=2, - oneof="metadata", - message=offline_user_data.CustomerMatchUserListMetadata, - ) - - -class UserDataOperation(proto.Message): - r"""Operation to be made for the UploadUserDataRequest. - - Attributes: - create (google.ads.googleads.v6.common.types.UserData): - The list of user data to be appended to the - user list. - remove (google.ads.googleads.v6.common.types.UserData): - The list of user data to be removed from the - user list. - """ - - create = proto.Field( - proto.MESSAGE, - number=1, - oneof="operation", - message=offline_user_data.UserData, - ) - remove = proto.Field( - proto.MESSAGE, - number=2, - oneof="operation", - message=offline_user_data.UserData, - ) - - -class UploadUserDataResponse(proto.Message): - r"""Response message for - [UserDataService.UploadUserData][google.ads.googleads.v6.services.UserDataService.UploadUserData] - - Attributes: - upload_date_time (str): - The date time at which the request was received by API, - formatted as "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 - 12:32:45-08:00". - received_operations_count (int): - Number of upload data operations received by - API. - """ - - upload_date_time = proto.Field(proto.STRING, number=3, optional=True) - received_operations_count = proto.Field( - proto.INT32, number=4, optional=True - ) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/user_interest_service.py b/google/ads/googleads/v6/services/types/user_interest_service.py deleted file mode 100644 index f194efdd7..000000000 --- a/google/ads/googleads/v6/services/types/user_interest_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetUserInterestRequest",}, -) - - -class GetUserInterestRequest(proto.Message): - r"""Request message for - [UserInterestService.GetUserInterest][google.ads.googleads.v6.services.UserInterestService.GetUserInterest]. - - Attributes: - resource_name (str): - Required. Resource name of the UserInterest - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/user_list_service.py b/google/ads/googleads/v6/services/types/user_list_service.py deleted file mode 100644 index 9a7dbeb0d..000000000 --- a/google/ads/googleads/v6/services/types/user_list_service.py +++ /dev/null @@ -1,147 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -from google.ads.googleads.v6.resources.types import user_list -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={ - "GetUserListRequest", - "MutateUserListsRequest", - "UserListOperation", - "MutateUserListsResponse", - "MutateUserListResult", - }, -) - - -class GetUserListRequest(proto.Message): - r"""Request message for - [UserListService.GetUserList][google.ads.googleads.v6.services.UserListService.GetUserList]. - - Attributes: - resource_name (str): - Required. The resource name of the user list - to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -class MutateUserListsRequest(proto.Message): - r"""Request message for - [UserListService.MutateUserLists][google.ads.googleads.v6.services.UserListService.MutateUserLists]. - - Attributes: - customer_id (str): - Required. The ID of the customer whose user - lists are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.UserListOperation]): - Required. The list of operations to perform - on individual user lists. - partial_failure (bool): - If true, successful operations will be - carried out and invalid operations will return - errors. If false, all operations will be carried - out in one transaction if and only if they are - all valid. Default is false. - validate_only (bool): - If true, the request is validated but not - executed. Only errors are returned, not results. - """ - - customer_id = proto.Field(proto.STRING, number=1) - operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="UserListOperation", - ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) - - -class UserListOperation(proto.Message): - r"""A single operation (create, update) on a user list. - - Attributes: - update_mask (google.protobuf.field_mask_pb2.FieldMask): - FieldMask that determines which resource - fields are modified in an update. - create (google.ads.googleads.v6.resources.types.UserList): - Create operation: No resource name is - expected for the new user list. - update (google.ads.googleads.v6.resources.types.UserList): - Update operation: The user list is expected - to have a valid resource name. - remove (str): - Remove operation: A resource name for the removed user list - is expected, in this format: - - ``customers/{customer_id}/userLists/{user_list_id}`` - """ - - update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, - ) - create = proto.Field( - proto.MESSAGE, number=1, oneof="operation", message=user_list.UserList, - ) - update = proto.Field( - proto.MESSAGE, number=2, oneof="operation", message=user_list.UserList, - ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") - - -class MutateUserListsResponse(proto.Message): - r"""Response message for user list mutate. - - Attributes: - partial_failure_error (google.rpc.status_pb2.Status): - Errors that pertain to operation failures in the partial - failure mode. Returned only when partial_failure = true and - all errors occur inside the operations. If any errors occur - outside the operations (e.g. auth errors), we return an RPC - level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateUserListResult]): - All results for the mutate. - """ - - partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, - ) - results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateUserListResult", - ) - - -class MutateUserListResult(proto.Message): - r"""The result for the user list mutate. - - Attributes: - resource_name (str): - Returned for successful operations. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/user_location_view_service.py b/google/ads/googleads/v6/services/types/user_location_view_service.py deleted file mode 100644 index 150d58798..000000000 --- a/google/ads/googleads/v6/services/types/user_location_view_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetUserLocationViewRequest",}, -) - - -class GetUserLocationViewRequest(proto.Message): - r"""Request message for - [UserLocationViewService.GetUserLocationView][google.ads.googleads.v6.services.UserLocationViewService.GetUserLocationView]. - - Attributes: - resource_name (str): - Required. The resource name of the user - location view to fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/services/types/video_service.py b/google/ads/googleads/v6/services/types/video_service.py deleted file mode 100644 index db8447cf8..000000000 --- a/google/ads/googleads/v6/services/types/video_service.py +++ /dev/null @@ -1,41 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# - -import proto # type: ignore - - -__protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", - manifest={"GetVideoRequest",}, -) - - -class GetVideoRequest(proto.Message): - r"""Request message for - [VideoService.GetVideo][google.ads.googleads.v6.services.VideoService.GetVideo]. - - Attributes: - resource_name (str): - Required. The resource name of the video to - fetch. - """ - - resource_name = proto.Field(proto.STRING, number=1) - - -__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/types/__init__.py b/google/ads/googleads/v6/types/__init__.py deleted file mode 100644 index 42ffdf2bc..000000000 --- a/google/ads/googleads/v6/types/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 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. -# diff --git a/google/ads/googleads/v8/__init__.py b/google/ads/googleads/v8/__init__.py index ca2b56d20..1a0982d1e 100644 --- a/google/ads/googleads/v8/__init__.py +++ b/google/ads/googleads/v8/__init__.py @@ -323,6 +323,9 @@ "ConversionCustomVariableStatusEnum": "google.ads.googleads.v8.enums.types.conversion_custom_variable_status", "ConversionLagBucketEnum": "google.ads.googleads.v8.enums.types.conversion_lag_bucket", "ConversionOrAdjustmentLagBucketEnum": "google.ads.googleads.v8.enums.types.conversion_or_adjustment_lag_bucket", + "ConversionValueRulePrimaryDimensionEnum": "google.ads.googleads.v8.enums.types.conversion_value_rule_primary_dimension", + "ConversionValueRuleSetStatusEnum": "google.ads.googleads.v8.enums.types.conversion_value_rule_set_status", + "ConversionValueRuleStatusEnum": "google.ads.googleads.v8.enums.types.conversion_value_rule_status", "CriterionCategoryChannelAvailabilityModeEnum": "google.ads.googleads.v8.enums.types.criterion_category_channel_availability_mode", "CriterionCategoryLocaleAvailabilityModeEnum": "google.ads.googleads.v8.enums.types.criterion_category_locale_availability_mode", "CriterionSystemServingStatusEnum": "google.ads.googleads.v8.enums.types.criterion_system_serving_status", @@ -459,6 +462,8 @@ "SearchEngineResultsPageTypeEnum": "google.ads.googleads.v8.enums.types.search_engine_results_page_type", "SearchTermMatchTypeEnum": "google.ads.googleads.v8.enums.types.search_term_match_type", "SearchTermTargetingStatusEnum": "google.ads.googleads.v8.enums.types.search_term_targeting_status", + "SeasonalityEventScopeEnum": "google.ads.googleads.v8.enums.types.seasonality_event_scope", + "SeasonalityEventStatusEnum": "google.ads.googleads.v8.enums.types.seasonality_event_status", "ServedAssetFieldTypeEnum": "google.ads.googleads.v8.enums.types.served_asset_field_type", "SharedSetStatusEnum": "google.ads.googleads.v8.enums.types.shared_set_status", "SharedSetTypeEnum": "google.ads.googleads.v8.enums.types.shared_set_type", @@ -492,6 +497,11 @@ "UserListSizeRangeEnum": "google.ads.googleads.v8.enums.types.user_list_size_range", "UserListStringRuleItemOperatorEnum": "google.ads.googleads.v8.enums.types.user_list_string_rule_item_operator", "UserListTypeEnum": "google.ads.googleads.v8.enums.types.user_list_type", + "ValueRuleDeviceTypeEnum": "google.ads.googleads.v8.enums.types.value_rule_device_type", + "ValueRuleGeoLocationMatchTypeEnum": "google.ads.googleads.v8.enums.types.value_rule_geo_location_match_type", + "ValueRuleOperationEnum": "google.ads.googleads.v8.enums.types.value_rule_operation", + "ValueRuleSetAttachmentTypeEnum": "google.ads.googleads.v8.enums.types.value_rule_set_attachment_type", + "ValueRuleSetDimensionEnum": "google.ads.googleads.v8.enums.types.value_rule_set_dimension", "VanityPharmaDisplayUrlModeEnum": "google.ads.googleads.v8.enums.types.vanity_pharma_display_url_mode", "VanityPharmaTextEnum": "google.ads.googleads.v8.enums.types.vanity_pharma_text", "WebpageConditionOperandEnum": "google.ads.googleads.v8.enums.types.webpage_condition_operand", @@ -532,6 +542,8 @@ "ConversionAdjustmentUploadErrorEnum": "google.ads.googleads.v8.errors.types.conversion_adjustment_upload_error", "ConversionCustomVariableErrorEnum": "google.ads.googleads.v8.errors.types.conversion_custom_variable_error", "ConversionUploadErrorEnum": "google.ads.googleads.v8.errors.types.conversion_upload_error", + "ConversionValueRuleErrorEnum": "google.ads.googleads.v8.errors.types.conversion_value_rule_error", + "ConversionValueRuleSetErrorEnum": "google.ads.googleads.v8.errors.types.conversion_value_rule_set_error", "CountryCodeErrorEnum": "google.ads.googleads.v8.errors.types.country_code_error", "CriterionErrorEnum": "google.ads.googleads.v8.errors.types.criterion_error", "CurrencyCodeErrorEnum": "google.ads.googleads.v8.errors.types.currency_code_error", @@ -653,6 +665,8 @@ "AssetPolicySummary": "google.ads.googleads.v8.resources.types.asset", "AttributeFieldMapping": "google.ads.googleads.v8.resources.types.feed_mapping", "BatchJob": "google.ads.googleads.v8.resources.types.batch_job", + "BiddingDataExclusion": "google.ads.googleads.v8.resources.types.bidding_data_exclusion", + "BiddingSeasonalityAdjustment": "google.ads.googleads.v8.resources.types.bidding_seasonality_adjustment", "BiddingStrategy": "google.ads.googleads.v8.resources.types.bidding_strategy", "BiddingStrategySimulation": "google.ads.googleads.v8.resources.types.bidding_strategy_simulation", "BillingSetup": "google.ads.googleads.v8.resources.types.billing_setup", @@ -680,6 +694,8 @@ "ConversionAction": "google.ads.googleads.v8.resources.types.conversion_action", "ConversionCustomVariable": "google.ads.googleads.v8.resources.types.conversion_custom_variable", "ConversionTrackingSetting": "google.ads.googleads.v8.resources.types.customer", + "ConversionValueRule": "google.ads.googleads.v8.resources.types.conversion_value_rule", + "ConversionValueRuleSet": "google.ads.googleads.v8.resources.types.conversion_value_rule_set", "CurrencyConstant": "google.ads.googleads.v8.resources.types.currency_constant", "CustomAudience": "google.ads.googleads.v8.resources.types.custom_audience", "CustomAudienceMember": "google.ads.googleads.v8.resources.types.custom_audience", @@ -800,6 +816,8 @@ "AssetOperation": "google.ads.googleads.v8.services.types.asset_service", "BatchJobOperation": "google.ads.googleads.v8.services.types.batch_job_service", "BatchJobResult": "google.ads.googleads.v8.services.types.batch_job_service", + "BiddingDataExclusionOperation": "google.ads.googleads.v8.services.types.bidding_data_exclusion_service", + "BiddingSeasonalityAdjustmentOperation": "google.ads.googleads.v8.services.types.bidding_seasonality_adjustment_service", "BiddingStrategyOperation": "google.ads.googleads.v8.services.types.bidding_strategy_service", "BillingSetupOperation": "google.ads.googleads.v8.services.types.billing_setup_service", "CallConversion": "google.ads.googleads.v8.services.types.conversion_upload_service", @@ -823,6 +841,8 @@ "ConversionAdjustment": "google.ads.googleads.v8.services.types.conversion_adjustment_upload_service", "ConversionAdjustmentResult": "google.ads.googleads.v8.services.types.conversion_adjustment_upload_service", "ConversionCustomVariableOperation": "google.ads.googleads.v8.services.types.conversion_custom_variable_service", + "ConversionValueRuleOperation": "google.ads.googleads.v8.services.types.conversion_value_rule_service", + "ConversionValueRuleSetOperation": "google.ads.googleads.v8.services.types.conversion_value_rule_set_service", "CreateAccountLinkRequest": "google.ads.googleads.v8.services.types.account_link_service", "CreateAccountLinkResponse": "google.ads.googleads.v8.services.types.account_link_service", "CreateCampaignExperimentMetadata": "google.ads.googleads.v8.services.types.campaign_experiment_service", @@ -846,6 +866,8 @@ "CustomVariable": "google.ads.googleads.v8.services.types.conversion_upload_service", "DismissRecommendationRequest": "google.ads.googleads.v8.services.types.recommendation_service", "DismissRecommendationResponse": "google.ads.googleads.v8.services.types.recommendation_service", + "EffectiveFrequencyBreakdown": "google.ads.googleads.v8.services.types.reach_plan_service", + "EffectiveFrequencyLimit": "google.ads.googleads.v8.services.types.reach_plan_service", "EndCampaignExperimentRequest": "google.ads.googleads.v8.services.types.campaign_experiment_service", "ExtensionFeedItemOperation": "google.ads.googleads.v8.services.types.extension_feed_item_service", "ExternalAttributionData": "google.ads.googleads.v8.services.types.conversion_upload_service", @@ -900,6 +922,8 @@ "GetAssetFieldTypeViewRequest": "google.ads.googleads.v8.services.types.asset_field_type_view_service", "GetAssetRequest": "google.ads.googleads.v8.services.types.asset_service", "GetBatchJobRequest": "google.ads.googleads.v8.services.types.batch_job_service", + "GetBiddingDataExclusionRequest": "google.ads.googleads.v8.services.types.bidding_data_exclusion_service", + "GetBiddingSeasonalityAdjustmentRequest": "google.ads.googleads.v8.services.types.bidding_seasonality_adjustment_service", "GetBiddingStrategyRequest": "google.ads.googleads.v8.services.types.bidding_strategy_service", "GetBiddingStrategySimulationRequest": "google.ads.googleads.v8.services.types.bidding_strategy_simulation_service", "GetBillingSetupRequest": "google.ads.googleads.v8.services.types.billing_setup_service", @@ -923,6 +947,8 @@ "GetCombinedAudienceRequest": "google.ads.googleads.v8.services.types.combined_audience_service", "GetConversionActionRequest": "google.ads.googleads.v8.services.types.conversion_action_service", "GetConversionCustomVariableRequest": "google.ads.googleads.v8.services.types.conversion_custom_variable_service", + "GetConversionValueRuleRequest": "google.ads.googleads.v8.services.types.conversion_value_rule_service", + "GetConversionValueRuleSetRequest": "google.ads.googleads.v8.services.types.conversion_value_rule_set_service", "GetCurrencyConstantRequest": "google.ads.googleads.v8.services.types.currency_constant_service", "GetCustomAudienceRequest": "google.ads.googleads.v8.services.types.custom_audience_service", "GetCustomerAssetRequest": "google.ads.googleads.v8.services.types.customer_asset_service", @@ -1089,6 +1115,12 @@ "MutateBatchJobRequest": "google.ads.googleads.v8.services.types.batch_job_service", "MutateBatchJobResponse": "google.ads.googleads.v8.services.types.batch_job_service", "MutateBatchJobResult": "google.ads.googleads.v8.services.types.batch_job_service", + "MutateBiddingDataExclusionsRequest": "google.ads.googleads.v8.services.types.bidding_data_exclusion_service", + "MutateBiddingDataExclusionsResponse": "google.ads.googleads.v8.services.types.bidding_data_exclusion_service", + "MutateBiddingDataExclusionsResult": "google.ads.googleads.v8.services.types.bidding_data_exclusion_service", + "MutateBiddingSeasonalityAdjustmentsRequest": "google.ads.googleads.v8.services.types.bidding_seasonality_adjustment_service", + "MutateBiddingSeasonalityAdjustmentsResponse": "google.ads.googleads.v8.services.types.bidding_seasonality_adjustment_service", + "MutateBiddingSeasonalityAdjustmentsResult": "google.ads.googleads.v8.services.types.bidding_seasonality_adjustment_service", "MutateBiddingStrategiesRequest": "google.ads.googleads.v8.services.types.bidding_strategy_service", "MutateBiddingStrategiesResponse": "google.ads.googleads.v8.services.types.bidding_strategy_service", "MutateBiddingStrategyResult": "google.ads.googleads.v8.services.types.bidding_strategy_service", @@ -1134,6 +1166,12 @@ "MutateConversionCustomVariableResult": "google.ads.googleads.v8.services.types.conversion_custom_variable_service", "MutateConversionCustomVariablesRequest": "google.ads.googleads.v8.services.types.conversion_custom_variable_service", "MutateConversionCustomVariablesResponse": "google.ads.googleads.v8.services.types.conversion_custom_variable_service", + "MutateConversionValueRuleResult": "google.ads.googleads.v8.services.types.conversion_value_rule_service", + "MutateConversionValueRuleSetResult": "google.ads.googleads.v8.services.types.conversion_value_rule_set_service", + "MutateConversionValueRuleSetsRequest": "google.ads.googleads.v8.services.types.conversion_value_rule_set_service", + "MutateConversionValueRuleSetsResponse": "google.ads.googleads.v8.services.types.conversion_value_rule_set_service", + "MutateConversionValueRulesRequest": "google.ads.googleads.v8.services.types.conversion_value_rule_service", + "MutateConversionValueRulesResponse": "google.ads.googleads.v8.services.types.conversion_value_rule_service", "MutateCustomAudienceResult": "google.ads.googleads.v8.services.types.custom_audience_service", "MutateCustomAudiencesRequest": "google.ads.googleads.v8.services.types.custom_audience_service", "MutateCustomAudiencesResponse": "google.ads.googleads.v8.services.types.custom_audience_service", @@ -1269,6 +1307,8 @@ "SuggestGeoTargetConstantsResponse": "google.ads.googleads.v8.services.types.geo_target_constant_service", "SuggestKeywordThemeConstantsRequest": "google.ads.googleads.v8.services.types.keyword_theme_constant_service", "SuggestKeywordThemeConstantsResponse": "google.ads.googleads.v8.services.types.keyword_theme_constant_service", + "SuggestSmartCampaignAdRequest": "google.ads.googleads.v8.services.types.smart_campaign_suggest_service", + "SuggestSmartCampaignAdResponse": "google.ads.googleads.v8.services.types.smart_campaign_suggest_service", "SuggestSmartCampaignBudgetOptionsRequest": "google.ads.googleads.v8.services.types.smart_campaign_suggest_service", "SuggestSmartCampaignBudgetOptionsResponse": "google.ads.googleads.v8.services.types.smart_campaign_suggest_service", "Targeting": "google.ads.googleads.v8.services.types.reach_plan_service", @@ -1360,6 +1400,12 @@ "BatchJobServiceClient": "google.ads.googleads.v8.services.services.batch_job_service", "BatchJobServiceTransport": "google.ads.googleads.v8.services.services.batch_job_service.transports", "BatchJobServiceGrpcTransport": "google.ads.googleads.v8.services.services.batch_job_service.transports", + "BiddingDataExclusionServiceClient": "google.ads.googleads.v8.services.services.bidding_data_exclusion_service", + "BiddingDataExclusionServiceTransport": "google.ads.googleads.v8.services.services.bidding_data_exclusion_service.transports", + "BiddingDataExclusionServiceGrpcTransport": "google.ads.googleads.v8.services.services.bidding_data_exclusion_service.transports", + "BiddingSeasonalityAdjustmentServiceClient": "google.ads.googleads.v8.services.services.bidding_seasonality_adjustment_service", + "BiddingSeasonalityAdjustmentServiceTransport": "google.ads.googleads.v8.services.services.bidding_seasonality_adjustment_service.transports", + "BiddingSeasonalityAdjustmentServiceGrpcTransport": "google.ads.googleads.v8.services.services.bidding_seasonality_adjustment_service.transports", "BiddingStrategyServiceClient": "google.ads.googleads.v8.services.services.bidding_strategy_service", "BiddingStrategyServiceTransport": "google.ads.googleads.v8.services.services.bidding_strategy_service.transports", "BiddingStrategyServiceGrpcTransport": "google.ads.googleads.v8.services.services.bidding_strategy_service.transports", @@ -1435,6 +1481,12 @@ "ConversionUploadServiceClient": "google.ads.googleads.v8.services.services.conversion_upload_service", "ConversionUploadServiceTransport": "google.ads.googleads.v8.services.services.conversion_upload_service.transports", "ConversionUploadServiceGrpcTransport": "google.ads.googleads.v8.services.services.conversion_upload_service.transports", + "ConversionValueRuleServiceClient": "google.ads.googleads.v8.services.services.conversion_value_rule_service", + "ConversionValueRuleServiceTransport": "google.ads.googleads.v8.services.services.conversion_value_rule_service.transports", + "ConversionValueRuleServiceGrpcTransport": "google.ads.googleads.v8.services.services.conversion_value_rule_service.transports", + "ConversionValueRuleSetServiceClient": "google.ads.googleads.v8.services.services.conversion_value_rule_set_service", + "ConversionValueRuleSetServiceTransport": "google.ads.googleads.v8.services.services.conversion_value_rule_set_service.transports", + "ConversionValueRuleSetServiceGrpcTransport": "google.ads.googleads.v8.services.services.conversion_value_rule_set_service.transports", "CurrencyConstantServiceClient": "google.ads.googleads.v8.services.services.currency_constant_service", "CurrencyConstantServiceTransport": "google.ads.googleads.v8.services.services.currency_constant_service.transports", "CurrencyConstantServiceGrpcTransport": "google.ads.googleads.v8.services.services.currency_constant_service.transports", diff --git a/google/ads/googleads/v8/common/types/ad_type_infos.py b/google/ads/googleads/v8/common/types/ad_type_infos.py index 0d8339a1a..582f76090 100644 --- a/google/ads/googleads/v8/common/types/ad_type_infos.py +++ b/google/ads/googleads/v8/common/types/ad_type_infos.py @@ -235,8 +235,8 @@ class DisplayCallToAction(proto.Message): Text color for the display-call-to-action in hexadecimal, e.g. #ffffff for white. url_collection_id (str): - Identifies the url collection in the ad.url_collections - field. If not set the url defaults to final_url. + Identifies the URL collection in the ``ad.url_collections`` + field. If not set, the URL defaults to ``final_url``. """ text = proto.Field(proto.STRING, number=5, optional=True,) @@ -528,12 +528,11 @@ class ResponsiveSearchAdInfo(proto.Message): the ad serves the descriptions will be selected from this list. path1 (str): - First part of text that may appear appended - to the url displayed in the ad. + First part of text that can be appended to + the URL in the ad. path2 (str): - Second part of text that may appear appended - to the url displayed in the ad. This field can - only be set when path1 is also set. + Second part of text that can be appended to the URL in the + ad. This field can only be set when ``path1`` is also set. """ headlines = proto.RepeatedField( @@ -563,16 +562,16 @@ class LegacyResponsiveDisplayAdInfo(proto.Message): Advertiser's consent to allow flexible color. When true, the ad may be served with different color if necessary. When false, the ad will be served with the specified colors or a - neutral color. The default value is true. Must be true if - main_color and accent_color are not set. + neutral color. The default value is ``true``. Must be true + if ``main_color`` and ``accent_color`` are not set. accent_color (str): The accent color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. + white. If one of ``main_color`` and ``accent_color`` is set, + the other is required as well. main_color (str): The main color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. + white. If one of ``main_color`` and ``accent_color`` is set, + the other is required as well. call_to_action_text (str): The call-to-action text for the ad. logo_image (str): @@ -709,7 +708,7 @@ class LegacyAppInstallAdInfo(proto.Message): Attributes: app_id (str): - The id of the mobile app. + The ID of the mobile app. app_store (google.ads.googleads.v8.enums.types.LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore): The app store the mobile app is available in. headline (str): @@ -738,24 +737,24 @@ class ResponsiveDisplayAdInfo(proto.Message): Marketing images to be used in the ad. Valid image types are GIF, JPEG, and PNG. The minimum size is 600x314 and the aspect ratio must be 1.91:1 (+-1%). At least one - marketing_image is required. Combined with - square_marketing_images the maximum is 15. + ``marketing_image`` is required. Combined with + ``square_marketing_images``, the maximum is 15. square_marketing_images (Sequence[google.ads.googleads.v8.common.types.AdImageAsset]): Square marketing images to be used in the ad. Valid image types are GIF, JPEG, and PNG. The minimum size is 300x300 and the aspect ratio must be 1:1 (+-1%). At least one square - marketing_image is required. Combined with marketing_images - the maximum is 15. + ``marketing_image`` is required. Combined with + ``marketing_images``, the maximum is 15. logo_images (Sequence[google.ads.googleads.v8.common.types.AdImageAsset]): Logo images to be used in the ad. Valid image types are GIF, JPEG, and PNG. The minimum size is 512x128 and the aspect - ratio must be 4:1 (+-1%). Combined with square_logo_images - the maximum is 5. + ratio must be 4:1 (+-1%). Combined with + ``square_logo_images``, the maximum is 5. square_logo_images (Sequence[google.ads.googleads.v8.common.types.AdImageAsset]): Square logo images to be used in the ad. Valid image types are GIF, JPEG, and PNG. The minimum size is 128x128 and the aspect ratio must be 1:1 (+-1%). Combined with - square_logo_images the maximum is 5. + ``square_logo_images``, the maximum is 5. headlines (Sequence[google.ads.googleads.v8.common.types.AdTextAsset]): Short format headlines for the ad. The maximum length is 30 characters. At least 1 and @@ -775,18 +774,18 @@ class ResponsiveDisplayAdInfo(proto.Message): width is 25. main_color (str): The main color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. + white. If one of ``main_color`` and ``accent_color`` is set, + the other is required as well. accent_color (str): The accent color of the ad in hexadecimal, e.g. #ffffff for - white. If one of main_color and accent_color is set, the - other is required as well. + white. If one of ``main_color`` and ``accent_color`` is set, + the other is required as well. allow_flexible_color (bool): Advertiser's consent to allow flexible color. When true, the ad may be served with different color if necessary. When false, the ad will be served with the specified colors or a - neutral color. The default value is true. Must be true if - main_color and accent_color are not set. + neutral color. The default value is ``true``. Must be true + if ``main_color`` and ``accent_color`` are not set. call_to_action_text (str): The call-to-action text for the ad. Maximum display width is 30. @@ -878,12 +877,12 @@ class LocalAdInfo(proto.Message): displayed with the ad. Videos are optional and at most 20 can be specified. path1 (str): - First part of optional text that may appear - appended to the url displayed in the ad. + First part of optional text that can be + appended to the URL in the ad. path2 (str): - Second part of optional text that may appear - appended to the url displayed in the ad. This - field can only be set when path1 is also set. + Second part of optional text that can be appended to the URL + in the ad. This field can only be set when ``path1`` is also + set. """ headlines = proto.RepeatedField( @@ -910,8 +909,8 @@ class LocalAdInfo(proto.Message): class DisplayUploadAdInfo(proto.Message): r"""A generic type of display ad. The exact ad format is controlled by - the display_upload_product_type field, which determines what kinds - of data need to be included with the ad. + the ``display_upload_product_type`` field, which determines what + kinds of data need to be included with the ad. Attributes: display_upload_product_type (google.ads.googleads.v8.enums.types.DisplayUploadProductTypeEnum.DisplayUploadProductType): @@ -919,7 +918,7 @@ class DisplayUploadAdInfo(proto.Message): the enum for details. media_bundle (google.ads.googleads.v8.common.types.AdMediaBundleAsset): A media bundle asset to be used in the ad. For information - about the media bundle for HTML5_UPLOAD_AD see + about the media bundle for HTML5_UPLOAD_AD, see https://support.google.com/google-ads/answer/1722096 Media bundles that are part of dynamic product types use a special format that needs to be created through the Google Web @@ -1012,20 +1011,20 @@ class CallAdInfo(proto.Message): conversion_action (str): The conversion action to attribute a call conversion to. If not set a default conversion action is used. This field only - has effect if call_tracked is set to true. Otherwise this - field is ignored. + has effect if ``call_tracked`` is set to ``true``. Otherwise + this field is ignored. conversion_reporting_state (google.ads.googleads.v8.enums.types.CallConversionReportingStateEnum.CallConversionReportingState): The call conversion behavior of this call ad. It can use its own call conversion setting, inherit the account level setting, or be disabled. path1 (str): - First part of text that may appear appended - to the url displayed to in the ad. Optional. + First part of text that can be appended to + the URL in the ad. Optional. path2 (str): - Second part of text that may appear appended - to the url displayed to in the ad. This field - can only be set when path1 is set. Optional. + Second part of text that can be appended to the URL in the + ad. This field can only be set when ``path1`` is also set. + Optional. """ country_code = proto.Field(proto.STRING, number=1,) diff --git a/google/ads/googleads/v8/common/types/bidding.py b/google/ads/googleads/v8/common/types/bidding.py index e2abe6425..fa60f4c5d 100644 --- a/google/ads/googleads/v8/common/types/bidding.py +++ b/google/ads/googleads/v8/common/types/bidding.py @@ -135,11 +135,13 @@ class TargetCpa(proto.Message): cpc_bid_ceiling_micros (int): Maximum bid limit that can be set by the bid strategy. The limit applies to all keywords - managed by the strategy. + managed by the strategy. This should only be set + for portfolio bid strategies. cpc_bid_floor_micros (int): Minimum bid limit that can be set by the bid strategy. The limit applies to all keywords - managed by the strategy. + managed by the strategy. This should only be set + for portfolio bid strategies. """ target_cpa_micros = proto.Field(proto.INT64, number=4, optional=True,) @@ -197,11 +199,13 @@ class TargetRoas(proto.Message): cpc_bid_ceiling_micros (int): Maximum bid limit that can be set by the bid strategy. The limit applies to all keywords - managed by the strategy. + managed by the strategy. This should only be set + for portfolio bid strategies. cpc_bid_floor_micros (int): Minimum bid limit that can be set by the bid strategy. The limit applies to all keywords - managed by the strategy. + managed by the strategy. This should only be set + for portfolio bid strategies. """ target_roas = proto.Field(proto.DOUBLE, number=4, optional=True,) diff --git a/google/ads/googleads/v8/common/types/offline_user_data.py b/google/ads/googleads/v8/common/types/offline_user_data.py index 499a197fd..fa3fdb346 100644 --- a/google/ads/googleads/v8/common/types/offline_user_data.py +++ b/google/ads/googleads/v8/common/types/offline_user_data.py @@ -52,15 +52,21 @@ class OfflineUserAddressInfo(proto.Message): punctuation). city (str): City of the address. Only accepted for Store - Sales Direct data. + Sales and ConversionAdjustmentUploadService. state (str): State code of the address. Only accepted for - Store Sales Direct data. + Store Sales and + ConversionAdjustmentUploadService. country_code (str): 2-letter country code in ISO-3166-1 alpha-2 of the user's address. postal_code (str): Postal code of the user's address. + hashed_street_address (str): + The street address of the user hashed using + SHA-256 hash function after normalization (lower + case only). Only accepted for + ConversionAdjustmentUploadService. """ hashed_first_name = proto.Field(proto.STRING, number=7, optional=True,) @@ -69,28 +75,44 @@ class OfflineUserAddressInfo(proto.Message): state = proto.Field(proto.STRING, number=10, optional=True,) country_code = proto.Field(proto.STRING, number=11, optional=True,) postal_code = proto.Field(proto.STRING, number=12, optional=True,) + hashed_street_address = proto.Field(proto.STRING, number=13, optional=True,) class UserIdentifier(proto.Message): - r"""Hashed user identifying information. + r"""User identifying information. Attributes: user_identifier_source (google.ads.googleads.v8.enums.types.UserIdentifierSourceEnum.UserIdentifierSource): - Source of the user identifier when the upload - is from Store Sales third party partners. + Source of the user identifier when the upload is from Store + Sales, ConversionUploadService, or + ConversionAdjustmentUploadService. For + ConversionUploadService and + ConversionAdjustmentUploadService, the source of the user + identifier must be specified as FIRST_PARTY, otherwise an + error will be returned. hashed_email (str): Hashed email address using SHA-256 hash - function after normalization. + function after normalization. Accepted for + Customer Match, Store Sales, + ConversionUploadService, and + ConversionAdjustmentUploadService. hashed_phone_number (str): Hashed phone number using SHA-256 hash function after normalization (E164 standard). + Accepted for Customer Match, Store Sales, + ConversionUploadService, and + ConversionAdjustmentUploadService. mobile_id (str): Mobile device ID (advertising ID/IDFA). + Accepted only for Customer Match. third_party_user_id (str): Advertiser-assigned user ID for Customer Match upload, or third-party-assigned user ID - for SSD. + for Store Sales. Accepted only for Customer + Match and Store Sales. address_info (google.ads.googleads.v8.common.types.OfflineUserAddressInfo): - Address information. + Address information. Accepted only for + Customer Match, Store Sales, and + ConversionAdjustmentUploadService. """ user_identifier_source = proto.Field( @@ -126,10 +148,11 @@ class TransactionAttribute(proto.Message): 14:34:30+03:00". transaction_amount_micros (float): Transaction amount in micros. Required. - If item Attributes are provided, it represents - the total value of the items, after multiplying - the unit price per item by the quantity provided - in the ItemAttributes. + Transaction amount in micros needs to be greater + than 1000. If item Attributes are provided, it + represents the total value of the items, after + multiplying the unit price per item by the + quantity provided in the ItemAttributes. currency_code (str): Transaction currency code. ISO 4217 three- etter code is used. Required. diff --git a/google/ads/googleads/v8/common/types/segments.py b/google/ads/googleads/v8/common/types/segments.py index dd17064b1..09b270403 100644 --- a/google/ads/googleads/v8/common/types/segments.py +++ b/google/ads/googleads/v8/common/types/segments.py @@ -38,6 +38,9 @@ from google.ads.googleads.v8.enums.types import ( conversion_or_adjustment_lag_bucket as gage_conversion_or_adjustment_lag_bucket, ) +from google.ads.googleads.v8.enums.types import ( + conversion_value_rule_primary_dimension as gage_conversion_value_rule_primary_dimension, +) from google.ads.googleads.v8.enums.types import day_of_week as gage_day_of_week from google.ads.googleads.v8.enums.types import device as gage_device from google.ads.googleads.v8.enums.types import ( @@ -285,6 +288,13 @@ class Segments(proto.Message): ad, including variants. slot (google.ads.googleads.v8.enums.types.SlotEnum.Slot): Position of the ad. + conversion_value_rule_primary_dimension (google.ads.googleads.v8.enums.types.ConversionValueRulePrimaryDimensionEnum.ConversionValueRulePrimaryDimension): + Primary dimension of applied conversion value rules. + NO_RULE_APPLIED shows the total recorded value of + conversions that do not have a value rule applied. ORIGINAL + shows the original value of conversions to which a value + rule has been applied. GEO_LOCATION, DEVICE, AUDIENCE show + the net adjustment after value rules were applied. webpage (str): Resource name of the ad group criterion that represents webpage criterion. @@ -502,6 +512,11 @@ class Segments(proto.Message): enum=gage_search_term_match_type.SearchTermMatchTypeEnum.SearchTermMatchType, ) slot = proto.Field(proto.ENUM, number=23, enum=gage_slot.SlotEnum.Slot,) + conversion_value_rule_primary_dimension = proto.Field( + proto.ENUM, + number=138, + enum=gage_conversion_value_rule_primary_dimension.ConversionValueRulePrimaryDimensionEnum.ConversionValueRulePrimaryDimension, + ) webpage = proto.Field(proto.STRING, number=129, optional=True,) week = proto.Field(proto.STRING, number=130, optional=True,) year = proto.Field(proto.INT32, number=131, optional=True,) diff --git a/google/ads/googleads/v8/common/types/user_lists.py b/google/ads/googleads/v8/common/types/user_lists.py index 3072d5af5..ccf1df109 100644 --- a/google/ads/googleads/v8/common/types/user_lists.py +++ b/google/ads/googleads/v8/common/types/user_lists.py @@ -76,11 +76,11 @@ class CrmBasedUserListInfo(proto.Message): Attributes: app_id (str): A string that uniquely identifies a mobile - application from which the data was collected to - the Google Ads API. For iOS, the ID string is - the 9 digit string that appears at the end of an - App Store URL (e.g., "476943146" for "Flood-It! - 2" whose App Store link is + application from which the data was collected. + For iOS, the ID string is the 9 digit string + that appears at the end of an App Store URL + (e.g., "476943146" for "Flood-It! 2" whose App + Store link is http://itunes.apple.com/us/app/flood- it!-2/id476943146). For Android, the ID string is the application's package name (e.g., diff --git a/google/ads/googleads/v8/enums/__init__.py b/google/ads/googleads/v8/enums/__init__.py index 0f7ae1fba..8645af7c8 100644 --- a/google/ads/googleads/v8/enums/__init__.py +++ b/google/ads/googleads/v8/enums/__init__.py @@ -91,6 +91,9 @@ "ConversionCustomVariableStatusEnum", "ConversionLagBucketEnum", "ConversionOrAdjustmentLagBucketEnum", + "ConversionValueRulePrimaryDimensionEnum", + "ConversionValueRuleSetStatusEnum", + "ConversionValueRuleStatusEnum", "CriterionCategoryChannelAvailabilityModeEnum", "CriterionCategoryLocaleAvailabilityModeEnum", "CriterionSystemServingStatusEnum", @@ -227,6 +230,8 @@ "SearchEngineResultsPageTypeEnum", "SearchTermMatchTypeEnum", "SearchTermTargetingStatusEnum", + "SeasonalityEventScopeEnum", + "SeasonalityEventStatusEnum", "ServedAssetFieldTypeEnum", "SharedSetStatusEnum", "SharedSetTypeEnum", @@ -260,6 +265,11 @@ "UserListSizeRangeEnum", "UserListStringRuleItemOperatorEnum", "UserListTypeEnum", + "ValueRuleDeviceTypeEnum", + "ValueRuleGeoLocationMatchTypeEnum", + "ValueRuleOperationEnum", + "ValueRuleSetAttachmentTypeEnum", + "ValueRuleSetDimensionEnum", "VanityPharmaDisplayUrlModeEnum", "VanityPharmaTextEnum", "WebpageConditionOperandEnum", diff --git a/google/ads/googleads/v8/enums/types/bidding_strategy_type.py b/google/ads/googleads/v8/enums/types/bidding_strategy_type.py index f9d72f349..ecba2860d 100644 --- a/google/ads/googleads/v8/enums/types/bidding_strategy_type.py +++ b/google/ads/googleads/v8/enums/types/bidding_strategy_type.py @@ -34,6 +34,7 @@ class BiddingStrategyType(proto.Enum): UNKNOWN = 1 COMMISSION = 16 ENHANCED_CPC = 2 + INVALID = 17 MANUAL_CPC = 3 MANUAL_CPM = 4 MANUAL_CPV = 13 diff --git a/google/ads/googleads/v8/enums/types/change_event_resource_type.py b/google/ads/googleads/v8/enums/types/change_event_resource_type.py index 3bcba4df2..a71e592a4 100644 --- a/google/ads/googleads/v8/enums/types/change_event_resource_type.py +++ b/google/ads/googleads/v8/enums/types/change_event_resource_type.py @@ -46,6 +46,10 @@ class ChangeEventResourceType(proto.Enum): CAMPAIGN_FEED = 11 AD_GROUP_FEED = 12 AD_GROUP_AD = 13 + ASSET = 14 + CUSTOMER_ASSET = 15 + CAMPAIGN_ASSET = 16 + AD_GROUP_ASSET = 17 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/enums/types/change_status_resource_type.py b/google/ads/googleads/v8/enums/types/change_status_resource_type.py index 5292d0b6e..8328047ad 100644 --- a/google/ads/googleads/v8/enums/types/change_status_resource_type.py +++ b/google/ads/googleads/v8/enums/types/change_status_resource_type.py @@ -44,6 +44,12 @@ class ChangeStatusResourceType(proto.Enum): AD_GROUP_FEED = 11 CAMPAIGN_FEED = 12 AD_GROUP_BID_MODIFIER = 13 + SHARED_SET = 14 + CAMPAIGN_SHARED_SET = 15 + ASSET = 16 + CUSTOMER_ASSET = 17 + CAMPAIGN_ASSET = 18 + AD_GROUP_ASSET = 19 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/enums/types/conversion_adjustment_type.py b/google/ads/googleads/v8/enums/types/conversion_adjustment_type.py index 296f3f57e..d9815a4f2 100644 --- a/google/ads/googleads/v8/enums/types/conversion_adjustment_type.py +++ b/google/ads/googleads/v8/enums/types/conversion_adjustment_type.py @@ -35,6 +35,7 @@ class ConversionAdjustmentType(proto.Enum): UNKNOWN = 1 RETRACTION = 2 RESTATEMENT = 3 + ENHANCEMENT = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_action_counting_type.py b/google/ads/googleads/v8/enums/types/conversion_value_rule_primary_dimension.py similarity index 55% rename from google/ads/googleads/v6/enums/types/conversion_action_counting_type.py rename to google/ads/googleads/v8/enums/types/conversion_value_rule_primary_dimension.py index 3bceb817e..60847d49b 100644 --- a/google/ads/googleads/v6/enums/types/conversion_action_counting_type.py +++ b/google/ads/googleads/v8/enums/types/conversion_value_rule_primary_dimension.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,31 +13,34 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionActionCountingTypeEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRulePrimaryDimensionEnum",}, ) -class ConversionActionCountingTypeEnum(proto.Message): - r"""Container for enum describing the conversion deduplication - mode for conversion optimizer. - """ +class ConversionValueRulePrimaryDimensionEnum(proto.Message): + r"""Container for enum describing value rule primary dimension + for stats. + """ - class ConversionActionCountingType(proto.Enum): - r"""Indicates how conversions for this action will be counted. - For more information, see https://support.google.com/google- - ads/answer/3438531. + class ConversionValueRulePrimaryDimension(proto.Enum): + r"""Identifies the primary dimension for conversion value rule + stats. """ UNSPECIFIED = 0 UNKNOWN = 1 - ONE_PER_CLICK = 2 - MANY_PER_CLICK = 3 + NO_RULE_APPLIED = 2 + ORIGINAL = 3 + NEW_VS_RETURNING_USER = 4 + GEO_LOCATION = 5 + DEVICE = 6 + AUDIENCE = 7 + MULTIPLE = 8 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/campaign_status.py b/google/ads/googleads/v8/enums/types/conversion_value_rule_set_status.py similarity index 68% rename from google/ads/googleads/v6/enums/types/campaign_status.py rename to google/ads/googleads/v8/enums/types/conversion_value_rule_set_status.py index 3c6ce1667..90e5d61a3 100644 --- a/google/ads/googleads/v6/enums/types/campaign_status.py +++ b/google/ads/googleads/v8/enums/types/conversion_value_rule_set_status.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,29 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignStatusEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRuleSetStatusEnum",}, ) -class CampaignStatusEnum(proto.Message): +class ConversionValueRuleSetStatusEnum(proto.Message): r"""Container for enum describing possible statuses of a - campaign. - """ + conversion value rule set. + """ - class CampaignStatus(proto.Enum): - r"""Possible statuses of a campaign.""" + class ConversionValueRuleSetStatus(proto.Enum): + r"""Possible statuses of a conversion value rule set.""" UNSPECIFIED = 0 UNKNOWN = 1 ENABLED = 2 - PAUSED = 3 - REMOVED = 4 + REMOVED = 3 + PAUSED = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/conversion_action_status.py b/google/ads/googleads/v8/enums/types/conversion_value_rule_status.py similarity index 70% rename from google/ads/googleads/v6/enums/types/conversion_action_status.py rename to google/ads/googleads/v8/enums/types/conversion_value_rule_status.py index 5743fe687..04f3e97ff 100644 --- a/google/ads/googleads/v6/enums/types/conversion_action_status.py +++ b/google/ads/googleads/v8/enums/types/conversion_value_rule_status.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,29 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ConversionActionStatusEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRuleStatusEnum",}, ) -class ConversionActionStatusEnum(proto.Message): +class ConversionValueRuleStatusEnum(proto.Message): r"""Container for enum describing possible statuses of a - conversion action. - """ + conversion value rule. + """ - class ConversionActionStatus(proto.Enum): - r"""Possible statuses of a conversion action.""" + class ConversionValueRuleStatus(proto.Enum): + r"""Possible statuses of a conversion value rule.""" UNSPECIFIED = 0 UNKNOWN = 1 ENABLED = 2 REMOVED = 3 - HIDDEN = 4 + PAUSED = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/frequency_cap_level.py b/google/ads/googleads/v8/enums/types/seasonality_event_scope.py similarity index 61% rename from google/ads/googleads/v6/enums/types/frequency_cap_level.py rename to google/ads/googleads/v8/enums/types/seasonality_event_scope.py index 6c7c5a5c9..4e29fa8e0 100644 --- a/google/ads/googleads/v6/enums/types/frequency_cap_level.py +++ b/google/ads/googleads/v8/enums/types/seasonality_event_scope.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,31 +13,29 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"FrequencyCapLevelEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"SeasonalityEventScopeEnum",}, ) -class FrequencyCapLevelEnum(proto.Message): - r"""Container for enum describing the level on which the cap is - to be applied. - """ - - class FrequencyCapLevel(proto.Enum): - r"""The level on which the cap is to be applied (e.g ad group ad, - ad group). Cap is applied to all the resources of this level. +class SeasonalityEventScopeEnum(proto.Message): + r"""Message describing seasonality event scopes. The two types of + seasonality events are BiddingSeasonalityAdjustments and + BiddingDataExclusions. """ + + class SeasonalityEventScope(proto.Enum): + r"""The possible scopes of a Seasonality Event.""" UNSPECIFIED = 0 UNKNOWN = 1 - AD_GROUP_AD = 2 - AD_GROUP = 3 + CUSTOMER = 2 CAMPAIGN = 4 + CHANNEL = 5 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/ad_group_ad_status.py b/google/ads/googleads/v8/enums/types/seasonality_event_status.py similarity index 63% rename from google/ads/googleads/v6/enums/types/ad_group_ad_status.py rename to google/ads/googleads/v8/enums/types/seasonality_event_status.py index 114a4573d..84ac475de 100644 --- a/google/ads/googleads/v6/enums/types/ad_group_ad_status.py +++ b/google/ads/googleads/v8/enums/types/seasonality_event_status.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,28 +13,27 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"AdGroupAdStatusEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"SeasonalityEventStatusEnum",}, ) -class AdGroupAdStatusEnum(proto.Message): - r"""Container for enum describing possible statuses of an - AdGroupAd. - """ +class SeasonalityEventStatusEnum(proto.Message): + r"""Message describing seasonality event statuses. The two types + of seasonality events are BiddingSeasonalityAdjustments and + BiddingDataExclusions. + """ - class AdGroupAdStatus(proto.Enum): - r"""The possible statuses of an AdGroupAd.""" + class SeasonalityEventStatus(proto.Enum): + r"""The possible statuses of a Seasonality Event.""" UNSPECIFIED = 0 UNKNOWN = 1 ENABLED = 2 - PAUSED = 3 REMOVED = 4 diff --git a/google/ads/googleads/v8/enums/types/user_identifier_source.py b/google/ads/googleads/v8/enums/types/user_identifier_source.py index 007d4b36f..f1d7aa630 100644 --- a/google/ads/googleads/v8/enums/types/user_identifier_source.py +++ b/google/ads/googleads/v8/enums/types/user_identifier_source.py @@ -25,12 +25,13 @@ class UserIdentifierSourceEnum(proto.Message): r"""Container for enum describing the source of the user - identifier for offline Store Sales third party uploads. + identifier for offline Store Sales, click conversion, and + conversion adjustment uploads. """ class UserIdentifierSource(proto.Enum): - r"""The type of user identifier source for offline Store Sales - third party uploads. + r"""The type of user identifier source for offline Store Sales, + click conversion, and conversion adjustment uploads. """ UNSPECIFIED = 0 UNKNOWN = 1 diff --git a/google/ads/googleads/v6/enums/types/extension_setting_device.py b/google/ads/googleads/v8/enums/types/value_rule_device_type.py similarity index 65% rename from google/ads/googleads/v6/enums/types/extension_setting_device.py rename to google/ads/googleads/v8/enums/types/value_rule_device_type.py index 4b667114f..071dc0592 100644 --- a/google/ads/googleads/v6/enums/types/extension_setting_device.py +++ b/google/ads/googleads/v8/enums/types/value_rule_device_type.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,26 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ExtensionSettingDeviceEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ValueRuleDeviceTypeEnum",}, ) -class ExtensionSettingDeviceEnum(proto.Message): - r"""Container for enum describing extension setting device types.""" +class ValueRuleDeviceTypeEnum(proto.Message): + r"""Container for enum describing possible device types used in a + conversion value rule. + """ - class ExtensionSettingDevice(proto.Enum): - r"""Possible device types for an extension setting.""" + class ValueRuleDeviceType(proto.Enum): + r"""Possible device types used in conversion value rule.""" UNSPECIFIED = 0 UNKNOWN = 1 MOBILE = 2 DESKTOP = 3 + TABLET = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/geo_targeting_type.py b/google/ads/googleads/v8/enums/types/value_rule_geo_location_match_type.py similarity index 63% rename from google/ads/googleads/v6/enums/types/geo_targeting_type.py rename to google/ads/googleads/v8/enums/types/value_rule_geo_location_match_type.py index c820e610d..7dd8b7a91 100644 --- a/google/ads/googleads/v6/enums/types/geo_targeting_type.py +++ b/google/ads/googleads/v8/enums/types/value_rule_geo_location_match_type.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,25 +13,26 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"GeoTargetingTypeEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ValueRuleGeoLocationMatchTypeEnum",}, ) -class GeoTargetingTypeEnum(proto.Message): - r"""Container for enum describing possible geo targeting types.""" +class ValueRuleGeoLocationMatchTypeEnum(proto.Message): + r"""Container for enum describing possible geographic location + matching types used in a conversion value rule. + """ - class GeoTargetingType(proto.Enum): - r"""The possible geo targeting types.""" + class ValueRuleGeoLocationMatchType(proto.Enum): + r"""Possible geographic location matching types.""" UNSPECIFIED = 0 UNKNOWN = 1 - AREA_OF_INTEREST = 2 + ANY = 2 LOCATION_OF_PRESENCE = 3 diff --git a/google/ads/googleads/v6/enums/types/campaign_experiment_type.py b/google/ads/googleads/v8/enums/types/value_rule_operation.py similarity index 62% rename from google/ads/googleads/v6/enums/types/campaign_experiment_type.py rename to google/ads/googleads/v8/enums/types/value_rule_operation.py index bc11f6bbd..fb45fa045 100644 --- a/google/ads/googleads/v6/enums/types/campaign_experiment_type.py +++ b/google/ads/googleads/v8/enums/types/value_rule_operation.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,29 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"CampaignExperimentTypeEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ValueRuleOperationEnum",}, ) -class CampaignExperimentTypeEnum(proto.Message): - r"""Container for enum describing campaign experiment type.""" - - class CampaignExperimentType(proto.Enum): - r"""Indicates if this campaign is a normal campaign, - a draft campaign, or an experiment campaign. +class ValueRuleOperationEnum(proto.Message): + r"""Container for enum describing possible operations for value + rules which are executed when rules are triggered. """ + + class ValueRuleOperation(proto.Enum): + r"""Possible operations of the action of a conversion value rule.""" UNSPECIFIED = 0 UNKNOWN = 1 - BASE = 2 - DRAFT = 3 - EXPERIMENT = 4 + ADD = 2 + MULTIPLY = 3 + SET = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/enums/types/image_placeholder_field.py b/google/ads/googleads/v8/enums/types/value_rule_set_attachment_type.py similarity index 64% rename from google/ads/googleads/v6/enums/types/image_placeholder_field.py rename to google/ads/googleads/v8/enums/types/value_rule_set_attachment_type.py index ac515f42a..4b9ff050d 100644 --- a/google/ads/googleads/v6/enums/types/image_placeholder_field.py +++ b/google/ads/googleads/v8/enums/types/value_rule_set_attachment_type.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,27 +13,27 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.enums", - marshal="google.ads.googleads.v6", - manifest={"ImagePlaceholderFieldEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ValueRuleSetAttachmentTypeEnum",}, ) -class ImagePlaceholderFieldEnum(proto.Message): - r"""Values for Advertiser Provided Image placeholder fields.""" - - class ImagePlaceholderField(proto.Enum): - r"""Possible values for Advertiser Provided Image placeholder - fields. +class ValueRuleSetAttachmentTypeEnum(proto.Message): + r"""Container for enum describing where a value rule set is + attached. """ + + class ValueRuleSetAttachmentType(proto.Enum): + r"""Possible level where a value rule set is attached.""" UNSPECIFIED = 0 UNKNOWN = 1 - ASSET_ID = 2 + CUSTOMER = 2 + CAMPAIGN = 3 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v6/errors/types/customer_error.py b/google/ads/googleads/v8/enums/types/value_rule_set_dimension.py similarity index 63% rename from google/ads/googleads/v6/errors/types/customer_error.py rename to google/ads/googleads/v8/enums/types/value_rule_set_dimension.py index 8cf94d8f6..b9ddcc7da 100644 --- a/google/ads/googleads/v6/errors/types/customer_error.py +++ b/google/ads/googleads/v8/enums/types/value_rule_set_dimension.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,28 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.errors", - marshal="google.ads.googleads.v6", - manifest={"CustomerErrorEnum",}, + package="google.ads.googleads.v8.enums", + marshal="google.ads.googleads.v8", + manifest={"ValueRuleSetDimensionEnum",}, ) -class CustomerErrorEnum(proto.Message): - r"""Container for enum describing possible customer errors.""" - - class CustomerError(proto.Enum): - r"""Set of errors that are related to requests dealing with - Customer. +class ValueRuleSetDimensionEnum(proto.Message): + r"""Container for enum describing possible dimensions of a + conversion value rule set. """ + + class ValueRuleSetDimension(proto.Enum): + r"""Possible dimensions of a conversion value rule set.""" UNSPECIFIED = 0 UNKNOWN = 1 - STATUS_CHANGE_DISALLOWED = 2 - ACCOUNT_NOT_SET_UP = 3 + GEO_LOCATION = 2 + DEVICE = 3 + AUDIENCE = 4 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/__init__.py b/google/ads/googleads/v8/errors/__init__.py index 720761e70..127f866ce 100644 --- a/google/ads/googleads/v8/errors/__init__.py +++ b/google/ads/googleads/v8/errors/__init__.py @@ -51,6 +51,8 @@ "ConversionAdjustmentUploadErrorEnum", "ConversionCustomVariableErrorEnum", "ConversionUploadErrorEnum", + "ConversionValueRuleErrorEnum", + "ConversionValueRuleSetErrorEnum", "CountryCodeErrorEnum", "CriterionErrorEnum", "CurrencyCodeErrorEnum", diff --git a/google/ads/googleads/v8/errors/types/conversion_adjustment_upload_error.py b/google/ads/googleads/v8/errors/types/conversion_adjustment_upload_error.py index c234c28e5..18f85e519 100644 --- a/google/ads/googleads/v8/errors/types/conversion_adjustment_upload_error.py +++ b/google/ads/googleads/v8/errors/types/conversion_adjustment_upload_error.py @@ -45,6 +45,11 @@ class ConversionAdjustmentUploadError(proto.Enum): ) TOO_MANY_ADJUSTMENTS_IN_REQUEST = 11 TOO_MANY_ADJUSTMENTS = 12 + CUSTOMER_NOT_ACCEPTED_CUSTOMER_DATA_TERMS = 15 + CONVERSION_ACTION_NOT_ELIGIBLE_FOR_ENHANCEMENT = 16 + INVALID_USER_IDENTIFIER = 17 + UNSUPPORTED_USER_IDENTIFIER = 18 + INVALID_USER_IDENTIFIER_SOURCE = 19 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/types/conversion_upload_error.py b/google/ads/googleads/v8/errors/types/conversion_upload_error.py index 668399822..ad8c7d61a 100644 --- a/google/ads/googleads/v8/errors/types/conversion_upload_error.py +++ b/google/ads/googleads/v8/errors/types/conversion_upload_error.py @@ -62,6 +62,13 @@ class ConversionUploadError(proto.Enum): INVALID_CUSTOMER_FOR_CLICK = 30 INVALID_CUSTOMER_FOR_CALL = 31 CONVERSION_NOT_COMPLIANT_WITH_ATT_POLICY = 32 + CLICK_NOT_FOUND = 33 + INVALID_USER_IDENTIFIER = 34 + EXTERNALLY_ATTRIBUTED_CONVERSION_ACTION_NOT_PERMITTED_WITH_USER_IDENTIFIER = ( + 35 + ) + UNSUPPORTED_USER_IDENTIFIER = 36 + INVALID_USER_IDENTIFIER_SOURCE = 37 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/types/conversion_value_rule_error.py b/google/ads/googleads/v8/errors/types/conversion_value_rule_error.py new file mode 100644 index 000000000..0913f49f9 --- /dev/null +++ b/google/ads/googleads/v8/errors/types/conversion_value_rule_error.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.errors", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRuleErrorEnum",}, +) + + +class ConversionValueRuleErrorEnum(proto.Message): + r"""Container for enum describing possible conversion value rule + errors. + """ + + class ConversionValueRuleError(proto.Enum): + r"""Enum describing possible conversion value rule errors.""" + UNSPECIFIED = 0 + UNKNOWN = 1 + INVALID_GEO_TARGET_CONSTANT = 2 + CONFLICTING_INCLUDED_AND_EXCLUDED_GEO_TARGET = 3 + CONFLICTING_CONDITIONS = 4 + CANNOT_REMOVE_IF_INCLUDED_IN_VALUE_RULE_SET = 5 + CONDITION_NOT_ALLOWED = 6 + FIELD_MUST_BE_UNSET = 7 + CANNOT_PAUSE_UNLESS_VALUE_RULE_SET_IS_PAUSED = 8 + UNTARGETABLE_GEO_TARGET = 9 + INVALID_AUDIENCE_USER_LIST = 10 + INACCESSIBLE_USER_LIST = 11 + INVALID_AUDIENCE_USER_INTEREST = 12 + CANNOT_ADD_RULE_WITH_STATUS_REMOVED = 13 + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/types/conversion_value_rule_set_error.py b/google/ads/googleads/v8/errors/types/conversion_value_rule_set_error.py new file mode 100644 index 000000000..43ee622d1 --- /dev/null +++ b/google/ads/googleads/v8/errors/types/conversion_value_rule_set_error.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.errors", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRuleSetErrorEnum",}, +) + + +class ConversionValueRuleSetErrorEnum(proto.Message): + r"""Container for enum describing possible conversion value rule + set errors. + """ + + class ConversionValueRuleSetError(proto.Enum): + r"""Enum describing possible conversion value rule set errors.""" + UNSPECIFIED = 0 + UNKNOWN = 1 + CONFLICTING_VALUE_RULE_CONDITIONS = 2 + INVALID_VALUE_RULE = 3 + DIMENSIONS_UPDATE_ONLY_ALLOW_APPEND = 4 + CONDITION_TYPE_NOT_ALLOWED = 5 + DUPLICATE_DIMENSIONS = 6 + INVALID_CAMPAIGN_ID = 7 + CANNOT_PAUSE_UNLESS_ALL_VALUE_RULES_ARE_PAUSED = 8 + SHOULD_PAUSE_WHEN_ALL_VALUE_RULES_ARE_PAUSED = 9 + VALUE_RULES_NOT_SUPPORTED_FOR_CAMPAIGN_TYPE = 10 + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/types/criterion_error.py b/google/ads/googleads/v8/errors/types/criterion_error.py index ce5f3f835..ec756007f 100644 --- a/google/ads/googleads/v8/errors/types/criterion_error.py +++ b/google/ads/googleads/v8/errors/types/criterion_error.py @@ -155,6 +155,7 @@ class CriterionError(proto.Enum): HOTEL_CHECK_IN_DATE_RANGE_START_DATE_TOO_EARLY = 132 HOTEL_CHECK_IN_DATE_RANGE_END_DATE_TOO_LATE = 133 HOTEL_CHECK_IN_DATE_RANGE_REVERSED = 134 + BROAD_MATCH_MODIFIER_KEYWORD_NOT_ALLOWED = 135 __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/errors/types/errors.py b/google/ads/googleads/v8/errors/types/errors.py index e6e425a7d..a63925efe 100644 --- a/google/ads/googleads/v8/errors/types/errors.py +++ b/google/ads/googleads/v8/errors/types/errors.py @@ -120,6 +120,12 @@ from google.ads.googleads.v8.errors.types import ( conversion_upload_error as gage_conversion_upload_error, ) +from google.ads.googleads.v8.errors.types import ( + conversion_value_rule_error as gage_conversion_value_rule_error, +) +from google.ads.googleads.v8.errors.types import ( + conversion_value_rule_set_error as gage_conversion_value_rule_set_error, +) from google.ads.googleads.v8.errors.types import ( country_code_error as gage_country_code_error, ) @@ -375,7 +381,7 @@ class GoogleAdsFailure(proto.Message): errors (Sequence[google.ads.googleads.v8.errors.types.GoogleAdsError]): The list of errors that occurred. request_id (str): - The unique id of the request that is used for + The unique ID of the request that is used for debugging purposes. """ @@ -555,6 +561,12 @@ class ErrorCode(proto.Message): variable error conversion_upload_error (google.ads.googleads.v8.errors.types.ConversionUploadErrorEnum.ConversionUploadError): The reasons for the conversion upload error + conversion_value_rule_error (google.ads.googleads.v8.errors.types.ConversionValueRuleErrorEnum.ConversionValueRuleError): + The reasons for the conversion value rule + error + conversion_value_rule_set_error (google.ads.googleads.v8.errors.types.ConversionValueRuleSetErrorEnum.ConversionValueRuleSetError): + The reasons for the conversion value rule set + error header_error (google.ads.googleads.v8.errors.types.HeaderErrorEnum.HeaderError): The reasons for the header error. database_error (google.ads.googleads.v8.errors.types.DatabaseErrorEnum.DatabaseError): @@ -1064,6 +1076,18 @@ class ErrorCode(proto.Message): oneof="error_code", enum=gage_conversion_upload_error.ConversionUploadErrorEnum.ConversionUploadError, ) + conversion_value_rule_error = proto.Field( + proto.ENUM, + number=145, + oneof="error_code", + enum=gage_conversion_value_rule_error.ConversionValueRuleErrorEnum.ConversionValueRuleError, + ) + conversion_value_rule_set_error = proto.Field( + proto.ENUM, + number=146, + oneof="error_code", + enum=gage_conversion_value_rule_set_error.ConversionValueRuleSetErrorEnum.ConversionValueRuleSetError, + ) header_error = proto.Field( proto.ENUM, number=66, diff --git a/google/ads/googleads/v8/resources/__init__.py b/google/ads/googleads/v8/resources/__init__.py index e3037beea..bcfd4a727 100644 --- a/google/ads/googleads/v8/resources/__init__.py +++ b/google/ads/googleads/v8/resources/__init__.py @@ -44,6 +44,8 @@ "AssetPolicySummary", "AttributeFieldMapping", "BatchJob", + "BiddingDataExclusion", + "BiddingSeasonalityAdjustment", "BiddingStrategy", "BiddingStrategySimulation", "BillingSetup", @@ -71,6 +73,8 @@ "ConversionAction", "ConversionCustomVariable", "ConversionTrackingSetting", + "ConversionValueRule", + "ConversionValueRuleSet", "CurrencyConstant", "CustomAudience", "CustomAudienceMember", diff --git a/google/ads/googleads/v8/resources/types/accessible_bidding_strategy.py b/google/ads/googleads/v8/resources/types/accessible_bidding_strategy.py index 106bcfe97..13b3a1205 100644 --- a/google/ads/googleads/v8/resources/types/accessible_bidding_strategy.py +++ b/google/ads/googleads/v8/resources/types/accessible_bidding_strategy.py @@ -114,6 +114,21 @@ class MaximizeConversions(proto.Message): target_cpa = proto.Field(proto.INT64, number=1,) + class TargetCpa(proto.Message): + r"""An automated bid strategy that sets bids to help get as many + conversions as possible at the target cost-per-acquisition (CPA) + you set. + + Attributes: + target_cpa_micros (int): + Output only. Average CPA target. + This target should be greater than or equal to + minimum billable unit based on the currency for + the account. + """ + + target_cpa_micros = proto.Field(proto.INT64, number=1, optional=True,) + class TargetSpend(proto.Message): r"""An automated bid strategy that sets your bids to help get as many clicks as possible within your budget. @@ -140,33 +155,6 @@ class TargetSpend(proto.Message): proto.INT64, number=2, optional=True, ) - class TargetCpa(proto.Message): - r"""An automated bid strategy that sets bids to help get as many - conversions as possible at the target cost-per-acquisition (CPA) - you set. - - Attributes: - target_cpa_micros (int): - Output only. Average CPA target. - This target should be greater than or equal to - minimum billable unit based on the currency for - the account. - """ - - target_cpa_micros = proto.Field(proto.INT64, number=1, optional=True,) - - class TargetRoas(proto.Message): - r"""An automated bidding strategy that helps you maximize revenue - while averaging a specific target return on ad spend (ROAS). - - Attributes: - target_roas (float): - Output only. The desired revenue (based on - conversion data) per unit of spend. - """ - - target_roas = proto.Field(proto.DOUBLE, number=1, optional=True,) - class TargetImpressionShare(proto.Message): r"""An automated bidding strategy that sets bids so that a certain percentage of search ads are shown at the top of the @@ -200,6 +188,18 @@ class TargetImpressionShare(proto.Message): proto.INT64, number=3, optional=True, ) + class TargetRoas(proto.Message): + r"""An automated bidding strategy that helps you maximize revenue + while averaging a specific target return on ad spend (ROAS). + + Attributes: + target_roas (float): + Output only. The desired revenue (based on + conversion data) per unit of spend. + """ + + target_roas = proto.Field(proto.DOUBLE, number=1, optional=True,) + resource_name = proto.Field(proto.STRING, number=1,) id = proto.Field(proto.INT64, number=2,) name = proto.Field(proto.STRING, number=3,) diff --git a/google/ads/googleads/v8/resources/types/ad_group.py b/google/ads/googleads/v8/resources/types/ad_group.py index 243d48513..422846289 100644 --- a/google/ads/googleads/v8/resources/types/ad_group.py +++ b/google/ads/googleads/v8/resources/types/ad_group.py @@ -89,7 +89,12 @@ class AdGroup(proto.Message): The maximum CPM (cost-per-thousand viewable impressions) bid. target_cpa_micros (int): - The target CPA (cost-per-acquisition). + The target CPA (cost-per-acquisition). If the ad group's + campaign bidding strategy is TargetCpa or + MaximizeConversions (with its target_cpa field set), then + this field overrides the target CPA specified in the + campaign's bidding strategy. Otherwise, this value is + ignored. cpv_bid_micros (int): Output only. The CPV (cost-per-view) bid. target_cpm_micros (int): @@ -97,12 +102,12 @@ class AdGroup(proto.Message): is willing to pay for every thousand times the ad is shown. target_roas (float): - The target ROAS (return-on-ad-spend) - override. If the ad group's campaign bidding - strategy is a standard Target ROAS strategy, - then this field overrides the target ROAS - specified in the campaign's bidding strategy. - Otherwise, this value is ignored. + The target ROAS (return-on-ad-spend) override. If the ad + group's campaign bidding strategy is TargetRoas or + MaximizeConversionValue (with its target_roas field set), + then this field overrides the target ROAS specified in the + campaign's bidding strategy. Otherwise, this value is + ignored. percent_cpc_bid_micros (int): The percent cpc bid amount, expressed as a fraction of the advertised price for some good or service. The valid range diff --git a/google/ads/googleads/v8/resources/types/ad_group_ad.py b/google/ads/googleads/v8/resources/types/ad_group_ad.py index 7a7b6255a..aa5061c94 100644 --- a/google/ads/googleads/v8/resources/types/ad_group_ad.py +++ b/google/ads/googleads/v8/resources/types/ad_group_ad.py @@ -50,6 +50,12 @@ class AdGroupAd(proto.Message): ad_strength (google.ads.googleads.v8.enums.types.AdStrengthEnum.AdStrength): Output only. Overall ad strength for this ad group ad. + action_items (Sequence[str]): + Output only. A list of recommendations to + improve the ad strength. For example, a + recommendation could be "Your headlines are a + little too similar. Try adding more distinct + headlines.". labels (Sequence[str]): Output only. The resource names of labels attached to this ad group ad. @@ -69,6 +75,7 @@ class AdGroupAd(proto.Message): ad_strength = proto.Field( proto.ENUM, number=7, enum=gage_ad_strength.AdStrengthEnum.AdStrength, ) + action_items = proto.RepeatedField(proto.STRING, number=13,) labels = proto.RepeatedField(proto.STRING, number=10,) diff --git a/google/ads/googleads/v8/resources/types/bidding_data_exclusion.py b/google/ads/googleads/v8/resources/types/bidding_data_exclusion.py new file mode 100644 index 000000000..52e9cd3e4 --- /dev/null +++ b/google/ads/googleads/v8/resources/types/bidding_data_exclusion.py @@ -0,0 +1,114 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import advertising_channel_type +from google.ads.googleads.v8.enums.types import device +from google.ads.googleads.v8.enums.types import seasonality_event_scope +from google.ads.googleads.v8.enums.types import seasonality_event_status + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.resources", + marshal="google.ads.googleads.v8", + manifest={"BiddingDataExclusion",}, +) + + +class BiddingDataExclusion(proto.Message): + r"""Represents a bidding data exclusion. + See "About data exclusions" at + https://support.google.com/google-ads/answer/10370710. + + Attributes: + resource_name (str): + Immutable. The resource name of the data exclusion. Data + exclusion resource names have the form: + + ``customers/{customer_id}/biddingDataExclusions/{data_exclusion_id}`` + data_exclusion_id (int): + Output only. The ID of the data exclusion. + scope (google.ads.googleads.v8.enums.types.SeasonalityEventScopeEnum.SeasonalityEventScope): + The scope of the data exclusion. + status (google.ads.googleads.v8.enums.types.SeasonalityEventStatusEnum.SeasonalityEventStatus): + Output only. The status of the data + exclusion. + start_date_time (str): + Required. The inclusive start time of the + data exclusion in yyyy-MM-dd HH:mm:ss format. + A data exclusion is backward looking and should + be used for events that start in the past and + end either in the past or future. + end_date_time (str): + Required. The exclusive end time of the data exclusion in + yyyy-MM-dd HH:mm:ss format. + + The length of [start_date_time, end_date_time) interval must + be within (0, 14 days]. + name (str): + The name of the data exclusion. The name can + be at most 255 characters. + description (str): + The description of the data exclusion. The + description can be at most 2048 characters. + devices (Sequence[google.ads.googleads.v8.enums.types.DeviceEnum.Device]): + If not specified, all devices will be + included in this exclusion. Otherwise, only the + specified targeted devices will be included in + this exclusion. + campaigns (Sequence[str]): + The data exclusion will apply to the campaigns listed when + the scope of this exclusion is CAMPAIGN. The maximum number + of campaigns per event is 2000. Note: a data exclusion with + both advertising_channel_types and campaign_ids is not + supported. + advertising_channel_types (Sequence[google.ads.googleads.v8.enums.types.AdvertisingChannelTypeEnum.AdvertisingChannelType]): + The data_exclusion will apply to all the campaigns under the + listed channels retroactively as well as going forward when + the scope of this exclusion is CHANNEL. The supported + advertising channel types are DISPLAY, SEARCH and SHOPPING. + Note: a data exclusion with both advertising_channel_types + and campaign_ids is not supported. + """ + + resource_name = proto.Field(proto.STRING, number=1,) + data_exclusion_id = proto.Field(proto.INT64, number=2,) + scope = proto.Field( + proto.ENUM, + number=3, + enum=seasonality_event_scope.SeasonalityEventScopeEnum.SeasonalityEventScope, + ) + status = proto.Field( + proto.ENUM, + number=4, + enum=seasonality_event_status.SeasonalityEventStatusEnum.SeasonalityEventStatus, + ) + start_date_time = proto.Field(proto.STRING, number=5,) + end_date_time = proto.Field(proto.STRING, number=6,) + name = proto.Field(proto.STRING, number=7,) + description = proto.Field(proto.STRING, number=8,) + devices = proto.RepeatedField( + proto.ENUM, number=9, enum=device.DeviceEnum.Device, + ) + campaigns = proto.RepeatedField(proto.STRING, number=10,) + advertising_channel_types = proto.RepeatedField( + proto.ENUM, + number=11, + enum=advertising_channel_type.AdvertisingChannelTypeEnum.AdvertisingChannelType, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/bidding_seasonality_adjustment.py b/google/ads/googleads/v8/resources/types/bidding_seasonality_adjustment.py new file mode 100644 index 000000000..87c0eccc3 --- /dev/null +++ b/google/ads/googleads/v8/resources/types/bidding_seasonality_adjustment.py @@ -0,0 +1,124 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import advertising_channel_type +from google.ads.googleads.v8.enums.types import device +from google.ads.googleads.v8.enums.types import seasonality_event_scope +from google.ads.googleads.v8.enums.types import seasonality_event_status + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.resources", + marshal="google.ads.googleads.v8", + manifest={"BiddingSeasonalityAdjustment",}, +) + + +class BiddingSeasonalityAdjustment(proto.Message): + r"""Represents a bidding seasonality adjustment. + See "About seasonality adjustments" at + https://support.google.com/google-ads/answer/10369906. + + Attributes: + resource_name (str): + Immutable. The resource name of the seasonality adjustment. + Seasonality adjustment resource names have the form: + + ``customers/{customer_id}/biddingSeasonalityAdjustments/{seasonality_adjustment_id}`` + seasonality_adjustment_id (int): + Output only. The ID of the seasonality + adjustment. + scope (google.ads.googleads.v8.enums.types.SeasonalityEventScopeEnum.SeasonalityEventScope): + The scope of the seasonality adjustment. + status (google.ads.googleads.v8.enums.types.SeasonalityEventStatusEnum.SeasonalityEventStatus): + Output only. The status of the seasonality + adjustment. + start_date_time (str): + Required. The inclusive start time of the + seasonality adjustment in yyyy-MM-dd HH:mm:ss + format. + A seasonality adjustment is forward looking and + should be used for events that start and end in + the future. + end_date_time (str): + Required. The exclusive end time of the seasonality + adjustment in yyyy-MM-dd HH:mm:ss format. + + The length of [start_date_time, end_date_time) interval must + be within (0, 14 days]. + name (str): + The name of the seasonality adjustment. The + name can be at most 255 characters. + description (str): + The description of the seasonality + adjustment. The description can be at most 2048 + characters. + devices (Sequence[google.ads.googleads.v8.enums.types.DeviceEnum.Device]): + If not specified, all devices will be + included in this adjustment. Otherwise, only the + specified targeted devices will be included in + this adjustment. + conversion_rate_modifier (float): + Conversion rate modifier estimated based on + expected conversion rate changes. When this + field is unset or set to 1.0 no adjustment will + be applied to traffic. The allowed range is 0.1 + to 10.0. + campaigns (Sequence[str]): + The seasonality adjustment will apply to the campaigns + listed when the scope of this adjustment is CAMPAIGN. The + maximum number of campaigns per event is 2000. Note: a + seasonality adjustment with both advertising_channel_types + and campaign_ids is not supported. + advertising_channel_types (Sequence[google.ads.googleads.v8.enums.types.AdvertisingChannelTypeEnum.AdvertisingChannelType]): + The seasonality adjustment will apply to all the campaigns + under the listed channels retroactively as well as going + forward when the scope of this adjustment is CHANNEL. The + supported advertising channel types are DISPLAY, SEARCH and + SHOPPING. Note: a seasonality adjustment with both + advertising_channel_types and campaign_ids is not supported. + """ + + resource_name = proto.Field(proto.STRING, number=1,) + seasonality_adjustment_id = proto.Field(proto.INT64, number=2,) + scope = proto.Field( + proto.ENUM, + number=3, + enum=seasonality_event_scope.SeasonalityEventScopeEnum.SeasonalityEventScope, + ) + status = proto.Field( + proto.ENUM, + number=4, + enum=seasonality_event_status.SeasonalityEventStatusEnum.SeasonalityEventStatus, + ) + start_date_time = proto.Field(proto.STRING, number=5,) + end_date_time = proto.Field(proto.STRING, number=6,) + name = proto.Field(proto.STRING, number=7,) + description = proto.Field(proto.STRING, number=8,) + devices = proto.RepeatedField( + proto.ENUM, number=9, enum=device.DeviceEnum.Device, + ) + conversion_rate_modifier = proto.Field(proto.DOUBLE, number=10,) + campaigns = proto.RepeatedField(proto.STRING, number=11,) + advertising_channel_types = proto.RepeatedField( + proto.ENUM, + number=12, + enum=advertising_channel_type.AdvertisingChannelTypeEnum.AdvertisingChannelType, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/campaign.py b/google/ads/googleads/v8/resources/types/campaign.py index 042bc7402..29e15144b 100644 --- a/google/ads/googleads/v8/resources/types/campaign.py +++ b/google/ads/googleads/v8/resources/types/campaign.py @@ -322,30 +322,18 @@ class HotelSettingInfo(proto.Message): hotel_center_id = proto.Field(proto.INT64, number=2, optional=True,) - class TrackingSetting(proto.Message): - r"""Campaign-level settings for tracking information. - Attributes: - tracking_url (str): - Output only. The url used for dynamic - tracking. - """ - - tracking_url = proto.Field(proto.STRING, number=2, optional=True,) - - class OptimizationGoalSetting(proto.Message): - r"""Optimization goal setting for this campaign, which includes a - set of optimization goal types. + class SelectiveOptimization(proto.Message): + r"""Selective optimization setting for this campaign, which + includes a set of conversion actions to optimize this campaign + towards. Attributes: - optimization_goal_types (Sequence[google.ads.googleads.v8.enums.types.OptimizationGoalTypeEnum.OptimizationGoalType]): - The list of optimization goal types. + conversion_actions (Sequence[str]): + The selected set of conversion actions for + optimizing this campaign. """ - optimization_goal_types = proto.RepeatedField( - proto.ENUM, - number=1, - enum=optimization_goal_type.OptimizationGoalTypeEnum.OptimizationGoalType, - ) + conversion_actions = proto.RepeatedField(proto.STRING, number=2,) class DynamicSearchAdsSetting(proto.Message): r"""The setting for controlling Dynamic Search Ads (DSA). @@ -405,18 +393,29 @@ class ShoppingSetting(proto.Message): campaign_priority = proto.Field(proto.INT32, number=7, optional=True,) enable_local = proto.Field(proto.BOOL, number=8, optional=True,) - class SelectiveOptimization(proto.Message): - r"""Selective optimization setting for this campaign, which - includes a set of conversion actions to optimize this campaign - towards. + class TrackingSetting(proto.Message): + r"""Campaign-level settings for tracking information. + Attributes: + tracking_url (str): + Output only. The url used for dynamic + tracking. + """ + tracking_url = proto.Field(proto.STRING, number=2, optional=True,) + + class LocalCampaignSetting(proto.Message): + r"""Campaign setting for local campaigns. Attributes: - conversion_actions (Sequence[str]): - The selected set of conversion actions for - optimizing this campaign. + location_source_type (google.ads.googleads.v8.enums.types.LocationSourceTypeEnum.LocationSourceType): + The location source type for this local + campaign. """ - conversion_actions = proto.RepeatedField(proto.STRING, number=2,) + location_source_type = proto.Field( + proto.ENUM, + number=1, + enum=gage_location_source_type.LocationSourceTypeEnum.LocationSourceType, + ) class GeoTargetTypeSetting(proto.Message): r"""Represents a collection of settings related to ads @@ -442,20 +441,6 @@ class GeoTargetTypeSetting(proto.Message): enum=gage_negative_geo_target_type.NegativeGeoTargetTypeEnum.NegativeGeoTargetType, ) - class LocalCampaignSetting(proto.Message): - r"""Campaign setting for local campaigns. - Attributes: - location_source_type (google.ads.googleads.v8.enums.types.LocationSourceTypeEnum.LocationSourceType): - The location source type for this local - campaign. - """ - - location_source_type = proto.Field( - proto.ENUM, - number=1, - enum=gage_location_source_type.LocationSourceTypeEnum.LocationSourceType, - ) - class AppCampaignSetting(proto.Message): r"""Campaign-level settings for App Campaigns. Attributes: @@ -506,6 +491,21 @@ class VanityPharma(proto.Message): enum=gage_vanity_pharma_text.VanityPharmaTextEnum.VanityPharmaText, ) + class OptimizationGoalSetting(proto.Message): + r"""Optimization goal setting for this campaign, which includes a + set of optimization goal types. + + Attributes: + optimization_goal_types (Sequence[google.ads.googleads.v8.enums.types.OptimizationGoalTypeEnum.OptimizationGoalType]): + The list of optimization goal types. + """ + + optimization_goal_types = proto.RepeatedField( + proto.ENUM, + number=1, + enum=optimization_goal_type.OptimizationGoalTypeEnum.OptimizationGoalType, + ) + resource_name = proto.Field(proto.STRING, number=1,) id = proto.Field(proto.INT64, number=59, optional=True,) name = proto.Field(proto.STRING, number=58, optional=True,) diff --git a/google/ads/googleads/v8/resources/types/change_event.py b/google/ads/googleads/v8/resources/types/change_event.py index 9ef67aa88..078c3f918 100644 --- a/google/ads/googleads/v8/resources/types/change_event.py +++ b/google/ads/googleads/v8/resources/types/change_event.py @@ -25,6 +25,9 @@ from google.ads.googleads.v8.resources.types import ( ad_group_ad as gagr_ad_group_ad, ) +from google.ads.googleads.v8.resources.types import ( + ad_group_asset as gagr_ad_group_asset, +) from google.ads.googleads.v8.resources.types import ( ad_group_bid_modifier as gagr_ad_group_bid_modifier, ) @@ -34,7 +37,11 @@ from google.ads.googleads.v8.resources.types import ( ad_group_feed as gagr_ad_group_feed, ) +from google.ads.googleads.v8.resources.types import asset as gagr_asset from google.ads.googleads.v8.resources.types import campaign as gagr_campaign +from google.ads.googleads.v8.resources.types import ( + campaign_asset as gagr_campaign_asset, +) from google.ads.googleads.v8.resources.types import ( campaign_budget as gagr_campaign_budget, ) @@ -44,6 +51,9 @@ from google.ads.googleads.v8.resources.types import ( campaign_feed as gagr_campaign_feed, ) +from google.ads.googleads.v8.resources.types import ( + customer_asset as gagr_customer_asset, +) from google.ads.googleads.v8.resources.types import feed as gagr_feed from google.ads.googleads.v8.resources.types import feed_item as gagr_feed_item from google.protobuf import field_mask_pb2 # type: ignore @@ -111,6 +121,9 @@ class ChangeEvent(proto.Message): feed_item (str): Output only. The FeedItem affected by this change. + asset (str): + Output only. The Asset affected by this + change. """ class ChangedResource(proto.Message): @@ -145,6 +158,14 @@ class ChangedResource(proto.Message): Output only. Set if change_resource_type == AD_GROUP_FEED. ad_group_ad (google.ads.googleads.v8.resources.types.AdGroupAd): Output only. Set if change_resource_type == AD_GROUP_AD. + asset (google.ads.googleads.v8.resources.types.Asset): + Output only. Set if change_resource_type == ASSET. + customer_asset (google.ads.googleads.v8.resources.types.CustomerAsset): + Output only. Set if change_resource_type == CUSTOMER_ASSET. + campaign_asset (google.ads.googleads.v8.resources.types.CampaignAsset): + Output only. Set if change_resource_type == CAMPAIGN_ASSET. + ad_group_asset (google.ads.googleads.v8.resources.types.AdGroupAsset): + Output only. Set if change_resource_type == AD_GROUP_ASSET. """ ad = proto.Field(proto.MESSAGE, number=1, message=gagr_ad.Ad,) @@ -187,6 +208,16 @@ class ChangedResource(proto.Message): ad_group_ad = proto.Field( proto.MESSAGE, number=12, message=gagr_ad_group_ad.AdGroupAd, ) + asset = proto.Field(proto.MESSAGE, number=13, message=gagr_asset.Asset,) + customer_asset = proto.Field( + proto.MESSAGE, number=14, message=gagr_customer_asset.CustomerAsset, + ) + campaign_asset = proto.Field( + proto.MESSAGE, number=15, message=gagr_campaign_asset.CampaignAsset, + ) + ad_group_asset = proto.Field( + proto.MESSAGE, number=16, message=gagr_ad_group_asset.AdGroupAsset, + ) resource_name = proto.Field(proto.STRING, number=1,) change_date_time = proto.Field(proto.STRING, number=2,) @@ -220,6 +251,7 @@ class ChangedResource(proto.Message): ad_group = proto.Field(proto.STRING, number=12,) feed = proto.Field(proto.STRING, number=13,) feed_item = proto.Field(proto.STRING, number=14,) + asset = proto.Field(proto.STRING, number=20,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/change_status.py b/google/ads/googleads/v8/resources/types/change_status.py index 439b2fbf8..82e5b2ffd 100644 --- a/google/ads/googleads/v8/resources/types/change_status.py +++ b/google/ads/googleads/v8/resources/types/change_status.py @@ -76,6 +76,24 @@ class ChangeStatus(proto.Message): ad_group_bid_modifier (str): Output only. The AdGroupBidModifier affected by this change. + shared_set (str): + Output only. The SharedSet affected by this + change. + campaign_shared_set (str): + Output only. The CampaignSharedSet affected + by this change. + asset (str): + Output only. The Asset affected by this + change. + customer_asset (str): + Output only. The CustomerAsset affected by + this change. + campaign_asset (str): + Output only. The CampaignAsset affected by + this change. + ad_group_asset (str): + Output only. The AdGroupAsset affected by + this change. """ resource_name = proto.Field(proto.STRING, number=1,) @@ -100,6 +118,12 @@ class ChangeStatus(proto.Message): ad_group_feed = proto.Field(proto.STRING, number=30, optional=True,) campaign_feed = proto.Field(proto.STRING, number=31, optional=True,) ad_group_bid_modifier = proto.Field(proto.STRING, number=32, optional=True,) + shared_set = proto.Field(proto.STRING, number=33,) + campaign_shared_set = proto.Field(proto.STRING, number=34,) + asset = proto.Field(proto.STRING, number=35,) + customer_asset = proto.Field(proto.STRING, number=36,) + campaign_asset = proto.Field(proto.STRING, number=37,) + ad_group_asset = proto.Field(proto.STRING, number=38,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/conversion_value_rule.py b/google/ads/googleads/v8/resources/types/conversion_value_rule.py new file mode 100644 index 000000000..e3fe2b7a6 --- /dev/null +++ b/google/ads/googleads/v8/resources/types/conversion_value_rule.py @@ -0,0 +1,157 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import conversion_value_rule_status +from google.ads.googleads.v8.enums.types import value_rule_device_type +from google.ads.googleads.v8.enums.types import ( + value_rule_geo_location_match_type, +) +from google.ads.googleads.v8.enums.types import value_rule_operation + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.resources", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRule",}, +) + + +class ConversionValueRule(proto.Message): + r"""A conversion value rule + Attributes: + resource_name (str): + Immutable. The resource name of the conversion value rule. + Conversion value rule resource names have the form: + + ``customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}`` + id (int): + Output only. The ID of the conversion value + rule. + action (google.ads.googleads.v8.resources.types.ConversionValueRule.ValueRuleAction): + Action applied when the rule is triggered. + geo_location_condition (google.ads.googleads.v8.resources.types.ConversionValueRule.ValueRuleGeoLocationCondition): + Condition for Geo location that must be + satisfied for the value rule to apply. + device_condition (google.ads.googleads.v8.resources.types.ConversionValueRule.ValueRuleDeviceCondition): + Condition for device type that must be + satisfied for the value rule to apply. + audience_condition (google.ads.googleads.v8.resources.types.ConversionValueRule.ValueRuleAudienceCondition): + Condition for audience that must be satisfied + for the value rule to apply. + owner_customer (str): + Output only. The resource name of the conversion value + rule's owner customer. When the value rule is inherited from + a manager customer, owner_customer will be the resource name + of the manager whereas the customer in the resource_name + will be of the requesting serving customer. \*\* Read-only + \*\* + status (google.ads.googleads.v8.enums.types.ConversionValueRuleStatusEnum.ConversionValueRuleStatus): + The status of the conversion value rule. + """ + + class ValueRuleAction(proto.Message): + r"""Action applied when rule is applied. + Attributes: + operation (google.ads.googleads.v8.enums.types.ValueRuleOperationEnum.ValueRuleOperation): + Specifies applied operation. + value (float): + Specifies applied value. + """ + + operation = proto.Field( + proto.ENUM, + number=1, + enum=value_rule_operation.ValueRuleOperationEnum.ValueRuleOperation, + ) + value = proto.Field(proto.DOUBLE, number=2,) + + class ValueRuleGeoLocationCondition(proto.Message): + r"""Condition on Geo dimension. + Attributes: + excluded_geo_target_constants (Sequence[str]): + Geo locations that advertisers want to + exclude. + excluded_geo_match_type (google.ads.googleads.v8.enums.types.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType): + Excluded Geo location match type. + geo_target_constants (Sequence[str]): + Geo locations that advertisers want to + include. + geo_match_type (google.ads.googleads.v8.enums.types.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType): + Included Geo location match type. + """ + + excluded_geo_target_constants = proto.RepeatedField( + proto.STRING, number=1, + ) + excluded_geo_match_type = proto.Field( + proto.ENUM, + number=2, + enum=value_rule_geo_location_match_type.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType, + ) + geo_target_constants = proto.RepeatedField(proto.STRING, number=3,) + geo_match_type = proto.Field( + proto.ENUM, + number=4, + enum=value_rule_geo_location_match_type.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType, + ) + + class ValueRuleAudienceCondition(proto.Message): + r"""Condition on Audience dimension. + Attributes: + user_lists (Sequence[str]): + User Lists. + user_interests (Sequence[str]): + User Interests. + """ + + user_lists = proto.RepeatedField(proto.STRING, number=1,) + user_interests = proto.RepeatedField(proto.STRING, number=2,) + + class ValueRuleDeviceCondition(proto.Message): + r"""Condition on Device dimension. + Attributes: + device_types (Sequence[google.ads.googleads.v8.enums.types.ValueRuleDeviceTypeEnum.ValueRuleDeviceType]): + Value for device type condition. + """ + + device_types = proto.RepeatedField( + proto.ENUM, + number=1, + enum=value_rule_device_type.ValueRuleDeviceTypeEnum.ValueRuleDeviceType, + ) + + resource_name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.INT64, number=2,) + action = proto.Field(proto.MESSAGE, number=3, message=ValueRuleAction,) + geo_location_condition = proto.Field( + proto.MESSAGE, number=4, message=ValueRuleGeoLocationCondition, + ) + device_condition = proto.Field( + proto.MESSAGE, number=5, message=ValueRuleDeviceCondition, + ) + audience_condition = proto.Field( + proto.MESSAGE, number=6, message=ValueRuleAudienceCondition, + ) + owner_customer = proto.Field(proto.STRING, number=7,) + status = proto.Field( + proto.ENUM, + number=8, + enum=conversion_value_rule_status.ConversionValueRuleStatusEnum.ConversionValueRuleStatus, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/conversion_value_rule_set.py b/google/ads/googleads/v8/resources/types/conversion_value_rule_set.py new file mode 100644 index 000000000..67ceb8ec9 --- /dev/null +++ b/google/ads/googleads/v8/resources/types/conversion_value_rule_set.py @@ -0,0 +1,94 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import conversion_value_rule_set_status +from google.ads.googleads.v8.enums.types import value_rule_set_attachment_type +from google.ads.googleads.v8.enums.types import value_rule_set_dimension + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.resources", + marshal="google.ads.googleads.v8", + manifest={"ConversionValueRuleSet",}, +) + + +class ConversionValueRuleSet(proto.Message): + r"""A conversion value rule set + Attributes: + resource_name (str): + Immutable. The resource name of the conversion value rule + set. Conversion value rule set resource names have the form: + + ``customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}`` + id (int): + Output only. The ID of the conversion value + rule set. + conversion_value_rules (Sequence[str]): + Resource names of rules within the rule set. + dimensions (Sequence[google.ads.googleads.v8.enums.types.ValueRuleSetDimensionEnum.ValueRuleSetDimension]): + Defines dimensions for Value Rule conditions. + The condition types of value rules within this + value rule set must be of these dimensions. The + first entry in this list is the primary + dimension of the included value rules. When + using value rule primary dimension segmentation, + conversion values will be segmented into the + values adjusted by value rules and the original + values, if some value rules apply. + owner_customer (str): + Output only. The resource name of the conversion value rule + set's owner customer. When the value rule set is inherited + from a manager customer, owner_customer will be the resource + name of the manager whereas the customer in the + resource_name will be of the requesting serving customer. + \*\* Read-only \*\* + attachment_type (google.ads.googleads.v8.enums.types.ValueRuleSetAttachmentTypeEnum.ValueRuleSetAttachmentType): + Defines the scope where the conversion value + rule set is attached. + campaign (str): + The resource name of the campaign when the + conversion value rule set is attached to a + campaign. + status (google.ads.googleads.v8.enums.types.ConversionValueRuleSetStatusEnum.ConversionValueRuleSetStatus): + Output only. The status of the conversion value rule set. + \*\* Read-only \*\* + """ + + resource_name = proto.Field(proto.STRING, number=1,) + id = proto.Field(proto.INT64, number=2,) + conversion_value_rules = proto.RepeatedField(proto.STRING, number=3,) + dimensions = proto.RepeatedField( + proto.ENUM, + number=4, + enum=value_rule_set_dimension.ValueRuleSetDimensionEnum.ValueRuleSetDimension, + ) + owner_customer = proto.Field(proto.STRING, number=5,) + attachment_type = proto.Field( + proto.ENUM, + number=6, + enum=value_rule_set_attachment_type.ValueRuleSetAttachmentTypeEnum.ValueRuleSetAttachmentType, + ) + campaign = proto.Field(proto.STRING, number=7,) + status = proto.Field( + proto.ENUM, + number=8, + enum=conversion_value_rule_set_status.ConversionValueRuleSetStatusEnum.ConversionValueRuleSetStatus, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/resources/types/google_ads_field.py b/google/ads/googleads/v8/resources/types/google_ads_field.py index fd6d4bb06..58a725e3b 100644 --- a/google/ads/googleads/v8/resources/types/google_ads_field.py +++ b/google/ads/googleads/v8/resources/types/google_ads_field.py @@ -60,28 +60,18 @@ class GoogleAdsField(proto.Message): This field is only set for artifacts whose category is RESOURCE. metrics (Sequence[str]): - Output only. At and beyond version V1 this - field lists the names of all metrics that are - selectable with the described artifact when it - is used in the FROM clause. It is only set for - artifacts whose category is RESOURCE. - Before version V1 this field lists the names of + Output only. This field lists the names of all metrics that are selectable with the - described artifact. It is only set for artifacts - whose category is either RESOURCE or SEGMENT - segments (Sequence[str]): - Output only. At and beyond version V1 this - field lists the names of all artifacts, whether - a segment or another resource, that segment - metrics when included in search queries and when - the described artifact is used in the FROM + described artifact when it is used in the FROM clause. It is only set for artifacts whose category is RESOURCE. - Before version V1 this field lists the names of + segments (Sequence[str]): + Output only. This field lists the names of all artifacts, whether a segment or another resource, that segment metrics when included in - search queries. It is only set for artifacts of - category RESOURCE, SEGMENT or METRIC. + search queries and when the described artifact + is used in the FROM clause. It is only set for + artifacts whose category is RESOURCE. enum_values (Sequence[str]): Output only. Values the artifact can assume if it is a field of type ENUM. diff --git a/google/ads/googleads/v8/resources/types/recommendation.py b/google/ads/googleads/v8/resources/types/recommendation.py index 308e36ebd..dd403284b 100644 --- a/google/ads/googleads/v8/resources/types/recommendation.py +++ b/google/ads/googleads/v8/resources/types/recommendation.py @@ -247,23 +247,28 @@ class KeywordRecommendation(proto.Message): proto.INT64, number=3, optional=True, ) - class MoveUnusedBudgetRecommendation(proto.Message): - r"""The move unused budget recommendation. + class MaximizeConversionsOptInRecommendation(proto.Message): + r"""The Maximize Conversions Opt-In recommendation. Attributes: - excess_campaign_budget (str): - Output only. The excess budget's resource_name. - budget_recommendation (google.ads.googleads.v8.resources.types.Recommendation.CampaignBudgetRecommendation): - Output only. The recommendation for the - constrained budget to increase. + recommended_budget_amount_micros (int): + Output only. The recommended new budget + amount. """ - excess_campaign_budget = proto.Field( - proto.STRING, number=3, optional=True, + recommended_budget_amount_micros = proto.Field( + proto.INT64, number=2, optional=True, ) - budget_recommendation = proto.Field( - proto.MESSAGE, - number=2, - message="Recommendation.CampaignBudgetRecommendation", + + class CalloutExtensionRecommendation(proto.Message): + r"""The Callout extension recommendation. + Attributes: + recommended_extensions (Sequence[google.ads.googleads.v8.common.types.CalloutFeedItem]): + Output only. Callout extensions recommended + to be added. + """ + + recommended_extensions = proto.RepeatedField( + proto.MESSAGE, number=1, message=extensions.CalloutFeedItem, ) class TextAdRecommendation(proto.Message): @@ -284,6 +289,25 @@ class TextAdRecommendation(proto.Message): creation_date = proto.Field(proto.STRING, number=4, optional=True,) auto_apply_date = proto.Field(proto.STRING, number=5, optional=True,) + class MoveUnusedBudgetRecommendation(proto.Message): + r"""The move unused budget recommendation. + Attributes: + excess_campaign_budget (str): + Output only. The excess budget's resource_name. + budget_recommendation (google.ads.googleads.v8.resources.types.Recommendation.CampaignBudgetRecommendation): + Output only. The recommendation for the + constrained budget to increase. + """ + + excess_campaign_budget = proto.Field( + proto.STRING, number=3, optional=True, + ) + budget_recommendation = proto.Field( + proto.MESSAGE, + number=2, + message="Recommendation.CampaignBudgetRecommendation", + ) + class TargetCpaOptInRecommendation(proto.Message): r"""The Target CPA opt-in recommendation. Attributes: @@ -341,8 +365,42 @@ class TargetCpaOptInRecommendationOption(proto.Message): proto.INT64, number=3, optional=True, ) - class OptimizeAdRotationRecommendation(proto.Message): - r"""The Optimize Ad Rotation recommendation. """ + class KeywordMatchTypeRecommendation(proto.Message): + r"""The keyword match type recommendation. + Attributes: + keyword (google.ads.googleads.v8.common.types.KeywordInfo): + Output only. The existing keyword where the + match type should be more broad. + recommended_match_type (google.ads.googleads.v8.enums.types.KeywordMatchTypeEnum.KeywordMatchType): + Output only. The recommended new match type. + """ + + keyword = proto.Field( + proto.MESSAGE, number=1, message=criteria.KeywordInfo, + ) + recommended_match_type = proto.Field( + proto.ENUM, + number=2, + enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, + ) + + class EnhancedCpcOptInRecommendation(proto.Message): + r"""The Enhanced Cost-Per-Click Opt-In recommendation. """ + + class SearchPartnersOptInRecommendation(proto.Message): + r"""The Search Partners Opt-In recommendation. """ + + class CallExtensionRecommendation(proto.Message): + r"""The Call extension recommendation. + Attributes: + recommended_extensions (Sequence[google.ads.googleads.v8.common.types.CallFeedItem]): + Output only. Call extensions recommended to + be added. + """ + + recommended_extensions = proto.RepeatedField( + proto.MESSAGE, number=1, message=extensions.CallFeedItem, + ) class TargetRoasOptInRecommendation(proto.Message): r"""The Target ROAS opt-in recommendation. @@ -366,24 +424,6 @@ class TargetRoasOptInRecommendation(proto.Message): proto.INT64, number=2, optional=True, ) - class MaximizeConversionsOptInRecommendation(proto.Message): - r"""The Maximize Conversions Opt-In recommendation. - Attributes: - recommended_budget_amount_micros (int): - Output only. The recommended new budget - amount. - """ - - recommended_budget_amount_micros = proto.Field( - proto.INT64, number=2, optional=True, - ) - - class EnhancedCpcOptInRecommendation(proto.Message): - r"""The Enhanced Cost-Per-Click Opt-In recommendation. """ - - class SearchPartnersOptInRecommendation(proto.Message): - r"""The Search Partners Opt-In recommendation. """ - class ResponsiveSearchAdRecommendation(proto.Message): r"""The add responsive search ad recommendation. Attributes: @@ -406,17 +446,8 @@ class MaximizeClicksOptInRecommendation(proto.Message): proto.INT64, number=2, optional=True, ) - class CalloutExtensionRecommendation(proto.Message): - r"""The Callout extension recommendation. - Attributes: - recommended_extensions (Sequence[google.ads.googleads.v8.common.types.CalloutFeedItem]): - Output only. Callout extensions recommended - to be added. - """ - - recommended_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CalloutFeedItem, - ) + class OptimizeAdRotationRecommendation(proto.Message): + r"""The Optimize Ad Rotation recommendation. """ class SitelinkExtensionRecommendation(proto.Message): r"""The Sitelink extension recommendation. @@ -430,37 +461,6 @@ class SitelinkExtensionRecommendation(proto.Message): proto.MESSAGE, number=1, message=extensions.SitelinkFeedItem, ) - class CallExtensionRecommendation(proto.Message): - r"""The Call extension recommendation. - Attributes: - recommended_extensions (Sequence[google.ads.googleads.v8.common.types.CallFeedItem]): - Output only. Call extensions recommended to - be added. - """ - - recommended_extensions = proto.RepeatedField( - proto.MESSAGE, number=1, message=extensions.CallFeedItem, - ) - - class KeywordMatchTypeRecommendation(proto.Message): - r"""The keyword match type recommendation. - Attributes: - keyword (google.ads.googleads.v8.common.types.KeywordInfo): - Output only. The existing keyword where the - match type should be more broad. - recommended_match_type (google.ads.googleads.v8.enums.types.KeywordMatchTypeEnum.KeywordMatchType): - Output only. The recommended new match type. - """ - - keyword = proto.Field( - proto.MESSAGE, number=1, message=criteria.KeywordInfo, - ) - recommended_match_type = proto.Field( - proto.ENUM, - number=2, - enum=keyword_match_type.KeywordMatchTypeEnum.KeywordMatchType, - ) - resource_name = proto.Field(proto.STRING, number=1,) type_ = proto.Field( proto.ENUM, diff --git a/google/ads/googleads/v8/services/services/batch_job_service/client.py b/google/ads/googleads/v8/services/services/batch_job_service/client.py index 1e72d9446..69be06214 100644 --- a/google/ads/googleads/v8/services/services/batch_job_service/client.py +++ b/google/ads/googleads/v8/services/services/batch_job_service/client.py @@ -441,6 +441,42 @@ def parse_batch_job_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def bidding_data_exclusion_path( + customer_id: str, seasonality_event_id: str, + ) -> str: + """Return a fully-qualified bidding_data_exclusion string.""" + return "customers/{customer_id}/biddingDataExclusions/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, + ) + + @staticmethod + def parse_bidding_data_exclusion_path(path: str) -> Dict[str, str]: + """Parse a bidding_data_exclusion path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/biddingDataExclusions/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def bidding_seasonality_adjustment_path( + customer_id: str, seasonality_event_id: str, + ) -> str: + """Return a fully-qualified bidding_seasonality_adjustment string.""" + return "customers/{customer_id}/biddingSeasonalityAdjustments/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, + ) + + @staticmethod + def parse_bidding_seasonality_adjustment_path(path: str) -> Dict[str, str]: + """Parse a bidding_seasonality_adjustment path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/biddingSeasonalityAdjustments/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def bidding_strategy_path( customer_id: str, bidding_strategy_id: str, @@ -704,6 +740,44 @@ def parse_conversion_custom_variable_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def conversion_value_rule_path( + customer_id: str, conversion_value_rule_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule string.""" + return "customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}".format( + customer_id=customer_id, + conversion_value_rule_id=conversion_value_rule_id, + ) + + @staticmethod + def parse_conversion_value_rule_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/conversionValueRules/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def conversion_value_rule_set_path( + customer_id: str, conversion_value_rule_set_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule_set string.""" + return "customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}".format( + customer_id=customer_id, + conversion_value_rule_set_id=conversion_value_rule_set_id, + ) + + @staticmethod + def parse_conversion_value_rule_set_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule_set path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/conversionValueRuleSets/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def customer_path(customer_id: str,) -> str: """Return a fully-qualified customer string.""" @@ -1160,6 +1234,22 @@ def parse_smart_campaign_setting_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def user_interest_path(customer_id: str, user_interest_id: str,) -> str: + """Return a fully-qualified user_interest string.""" + return "customers/{customer_id}/userInterests/{user_interest_id}".format( + customer_id=customer_id, user_interest_id=user_interest_id, + ) + + @staticmethod + def parse_user_interest_path(path: str) -> Dict[str, str]: + """Parse a user_interest path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/userInterests/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def user_list_path(customer_id: str, user_list_id: str,) -> str: """Return a fully-qualified user_list string.""" diff --git a/google/ads/googleads/v6/enums/services/__init__.py b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/__init__.py similarity index 85% rename from google/ads/googleads/v6/enums/services/__init__.py rename to google/ads/googleads/v8/services/services/bidding_data_exclusion_service/__init__.py index 42ffdf2bc..b2c91fc47 100644 --- a/google/ads/googleads/v6/enums/services/__init__.py +++ b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .client import BiddingDataExclusionServiceClient + +__all__ = ("BiddingDataExclusionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/client.py b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/client.py similarity index 79% rename from google/ads/googleads/v6/services/services/campaign_bid_modifier_service/client.py rename to google/ads/googleads/v8/services/services/bidding_data_exclusion_service/client.py index 6aff9430a..b4df0c4a2 100644 --- a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/client.py +++ b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -22,28 +20,29 @@ from typing import Dict, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.ads.googleads.v6.resources.types import campaign_bid_modifier -from google.ads.googleads.v6.services.types import campaign_bid_modifier_service -from google.rpc import status_pb2 as status # type: ignore - +from google.ads.googleads.v8.resources.types import bidding_data_exclusion +from google.ads.googleads.v8.services.types import ( + bidding_data_exclusion_service, +) +from google.rpc import status_pb2 # type: ignore from .transports.base import ( - CampaignBidModifierServiceTransport, + BiddingDataExclusionServiceTransport, DEFAULT_CLIENT_INFO, ) -from .transports.grpc import CampaignBidModifierServiceGrpcTransport +from .transports.grpc import BiddingDataExclusionServiceGrpcTransport -class CampaignBidModifierServiceClientMeta(type): - """Metaclass for the CampaignBidModifierService client. +class BiddingDataExclusionServiceClientMeta(type): + """Metaclass for the BiddingDataExclusionService client. This provides class-level methods for building and retrieving support objects (e.g. transport) without polluting the client instance @@ -52,12 +51,12 @@ class CampaignBidModifierServiceClientMeta(type): _transport_registry = ( OrderedDict() - ) # type: Dict[str, Type[CampaignBidModifierServiceTransport]] - _transport_registry["grpc"] = CampaignBidModifierServiceGrpcTransport + ) # type: Dict[str, Type[BiddingDataExclusionServiceTransport]] + _transport_registry["grpc"] = BiddingDataExclusionServiceGrpcTransport def get_transport_class( cls, label: str = None, - ) -> Type[CampaignBidModifierServiceTransport]: + ) -> Type[BiddingDataExclusionServiceTransport]: """Return an appropriate transport class. Args: @@ -76,10 +75,10 @@ def get_transport_class( return next(iter(cls._transport_registry.values())) -class CampaignBidModifierServiceClient( - metaclass=CampaignBidModifierServiceClientMeta +class BiddingDataExclusionServiceClient( + metaclass=BiddingDataExclusionServiceClientMeta ): - """Service to manage campaign bid modifiers.""" + """Service to manage bidding data exclusions.""" @staticmethod def _get_default_mtls_endpoint(api_endpoint): @@ -125,7 +124,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignBidModifierServiceClient: The constructed client. + BiddingDataExclusionServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_info( info @@ -145,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignBidModifierServiceClient: The constructed client. + BiddingDataExclusionServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file( filename @@ -156,46 +155,44 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @property - def transport(self) -> CampaignBidModifierServiceTransport: + def transport(self) -> BiddingDataExclusionServiceTransport: """Return the transport used by the client instance. Returns: - CampaignBidModifierServiceTransport: The transport used by the client instance. + BiddingDataExclusionServiceTransport: The transport used by the client instance. """ return self._transport @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, + def bidding_data_exclusion_path( + customer_id: str, seasonality_event_id: str, + ) -> str: + """Return a fully-qualified bidding_data_exclusion string.""" + return "customers/{customer_id}/biddingDataExclusions/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, ) @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" + def parse_bidding_data_exclusion_path(path: str) -> Dict[str, str]: + """Parse a bidding_data_exclusion path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", + r"^customers/(?P.+?)/biddingDataExclusions/(?P.+?)$", path, ) return m.groupdict() if m else {} @staticmethod - def campaign_bid_modifier_path( - customer_id: str, campaign_id: str, criterion_id: str, - ) -> str: - """Return a fully-qualified campaign_bid_modifier string.""" - return "customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - criterion_id=criterion_id, + def campaign_path(customer_id: str, campaign_id: str,) -> str: + """Return a fully-qualified campaign string.""" + return "customers/{customer_id}/campaigns/{campaign_id}".format( + customer_id=customer_id, campaign_id=campaign_id, ) @staticmethod - def parse_campaign_bid_modifier_path(path: str) -> Dict[str, str]: - """Parse a campaign_bid_modifier path into its component segments.""" + def parse_campaign_path(path: str) -> Dict[str, str]: + """Parse a campaign path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/campaignBidModifiers/(?P.+?)~(?P.+?)$", + r"^customers/(?P.+?)/campaigns/(?P.+?)$", path, ) return m.groupdict() if m else {} @@ -264,12 +261,14 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignBidModifierServiceTransport, None] = None, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[ + str, BiddingDataExclusionServiceTransport, None + ] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the campaign bid modifier service client. + """Instantiate the bidding data exclusion service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -277,7 +276,7 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.CampaignBidModifierServiceTransport]): The + transport (Union[str, ~.BiddingDataExclusionServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. client_options (google.api_core.client_options.ClientOptions): Custom options for the @@ -357,8 +356,8 @@ def __init__( # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignBidModifierServiceTransport): - # transport is a CampaignBidModifierServiceTransport instance. + if isinstance(transport, BiddingDataExclusionServiceTransport): + # transport is a BiddingDataExclusionServiceTransport instance. if credentials: raise ValueError( "When providing a transport instance, " @@ -371,37 +370,35 @@ def __init__( credentials=credentials, host=self.DEFAULT_ENDPOINT ) else: - self._transport = CampaignBidModifierServiceGrpcTransport( + self._transport = BiddingDataExclusionServiceGrpcTransport( credentials=credentials, host=api_endpoint, ssl_channel_credentials=ssl_credentials, client_info=client_info, ) - def get_campaign_bid_modifier( + def get_bidding_data_exclusion( self, - request: campaign_bid_modifier_service.GetCampaignBidModifierRequest = None, + request: bidding_data_exclusion_service.GetBiddingDataExclusionRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_bid_modifier.CampaignBidModifier: - r"""Returns the requested campaign bid modifier in full - detail. + ) -> bidding_data_exclusion.BiddingDataExclusion: + r"""Returns the requested data exclusion in full detail. Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignBidModifierRequest`): + request (:class:`google.ads.googleads.v8.services.types.GetBiddingDataExclusionRequest`): The request object. Request message for - [CampaignBidModifierService.GetCampaignBidModifier][google.ads.googleads.v6.services.CampaignBidModifierService.GetCampaignBidModifier]. + [BiddingDataExclusionService.GetBiddingDataExclusion][google.ads.googleads.v8.services.BiddingDataExclusionService.GetBiddingDataExclusion]. resource_name (:class:`str`): Required. The resource name of the - campaign bid modifier to fetch. + data exclusion to fetch. This corresponds to the ``resource_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -409,9 +406,11 @@ def get_campaign_bid_modifier( sent along with the request as metadata. Returns: - google.ads.googleads.v6.resources.types.CampaignBidModifier: - Represents a bid-modifiable only - criterion at the campaign level. + google.ads.googleads.v8.resources.types.BiddingDataExclusion: + Represents a bidding data exclusion. + See "About data exclusions" at + https://support.google.com/google- + ads/answer/10370710. """ # Create or coerce a protobuf request object. @@ -424,26 +423,25 @@ def get_campaign_bid_modifier( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_bid_modifier_service.GetCampaignBidModifierRequest. + # in a bidding_data_exclusion_service.GetBiddingDataExclusionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, campaign_bid_modifier_service.GetCampaignBidModifierRequest + request, + bidding_data_exclusion_service.GetBiddingDataExclusionRequest, ): - request = campaign_bid_modifier_service.GetCampaignBidModifierRequest( + request = bidding_data_exclusion_service.GetBiddingDataExclusionRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if resource_name is not None: request.resource_name = resource_name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_bid_modifier + self._transport.get_bidding_data_exclusion ] # Certain fields should be provided within the metadata header; @@ -462,42 +460,39 @@ def get_campaign_bid_modifier( # Done; return the response. return response - def mutate_campaign_bid_modifiers( + def mutate_bidding_data_exclusions( self, - request: campaign_bid_modifier_service.MutateCampaignBidModifiersRequest = None, + request: bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest = None, *, customer_id: str = None, operations: Sequence[ - campaign_bid_modifier_service.CampaignBidModifierOperation + bidding_data_exclusion_service.BiddingDataExclusionOperation ] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_bid_modifier_service.MutateCampaignBidModifiersResponse: - r"""Creates, updates, or removes campaign bid modifiers. + ) -> bidding_data_exclusion_service.MutateBiddingDataExclusionsResponse: + r"""Creates, updates, or removes data exclusions. Operation statuses are returned. Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignBidModifiersRequest`): + request (:class:`google.ads.googleads.v8.services.types.MutateBiddingDataExclusionsRequest`): The request object. Request message for - [CampaignBidModifierService.MutateCampaignBidModifiers][google.ads.googleads.v6.services.CampaignBidModifierService.MutateCampaignBidModifiers]. + [BiddingDataExclusionService.MutateBiddingDataExclusions][google.ads.googleads.v8.services.BiddingDataExclusionService.MutateBiddingDataExclusions]. customer_id (:class:`str`): Required. ID of the customer whose - campaign bid modifiers are being - modified. + data exclusions are being modified. This corresponds to the ``customer_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignBidModifierOperation]`): + operations (:class:`Sequence[google.ads.googleads.v8.services.types.BiddingDataExclusionOperation]`): Required. The list of operations to - perform on individual campaign bid - modifiers. + perform on individual data exclusions. This corresponds to the ``operations`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -505,9 +500,9 @@ def mutate_campaign_bid_modifiers( sent along with the request as metadata. Returns: - google.ads.googleads.v6.services.types.MutateCampaignBidModifiersResponse: - Response message for campaign bid - modifiers mutate. + google.ads.googleads.v8.services.types.MutateBiddingDataExclusionsResponse: + Response message for data exlusions + mutate. """ # Create or coerce a protobuf request object. @@ -520,20 +515,18 @@ def mutate_campaign_bid_modifiers( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_bid_modifier_service.MutateCampaignBidModifiersRequest. + # in a bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( request, - campaign_bid_modifier_service.MutateCampaignBidModifiersRequest, + bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest, ): - request = campaign_bid_modifier_service.MutateCampaignBidModifiersRequest( + request = bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if customer_id is not None: request.customer_id = customer_id if operations is not None: @@ -542,7 +535,7 @@ def mutate_campaign_bid_modifiers( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_bid_modifiers + self._transport.mutate_bidding_data_exclusions ] # Certain fields should be provided within the metadata header; @@ -562,4 +555,4 @@ def mutate_campaign_bid_modifiers( return response -__all__ = ("CampaignBidModifierServiceClient",) +__all__ = ("BiddingDataExclusionServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/__init__.py b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/__init__.py similarity index 69% rename from google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/__init__.py rename to google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/__init__.py index 31b45778f..9e37b8d88 100644 --- a/google/ads/googleads/v6/services/services/campaign_audience_view_service/transports/__init__.py +++ b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type -from .base import CampaignAudienceViewServiceTransport -from .grpc import CampaignAudienceViewServiceGrpcTransport +from .base import BiddingDataExclusionServiceTransport +from .grpc import BiddingDataExclusionServiceGrpcTransport # Compile a registry of transports. _transport_registry = ( OrderedDict() -) # type: Dict[str, Type[CampaignAudienceViewServiceTransport]] -_transport_registry["grpc"] = CampaignAudienceViewServiceGrpcTransport +) # type: Dict[str, Type[BiddingDataExclusionServiceTransport]] +_transport_registry["grpc"] = BiddingDataExclusionServiceGrpcTransport __all__ = ( - "CampaignAudienceViewServiceTransport", - "CampaignAudienceViewServiceGrpcTransport", + "BiddingDataExclusionServiceTransport", + "BiddingDataExclusionServiceGrpcTransport", ) diff --git a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/base.py b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/base.py similarity index 70% rename from google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/base.py rename to google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/base.py index 58831df39..769023f14 100644 --- a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/base.py +++ b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc import typing import pkg_resources -from google import auth +import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore -from google.ads.googleads.v6.resources.types import account_budget_proposal -from google.ads.googleads.v6.services.types import ( - account_budget_proposal_service, +from google.ads.googleads.v8.resources.types import bidding_data_exclusion +from google.ads.googleads.v8.services.types import ( + bidding_data_exclusion_service, ) - try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-ads",).version, @@ -38,8 +35,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -class AccountBudgetProposalServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AccountBudgetProposalService.""" +class BiddingDataExclusionServiceTransport(metaclass=abc.ABCMeta): + """Abstract transport class for BiddingDataExclusionService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) @@ -47,13 +44,14 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -73,7 +71,7 @@ def __init__( # If no credentials are provided, then determine the appropriate # defaults. if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # Save the credentials. self._credentials = credentials @@ -84,35 +82,35 @@ def __init__( def _prep_wrapped_messages(self, client_info): # Precomputed wrapped methods self._wrapped_methods = { - self.get_account_budget_proposal: gapic_v1.method.wrap_method( - self.get_account_budget_proposal, + self.get_bidding_data_exclusion: gapic_v1.method.wrap_method( + self.get_bidding_data_exclusion, default_timeout=None, client_info=client_info, ), - self.mutate_account_budget_proposal: gapic_v1.method.wrap_method( - self.mutate_account_budget_proposal, + self.mutate_bidding_data_exclusions: gapic_v1.method.wrap_method( + self.mutate_bidding_data_exclusions, default_timeout=None, client_info=client_info, ), } @property - def get_account_budget_proposal( + def get_bidding_data_exclusion( self, ) -> typing.Callable[ - [account_budget_proposal_service.GetAccountBudgetProposalRequest], - account_budget_proposal.AccountBudgetProposal, + [bidding_data_exclusion_service.GetBiddingDataExclusionRequest], + bidding_data_exclusion.BiddingDataExclusion, ]: raise NotImplementedError @property - def mutate_account_budget_proposal( + def mutate_bidding_data_exclusions( self, ) -> typing.Callable[ - [account_budget_proposal_service.MutateAccountBudgetProposalRequest], - account_budget_proposal_service.MutateAccountBudgetProposalResponse, + [bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest], + bidding_data_exclusion_service.MutateBiddingDataExclusionsResponse, ]: raise NotImplementedError -__all__ = ("AccountBudgetProposalServiceTransport",) +__all__ = ("BiddingDataExclusionServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/grpc.py b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/grpc.py similarity index 76% rename from google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/grpc.py rename to google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/grpc.py index adb954dea..b35d47b64 100644 --- a/google/ads/googleads/v6/services/services/ad_group_bid_modifier_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/bidding_data_exclusion_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,30 +13,30 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore -from google.ads.googleads.v6.resources.types import ad_group_bid_modifier -from google.ads.googleads.v6.services.types import ad_group_bid_modifier_service - -from .base import AdGroupBidModifierServiceTransport, DEFAULT_CLIENT_INFO +from google.ads.googleads.v8.resources.types import bidding_data_exclusion +from google.ads.googleads.v8.services.types import ( + bidding_data_exclusion_service, +) +from .base import BiddingDataExclusionServiceTransport, DEFAULT_CLIENT_INFO -class AdGroupBidModifierServiceGrpcTransport( - AdGroupBidModifierServiceTransport +class BiddingDataExclusionServiceGrpcTransport( + BiddingDataExclusionServiceTransport ): - """gRPC backend transport for AdGroupBidModifierService. + """gRPC backend transport for BiddingDataExclusionService. - Service to manage ad group bid modifiers. + Service to manage bidding data exclusions. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -51,7 +50,7 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -64,7 +63,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -123,7 +123,7 @@ def __init__( ) if credentials is None: - credentials, _ = auth.default( + credentials, _ = google.auth.default( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) @@ -155,7 +155,7 @@ def __init__( host = host if ":" in host else host + ":443" if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( @@ -180,7 +180,7 @@ def __init__( def create_channel( cls, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: @@ -214,20 +214,19 @@ def grpc_channel(self) -> grpc.Channel: return self._grpc_channel @property - def get_ad_group_bid_modifier( + def get_bidding_data_exclusion( self, ) -> Callable[ - [ad_group_bid_modifier_service.GetAdGroupBidModifierRequest], - ad_group_bid_modifier.AdGroupBidModifier, + [bidding_data_exclusion_service.GetBiddingDataExclusionRequest], + bidding_data_exclusion.BiddingDataExclusion, ]: - r"""Return a callable for the get ad group bid modifier method over gRPC. + r"""Return a callable for the get bidding data exclusion method over gRPC. - Returns the requested ad group bid modifier in full - detail. + Returns the requested data exclusion in full detail. Returns: - Callable[[~.GetAdGroupBidModifierRequest], - ~.AdGroupBidModifier]: + Callable[[~.GetBiddingDataExclusionRequest], + ~.BiddingDataExclusion]: A function that, when called, will call the underlying RPC on the server. """ @@ -235,31 +234,31 @@ def get_ad_group_bid_modifier( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "get_ad_group_bid_modifier" not in self._stubs: + if "get_bidding_data_exclusion" not in self._stubs: self._stubs[ - "get_ad_group_bid_modifier" + "get_bidding_data_exclusion" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupBidModifierService/GetAdGroupBidModifier", - request_serializer=ad_group_bid_modifier_service.GetAdGroupBidModifierRequest.serialize, - response_deserializer=ad_group_bid_modifier.AdGroupBidModifier.deserialize, + "/google.ads.googleads.v8.services.BiddingDataExclusionService/GetBiddingDataExclusion", + request_serializer=bidding_data_exclusion_service.GetBiddingDataExclusionRequest.serialize, + response_deserializer=bidding_data_exclusion.BiddingDataExclusion.deserialize, ) - return self._stubs["get_ad_group_bid_modifier"] + return self._stubs["get_bidding_data_exclusion"] @property - def mutate_ad_group_bid_modifiers( + def mutate_bidding_data_exclusions( self, ) -> Callable[ - [ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest], - ad_group_bid_modifier_service.MutateAdGroupBidModifiersResponse, + [bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest], + bidding_data_exclusion_service.MutateBiddingDataExclusionsResponse, ]: - r"""Return a callable for the mutate ad group bid modifiers method over gRPC. + r"""Return a callable for the mutate bidding data exclusions method over gRPC. - Creates, updates, or removes ad group bid modifiers. + Creates, updates, or removes data exclusions. Operation statuses are returned. Returns: - Callable[[~.MutateAdGroupBidModifiersRequest], - ~.MutateAdGroupBidModifiersResponse]: + Callable[[~.MutateBiddingDataExclusionsRequest], + ~.MutateBiddingDataExclusionsResponse]: A function that, when called, will call the underlying RPC on the server. """ @@ -267,15 +266,15 @@ def mutate_ad_group_bid_modifiers( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "mutate_ad_group_bid_modifiers" not in self._stubs: + if "mutate_bidding_data_exclusions" not in self._stubs: self._stubs[ - "mutate_ad_group_bid_modifiers" + "mutate_bidding_data_exclusions" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupBidModifierService/MutateAdGroupBidModifiers", - request_serializer=ad_group_bid_modifier_service.MutateAdGroupBidModifiersRequest.serialize, - response_deserializer=ad_group_bid_modifier_service.MutateAdGroupBidModifiersResponse.deserialize, + "/google.ads.googleads.v8.services.BiddingDataExclusionService/MutateBiddingDataExclusions", + request_serializer=bidding_data_exclusion_service.MutateBiddingDataExclusionsRequest.serialize, + response_deserializer=bidding_data_exclusion_service.MutateBiddingDataExclusionsResponse.deserialize, ) - return self._stubs["mutate_ad_group_bid_modifiers"] + return self._stubs["mutate_bidding_data_exclusions"] -__all__ = ("AdGroupBidModifierServiceGrpcTransport",) +__all__ = ("BiddingDataExclusionServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/common/services/__init__.py b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/__init__.py similarity index 83% rename from google/ads/googleads/v6/common/services/__init__.py rename to google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/__init__.py index 42ffdf2bc..a75795e4b 100644 --- a/google/ads/googleads/v6/common/services/__init__.py +++ b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .client import BiddingSeasonalityAdjustmentServiceClient + +__all__ = ("BiddingSeasonalityAdjustmentServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_shared_set_service/client.py b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/client.py similarity index 76% rename from google/ads/googleads/v6/services/services/campaign_shared_set_service/client.py rename to google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/client.py index 737bc7192..a9dd3e098 100644 --- a/google/ads/googleads/v6/services/services/campaign_shared_set_service/client.py +++ b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -22,28 +20,31 @@ from typing import Dict, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.ads.googleads.v6.resources.types import campaign_shared_set -from google.ads.googleads.v6.services.types import campaign_shared_set_service -from google.rpc import status_pb2 as status # type: ignore - +from google.ads.googleads.v8.resources.types import ( + bidding_seasonality_adjustment, +) +from google.ads.googleads.v8.services.types import ( + bidding_seasonality_adjustment_service, +) +from google.rpc import status_pb2 # type: ignore from .transports.base import ( - CampaignSharedSetServiceTransport, + BiddingSeasonalityAdjustmentServiceTransport, DEFAULT_CLIENT_INFO, ) -from .transports.grpc import CampaignSharedSetServiceGrpcTransport +from .transports.grpc import BiddingSeasonalityAdjustmentServiceGrpcTransport -class CampaignSharedSetServiceClientMeta(type): - """Metaclass for the CampaignSharedSetService client. +class BiddingSeasonalityAdjustmentServiceClientMeta(type): + """Metaclass for the BiddingSeasonalityAdjustmentService client. This provides class-level methods for building and retrieving support objects (e.g. transport) without polluting the client instance @@ -52,12 +53,14 @@ class CampaignSharedSetServiceClientMeta(type): _transport_registry = ( OrderedDict() - ) # type: Dict[str, Type[CampaignSharedSetServiceTransport]] - _transport_registry["grpc"] = CampaignSharedSetServiceGrpcTransport + ) # type: Dict[str, Type[BiddingSeasonalityAdjustmentServiceTransport]] + _transport_registry[ + "grpc" + ] = BiddingSeasonalityAdjustmentServiceGrpcTransport def get_transport_class( cls, label: str = None, - ) -> Type[CampaignSharedSetServiceTransport]: + ) -> Type[BiddingSeasonalityAdjustmentServiceTransport]: """Return an appropriate transport class. Args: @@ -76,10 +79,10 @@ def get_transport_class( return next(iter(cls._transport_registry.values())) -class CampaignSharedSetServiceClient( - metaclass=CampaignSharedSetServiceClientMeta +class BiddingSeasonalityAdjustmentServiceClient( + metaclass=BiddingSeasonalityAdjustmentServiceClientMeta ): - """Service to manage campaign shared sets.""" + """Service to manage bidding seasonality adjustments.""" @staticmethod def _get_default_mtls_endpoint(api_endpoint): @@ -125,7 +128,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignSharedSetServiceClient: The constructed client. + BiddingSeasonalityAdjustmentServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_info( info @@ -145,7 +148,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignSharedSetServiceClient: The constructed client. + BiddingSeasonalityAdjustmentServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file( filename @@ -156,62 +159,44 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @property - def transport(self) -> CampaignSharedSetServiceTransport: + def transport(self) -> BiddingSeasonalityAdjustmentServiceTransport: """Return the transport used by the client instance. Returns: - CampaignSharedSetServiceTransport: The transport used by the client instance. + BiddingSeasonalityAdjustmentServiceTransport: The transport used by the client instance. """ return self._transport @staticmethod - def campaign_path(customer_id: str, campaign_id: str,) -> str: - """Return a fully-qualified campaign string.""" - return "customers/{customer_id}/campaigns/{campaign_id}".format( - customer_id=customer_id, campaign_id=campaign_id, - ) - - @staticmethod - def parse_campaign_path(path: str) -> Dict[str, str]: - """Parse a campaign path into its component segments.""" - m = re.match( - r"^customers/(?P.+?)/campaigns/(?P.+?)$", - path, - ) - return m.groupdict() if m else {} - - @staticmethod - def campaign_shared_set_path( - customer_id: str, campaign_id: str, shared_set_id: str, + def bidding_seasonality_adjustment_path( + customer_id: str, seasonality_event_id: str, ) -> str: - """Return a fully-qualified campaign_shared_set string.""" - return "customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}".format( - customer_id=customer_id, - campaign_id=campaign_id, - shared_set_id=shared_set_id, + """Return a fully-qualified bidding_seasonality_adjustment string.""" + return "customers/{customer_id}/biddingSeasonalityAdjustments/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, ) @staticmethod - def parse_campaign_shared_set_path(path: str) -> Dict[str, str]: - """Parse a campaign_shared_set path into its component segments.""" + def parse_bidding_seasonality_adjustment_path(path: str) -> Dict[str, str]: + """Parse a bidding_seasonality_adjustment path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/campaignSharedSets/(?P.+?)~(?P.+?)$", + r"^customers/(?P.+?)/biddingSeasonalityAdjustments/(?P.+?)$", path, ) return m.groupdict() if m else {} @staticmethod - def shared_set_path(customer_id: str, shared_set_id: str,) -> str: - """Return a fully-qualified shared_set string.""" - return "customers/{customer_id}/sharedSets/{shared_set_id}".format( - customer_id=customer_id, shared_set_id=shared_set_id, + def campaign_path(customer_id: str, campaign_id: str,) -> str: + """Return a fully-qualified campaign string.""" + return "customers/{customer_id}/campaigns/{campaign_id}".format( + customer_id=customer_id, campaign_id=campaign_id, ) @staticmethod - def parse_shared_set_path(path: str) -> Dict[str, str]: - """Parse a shared_set path into its component segments.""" + def parse_campaign_path(path: str) -> Dict[str, str]: + """Parse a campaign path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/sharedSets/(?P.+?)$", + r"^customers/(?P.+?)/campaigns/(?P.+?)$", path, ) return m.groupdict() if m else {} @@ -280,12 +265,14 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, CampaignSharedSetServiceTransport, None] = None, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[ + str, BiddingSeasonalityAdjustmentServiceTransport, None + ] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the campaign shared set service client. + """Instantiate the bidding seasonality adjustment service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -293,7 +280,7 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.CampaignSharedSetServiceTransport]): The + transport (Union[str, ~.BiddingSeasonalityAdjustmentServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. client_options (google.api_core.client_options.ClientOptions): Custom options for the @@ -373,8 +360,8 @@ def __init__( # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignSharedSetServiceTransport): - # transport is a CampaignSharedSetServiceTransport instance. + if isinstance(transport, BiddingSeasonalityAdjustmentServiceTransport): + # transport is a BiddingSeasonalityAdjustmentServiceTransport instance. if credentials: raise ValueError( "When providing a transport instance, " @@ -387,37 +374,36 @@ def __init__( credentials=credentials, host=self.DEFAULT_ENDPOINT ) else: - self._transport = CampaignSharedSetServiceGrpcTransport( + self._transport = BiddingSeasonalityAdjustmentServiceGrpcTransport( credentials=credentials, host=api_endpoint, ssl_channel_credentials=ssl_credentials, client_info=client_info, ) - def get_campaign_shared_set( + def get_bidding_seasonality_adjustment( self, - request: campaign_shared_set_service.GetCampaignSharedSetRequest = None, + request: bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_shared_set.CampaignSharedSet: - r"""Returns the requested campaign shared set in full + ) -> bidding_seasonality_adjustment.BiddingSeasonalityAdjustment: + r"""Returns the requested seasonality adjustment in full detail. Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignSharedSetRequest`): + request (:class:`google.ads.googleads.v8.services.types.GetBiddingSeasonalityAdjustmentRequest`): The request object. Request message for - [CampaignSharedSetService.GetCampaignSharedSet][google.ads.googleads.v6.services.CampaignSharedSetService.GetCampaignSharedSet]. + [BiddingSeasonalityAdjustmentService.GetBiddingSeasonalityAdjustment][google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService.GetBiddingSeasonalityAdjustment]. resource_name (:class:`str`): Required. The resource name of the - campaign shared set to fetch. + seasonality adjustment to fetch. This corresponds to the ``resource_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -425,10 +411,12 @@ def get_campaign_shared_set( sent along with the request as metadata. Returns: - google.ads.googleads.v6.resources.types.CampaignSharedSet: - CampaignSharedSets are used for - managing the shared sets associated with - a campaign. + google.ads.googleads.v8.resources.types.BiddingSeasonalityAdjustment: + Represents a bidding seasonality + adjustment. + See "About seasonality adjustments" at + https://support.google.com/google- + ads/answer/10369906. """ # Create or coerce a protobuf request object. @@ -441,26 +429,25 @@ def get_campaign_shared_set( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_shared_set_service.GetCampaignSharedSetRequest. + # in a bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, campaign_shared_set_service.GetCampaignSharedSetRequest + request, + bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest, ): - request = campaign_shared_set_service.GetCampaignSharedSetRequest( + request = bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if resource_name is not None: request.resource_name = resource_name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_shared_set + self._transport.get_bidding_seasonality_adjustment ] # Certain fields should be provided within the metadata header; @@ -479,42 +466,41 @@ def get_campaign_shared_set( # Done; return the response. return response - def mutate_campaign_shared_sets( + def mutate_bidding_seasonality_adjustments( self, - request: campaign_shared_set_service.MutateCampaignSharedSetsRequest = None, + request: bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest = None, *, customer_id: str = None, operations: Sequence[ - campaign_shared_set_service.CampaignSharedSetOperation + bidding_seasonality_adjustment_service.BiddingSeasonalityAdjustmentOperation ] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_shared_set_service.MutateCampaignSharedSetsResponse: - r"""Creates or removes campaign shared sets. Operation - statuses are returned. + ) -> bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsResponse: + r"""Creates, updates, or removes seasonality adjustments. + Operation statuses are returned. Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignSharedSetsRequest`): + request (:class:`google.ads.googleads.v8.services.types.MutateBiddingSeasonalityAdjustmentsRequest`): The request object. Request message for - [CampaignSharedSetService.MutateCampaignSharedSets][google.ads.googleads.v6.services.CampaignSharedSetService.MutateCampaignSharedSets]. + [BiddingSeasonalityAdjustmentService.MutateBiddingSeasonalityAdjustments][google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService.MutateBiddingSeasonalityAdjustments]. customer_id (:class:`str`): - Required. The ID of the customer - whose campaign shared sets are being + Required. ID of the customer whose + seasonality adjustments are being modified. This corresponds to the ``customer_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignSharedSetOperation]`): + operations (:class:`Sequence[google.ads.googleads.v8.services.types.BiddingSeasonalityAdjustmentOperation]`): Required. The list of operations to - perform on individual campaign shared - sets. + perform on individual seasonality + adjustments. This corresponds to the ``operations`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -522,9 +508,9 @@ def mutate_campaign_shared_sets( sent along with the request as metadata. Returns: - google.ads.googleads.v6.services.types.MutateCampaignSharedSetsResponse: - Response message for a campaign - shared set mutate. + google.ads.googleads.v8.services.types.MutateBiddingSeasonalityAdjustmentsResponse: + Response message for seasonality + adjustments mutate. """ # Create or coerce a protobuf request object. @@ -537,19 +523,18 @@ def mutate_campaign_shared_sets( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_shared_set_service.MutateCampaignSharedSetsRequest. + # in a bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, campaign_shared_set_service.MutateCampaignSharedSetsRequest + request, + bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest, ): - request = campaign_shared_set_service.MutateCampaignSharedSetsRequest( + request = bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if customer_id is not None: request.customer_id = customer_id if operations is not None: @@ -558,7 +543,7 @@ def mutate_campaign_shared_sets( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_shared_sets + self._transport.mutate_bidding_seasonality_adjustments ] # Certain fields should be provided within the metadata header; @@ -578,4 +563,4 @@ def mutate_campaign_shared_sets( return response -__all__ = ("CampaignSharedSetServiceClient",) +__all__ = ("BiddingSeasonalityAdjustmentServiceClient",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/__init__.py b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/__init__.py similarity index 68% rename from google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/__init__.py rename to google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/__init__.py index 88d7709b7..c2039d816 100644 --- a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/__init__.py +++ b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type -from .base import CustomerUserAccessInvitationServiceTransport -from .grpc import CustomerUserAccessInvitationServiceGrpcTransport +from .base import BiddingSeasonalityAdjustmentServiceTransport +from .grpc import BiddingSeasonalityAdjustmentServiceGrpcTransport # Compile a registry of transports. _transport_registry = ( OrderedDict() -) # type: Dict[str, Type[CustomerUserAccessInvitationServiceTransport]] -_transport_registry["grpc"] = CustomerUserAccessInvitationServiceGrpcTransport +) # type: Dict[str, Type[BiddingSeasonalityAdjustmentServiceTransport]] +_transport_registry["grpc"] = BiddingSeasonalityAdjustmentServiceGrpcTransport __all__ = ( - "CustomerUserAccessInvitationServiceTransport", - "CustomerUserAccessInvitationServiceGrpcTransport", + "BiddingSeasonalityAdjustmentServiceTransport", + "BiddingSeasonalityAdjustmentServiceGrpcTransport", ) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/base.py b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/base.py similarity index 69% rename from google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/base.py rename to google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/base.py index 23c86cb6b..cef585233 100644 --- a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/base.py +++ b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,24 +13,22 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc import typing import pkg_resources -from google import auth +import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore -from google.ads.googleads.v6.resources.types import ( - customer_user_access_invitation, +from google.ads.googleads.v8.resources.types import ( + bidding_seasonality_adjustment, ) -from google.ads.googleads.v6.services.types import ( - customer_user_access_invitation_service, +from google.ads.googleads.v8.services.types import ( + bidding_seasonality_adjustment_service, ) - try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-ads",).version, @@ -40,8 +37,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -class CustomerUserAccessInvitationServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerUserAccessInvitationService.""" +class BiddingSeasonalityAdjustmentServiceTransport(metaclass=abc.ABCMeta): + """Abstract transport class for BiddingSeasonalityAdjustmentService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) @@ -49,13 +46,14 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -75,7 +73,7 @@ def __init__( # If no credentials are provided, then determine the appropriate # defaults. if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # Save the credentials. self._credentials = credentials @@ -86,39 +84,39 @@ def __init__( def _prep_wrapped_messages(self, client_info): # Precomputed wrapped methods self._wrapped_methods = { - self.get_customer_user_access_invitation: gapic_v1.method.wrap_method( - self.get_customer_user_access_invitation, + self.get_bidding_seasonality_adjustment: gapic_v1.method.wrap_method( + self.get_bidding_seasonality_adjustment, default_timeout=None, client_info=client_info, ), - self.mutate_customer_user_access_invitation: gapic_v1.method.wrap_method( - self.mutate_customer_user_access_invitation, + self.mutate_bidding_seasonality_adjustments: gapic_v1.method.wrap_method( + self.mutate_bidding_seasonality_adjustments, default_timeout=None, client_info=client_info, ), } @property - def get_customer_user_access_invitation( + def get_bidding_seasonality_adjustment( self, ) -> typing.Callable[ [ - customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest + bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest ], - customer_user_access_invitation.CustomerUserAccessInvitation, + bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, ]: raise NotImplementedError @property - def mutate_customer_user_access_invitation( + def mutate_bidding_seasonality_adjustments( self, ) -> typing.Callable[ [ - customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest + bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest ], - customer_user_access_invitation_service.MutateCustomerUserAccessInvitationResponse, + bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsResponse, ]: raise NotImplementedError -__all__ = ("CustomerUserAccessInvitationServiceTransport",) +__all__ = ("BiddingSeasonalityAdjustmentServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/grpc.py b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/grpc.py similarity index 74% rename from google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/grpc.py rename to google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/grpc.py index 186ca5240..e9f0f5457 100644 --- a/google/ads/googleads/v6/services/services/customer_user_access_invitation_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/bidding_seasonality_adjustment_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,38 +13,35 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore -from google.ads.googleads.v6.resources.types import ( - customer_user_access_invitation, +from google.ads.googleads.v8.resources.types import ( + bidding_seasonality_adjustment, ) -from google.ads.googleads.v6.services.types import ( - customer_user_access_invitation_service, +from google.ads.googleads.v8.services.types import ( + bidding_seasonality_adjustment_service, ) - from .base import ( - CustomerUserAccessInvitationServiceTransport, + BiddingSeasonalityAdjustmentServiceTransport, DEFAULT_CLIENT_INFO, ) -class CustomerUserAccessInvitationServiceGrpcTransport( - CustomerUserAccessInvitationServiceTransport +class BiddingSeasonalityAdjustmentServiceGrpcTransport( + BiddingSeasonalityAdjustmentServiceTransport ): - """gRPC backend transport for CustomerUserAccessInvitationService. + """gRPC backend transport for BiddingSeasonalityAdjustmentService. - This service manages the access invitation extended to users - for a given customer. + Service to manage bidding seasonality adjustments. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -59,7 +55,7 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -72,7 +68,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -131,7 +128,7 @@ def __init__( ) if credentials is None: - credentials, _ = auth.default( + credentials, _ = google.auth.default( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) @@ -163,7 +160,7 @@ def __init__( host = host if ":" in host else host + ":443" if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( @@ -188,7 +185,7 @@ def __init__( def create_channel( cls, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: @@ -222,23 +219,23 @@ def grpc_channel(self) -> grpc.Channel: return self._grpc_channel @property - def get_customer_user_access_invitation( + def get_bidding_seasonality_adjustment( self, ) -> Callable[ [ - customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest + bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest ], - customer_user_access_invitation.CustomerUserAccessInvitation, + bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, ]: - r"""Return a callable for the get customer user access - invitation method over gRPC. + r"""Return a callable for the get bidding seasonality + adjustment method over gRPC. - Returns the requested access invitation in full + Returns the requested seasonality adjustment in full detail. Returns: - Callable[[~.GetCustomerUserAccessInvitationRequest], - ~.CustomerUserAccessInvitation]: + Callable[[~.GetBiddingSeasonalityAdjustmentRequest], + ~.BiddingSeasonalityAdjustment]: A function that, when called, will call the underlying RPC on the server. """ @@ -246,33 +243,34 @@ def get_customer_user_access_invitation( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "get_customer_user_access_invitation" not in self._stubs: + if "get_bidding_seasonality_adjustment" not in self._stubs: self._stubs[ - "get_customer_user_access_invitation" + "get_bidding_seasonality_adjustment" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerUserAccessInvitationService/GetCustomerUserAccessInvitation", - request_serializer=customer_user_access_invitation_service.GetCustomerUserAccessInvitationRequest.serialize, - response_deserializer=customer_user_access_invitation.CustomerUserAccessInvitation.deserialize, + "/google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService/GetBiddingSeasonalityAdjustment", + request_serializer=bidding_seasonality_adjustment_service.GetBiddingSeasonalityAdjustmentRequest.serialize, + response_deserializer=bidding_seasonality_adjustment.BiddingSeasonalityAdjustment.deserialize, ) - return self._stubs["get_customer_user_access_invitation"] + return self._stubs["get_bidding_seasonality_adjustment"] @property - def mutate_customer_user_access_invitation( + def mutate_bidding_seasonality_adjustments( self, ) -> Callable[ [ - customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest + bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest ], - customer_user_access_invitation_service.MutateCustomerUserAccessInvitationResponse, + bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsResponse, ]: - r"""Return a callable for the mutate customer user access - invitation method over gRPC. + r"""Return a callable for the mutate bidding seasonality + adjustments method over gRPC. - Creates or removes an access invitation. + Creates, updates, or removes seasonality adjustments. + Operation statuses are returned. Returns: - Callable[[~.MutateCustomerUserAccessInvitationRequest], - ~.MutateCustomerUserAccessInvitationResponse]: + Callable[[~.MutateBiddingSeasonalityAdjustmentsRequest], + ~.MutateBiddingSeasonalityAdjustmentsResponse]: A function that, when called, will call the underlying RPC on the server. """ @@ -280,15 +278,15 @@ def mutate_customer_user_access_invitation( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "mutate_customer_user_access_invitation" not in self._stubs: + if "mutate_bidding_seasonality_adjustments" not in self._stubs: self._stubs[ - "mutate_customer_user_access_invitation" + "mutate_bidding_seasonality_adjustments" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CustomerUserAccessInvitationService/MutateCustomerUserAccessInvitation", - request_serializer=customer_user_access_invitation_service.MutateCustomerUserAccessInvitationRequest.serialize, - response_deserializer=customer_user_access_invitation_service.MutateCustomerUserAccessInvitationResponse.deserialize, + "/google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService/MutateBiddingSeasonalityAdjustments", + request_serializer=bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsRequest.serialize, + response_deserializer=bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsResponse.deserialize, ) - return self._stubs["mutate_customer_user_access_invitation"] + return self._stubs["mutate_bidding_seasonality_adjustments"] -__all__ = ("CustomerUserAccessInvitationServiceGrpcTransport",) +__all__ = ("BiddingSeasonalityAdjustmentServiceGrpcTransport",) diff --git a/google/ads/googleads/v8/services/services/change_status_service/client.py b/google/ads/googleads/v8/services/services/change_status_service/client.py index 367cc55a1..dbfa98fdd 100644 --- a/google/ads/googleads/v8/services/services/change_status_service/client.py +++ b/google/ads/googleads/v8/services/services/change_status_service/client.py @@ -189,6 +189,27 @@ def parse_ad_group_ad_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def ad_group_asset_path( + customer_id: str, ad_group_id: str, asset_id: str, field_type: str, + ) -> str: + """Return a fully-qualified ad_group_asset string.""" + return "customers/{customer_id}/adGroupAssets/{ad_group_id}~{asset_id}~{field_type}".format( + customer_id=customer_id, + ad_group_id=ad_group_id, + asset_id=asset_id, + field_type=field_type, + ) + + @staticmethod + def parse_ad_group_asset_path(path: str) -> Dict[str, str]: + """Parse a ad_group_asset path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/adGroupAssets/(?P.+?)~(?P.+?)~(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def ad_group_bid_modifier_path( customer_id: str, ad_group_id: str, criterion_id: str, @@ -247,6 +268,21 @@ def parse_ad_group_feed_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def asset_path(customer_id: str, asset_id: str,) -> str: + """Return a fully-qualified asset string.""" + return "customers/{customer_id}/assets/{asset_id}".format( + customer_id=customer_id, asset_id=asset_id, + ) + + @staticmethod + def parse_asset_path(path: str) -> Dict[str, str]: + """Parse a asset path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/assets/(?P.+?)$", path + ) + return m.groupdict() if m else {} + @staticmethod def campaign_path(customer_id: str, campaign_id: str,) -> str: """Return a fully-qualified campaign string.""" @@ -263,6 +299,27 @@ def parse_campaign_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def campaign_asset_path( + customer_id: str, campaign_id: str, asset_id: str, field_type: str, + ) -> str: + """Return a fully-qualified campaign_asset string.""" + return "customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}".format( + customer_id=customer_id, + campaign_id=campaign_id, + asset_id=asset_id, + field_type=field_type, + ) + + @staticmethod + def parse_campaign_asset_path(path: str) -> Dict[str, str]: + """Parse a campaign_asset path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/campaignAssets/(?P.+?)~(?P.+?)~(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def campaign_criterion_path( customer_id: str, campaign_id: str, criterion_id: str, @@ -301,6 +358,26 @@ def parse_campaign_feed_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def campaign_shared_set_path( + customer_id: str, campaign_id: str, shared_set_id: str, + ) -> str: + """Return a fully-qualified campaign_shared_set string.""" + return "customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}".format( + customer_id=customer_id, + campaign_id=campaign_id, + shared_set_id=shared_set_id, + ) + + @staticmethod + def parse_campaign_shared_set_path(path: str) -> Dict[str, str]: + """Parse a campaign_shared_set path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/campaignSharedSets/(?P.+?)~(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def change_status_path(customer_id: str, change_status_id: str,) -> str: """Return a fully-qualified change_status string.""" @@ -317,6 +394,24 @@ def parse_change_status_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def customer_asset_path( + customer_id: str, asset_id: str, field_type: str, + ) -> str: + """Return a fully-qualified customer_asset string.""" + return "customers/{customer_id}/customerAssets/{asset_id}~{field_type}".format( + customer_id=customer_id, asset_id=asset_id, field_type=field_type, + ) + + @staticmethod + def parse_customer_asset_path(path: str) -> Dict[str, str]: + """Parse a customer_asset path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/customerAssets/(?P.+?)~(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def feed_path(customer_id: str, feed_id: str,) -> str: """Return a fully-qualified feed string.""" @@ -350,6 +445,22 @@ def parse_feed_item_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def shared_set_path(customer_id: str, shared_set_id: str,) -> str: + """Return a fully-qualified shared_set string.""" + return "customers/{customer_id}/sharedSets/{shared_set_id}".format( + customer_id=customer_id, shared_set_id=shared_set_id, + ) + + @staticmethod + def parse_shared_set_path(path: str) -> Dict[str, str]: + """Parse a shared_set path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/sharedSets/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def common_billing_account_path(billing_account: str,) -> str: """Return a fully-qualified billing_account string.""" diff --git a/google/ads/googleads/v6/common/types/__init__.py b/google/ads/googleads/v8/services/services/conversion_value_rule_service/__init__.py similarity index 85% rename from google/ads/googleads/v6/common/types/__init__.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_service/__init__.py index 42ffdf2bc..afd4d64e4 100644 --- a/google/ads/googleads/v6/common/types/__init__.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .client import ConversionValueRuleServiceClient + +__all__ = ("ConversionValueRuleServiceClient",) diff --git a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/client.py b/google/ads/googleads/v8/services/services/conversion_value_rule_service/client.py similarity index 75% rename from google/ads/googleads/v6/services/services/keyword_plan_campaign_service/client.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_service/client.py index 87e3f05e6..4192c05bd 100644 --- a/google/ads/googleads/v6/services/services/keyword_plan_campaign_service/client.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -22,28 +20,27 @@ from typing import Dict, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.ads.googleads.v6.resources.types import keyword_plan_campaign -from google.ads.googleads.v6.services.types import keyword_plan_campaign_service -from google.rpc import status_pb2 as status # type: ignore - +from google.ads.googleads.v8.resources.types import conversion_value_rule +from google.ads.googleads.v8.services.types import conversion_value_rule_service +from google.rpc import status_pb2 # type: ignore from .transports.base import ( - KeywordPlanCampaignServiceTransport, + ConversionValueRuleServiceTransport, DEFAULT_CLIENT_INFO, ) -from .transports.grpc import KeywordPlanCampaignServiceGrpcTransport +from .transports.grpc import ConversionValueRuleServiceGrpcTransport -class KeywordPlanCampaignServiceClientMeta(type): - """Metaclass for the KeywordPlanCampaignService client. +class ConversionValueRuleServiceClientMeta(type): + """Metaclass for the ConversionValueRuleService client. This provides class-level methods for building and retrieving support objects (e.g. transport) without polluting the client instance @@ -52,12 +49,12 @@ class KeywordPlanCampaignServiceClientMeta(type): _transport_registry = ( OrderedDict() - ) # type: Dict[str, Type[KeywordPlanCampaignServiceTransport]] - _transport_registry["grpc"] = KeywordPlanCampaignServiceGrpcTransport + ) # type: Dict[str, Type[ConversionValueRuleServiceTransport]] + _transport_registry["grpc"] = ConversionValueRuleServiceGrpcTransport def get_transport_class( cls, label: str = None, - ) -> Type[KeywordPlanCampaignServiceTransport]: + ) -> Type[ConversionValueRuleServiceTransport]: """Return an appropriate transport class. Args: @@ -76,10 +73,10 @@ def get_transport_class( return next(iter(cls._transport_registry.values())) -class KeywordPlanCampaignServiceClient( - metaclass=KeywordPlanCampaignServiceClientMeta +class ConversionValueRuleServiceClient( + metaclass=ConversionValueRuleServiceClientMeta ): - """Service to manage Keyword Plan campaigns.""" + """Service to manage conversion value rules.""" @staticmethod def _get_default_mtls_endpoint(api_endpoint): @@ -125,7 +122,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - KeywordPlanCampaignServiceClient: The constructed client. + ConversionValueRuleServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_info( info @@ -145,7 +142,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - KeywordPlanCampaignServiceClient: The constructed client. + ConversionValueRuleServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file( filename @@ -156,14 +153,44 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @property - def transport(self) -> KeywordPlanCampaignServiceTransport: + def transport(self) -> ConversionValueRuleServiceTransport: """Return the transport used by the client instance. Returns: - KeywordPlanCampaignServiceTransport: The transport used by the client instance. + ConversionValueRuleServiceTransport: The transport used by the client instance. """ return self._transport + @staticmethod + def conversion_value_rule_path( + customer_id: str, conversion_value_rule_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule string.""" + return "customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}".format( + customer_id=customer_id, + conversion_value_rule_id=conversion_value_rule_id, + ) + + @staticmethod + def parse_conversion_value_rule_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/conversionValueRules/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def customer_path(customer_id: str,) -> str: + """Return a fully-qualified customer string.""" + return "customers/{customer_id}".format(customer_id=customer_id,) + + @staticmethod + def parse_customer_path(path: str) -> Dict[str, str]: + """Parse a customer path into its component segments.""" + m = re.match(r"^customers/(?P.+?)$", path) + return m.groupdict() if m else {} + @staticmethod def geo_target_constant_path(criterion_id: str,) -> str: """Return a fully-qualified geo_target_constant string.""" @@ -178,53 +205,37 @@ def parse_geo_target_constant_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def keyword_plan_path(customer_id: str, keyword_plan_id: str,) -> str: - """Return a fully-qualified keyword_plan string.""" - return "customers/{customer_id}/keywordPlans/{keyword_plan_id}".format( - customer_id=customer_id, keyword_plan_id=keyword_plan_id, + def user_interest_path(customer_id: str, user_interest_id: str,) -> str: + """Return a fully-qualified user_interest string.""" + return "customers/{customer_id}/userInterests/{user_interest_id}".format( + customer_id=customer_id, user_interest_id=user_interest_id, ) @staticmethod - def parse_keyword_plan_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan path into its component segments.""" + def parse_user_interest_path(path: str) -> Dict[str, str]: + """Parse a user_interest path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/keywordPlans/(?P.+?)$", + r"^customers/(?P.+?)/userInterests/(?P.+?)$", path, ) return m.groupdict() if m else {} @staticmethod - def keyword_plan_campaign_path( - customer_id: str, keyword_plan_campaign_id: str, - ) -> str: - """Return a fully-qualified keyword_plan_campaign string.""" - return "customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}".format( - customer_id=customer_id, - keyword_plan_campaign_id=keyword_plan_campaign_id, + def user_list_path(customer_id: str, user_list_id: str,) -> str: + """Return a fully-qualified user_list string.""" + return "customers/{customer_id}/userLists/{user_list_id}".format( + customer_id=customer_id, user_list_id=user_list_id, ) @staticmethod - def parse_keyword_plan_campaign_path(path: str) -> Dict[str, str]: - """Parse a keyword_plan_campaign path into its component segments.""" + def parse_user_list_path(path: str) -> Dict[str, str]: + """Parse a user_list path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/keywordPlanCampaigns/(?P.+?)$", + r"^customers/(?P.+?)/userLists/(?P.+?)$", path, ) return m.groupdict() if m else {} - @staticmethod - def language_constant_path(criterion_id: str,) -> str: - """Return a fully-qualified language_constant string.""" - return "languageConstants/{criterion_id}".format( - criterion_id=criterion_id, - ) - - @staticmethod - def parse_language_constant_path(path: str) -> Dict[str, str]: - """Parse a language_constant path into its component segments.""" - m = re.match(r"^languageConstants/(?P.+?)$", path) - return m.groupdict() if m else {} - @staticmethod def common_billing_account_path(billing_account: str,) -> str: """Return a fully-qualified billing_account string.""" @@ -289,12 +300,12 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, - transport: Union[str, KeywordPlanCampaignServiceTransport, None] = None, + credentials: Optional[ga_credentials.Credentials] = None, + transport: Union[str, ConversionValueRuleServiceTransport, None] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the keyword plan campaign service client. + """Instantiate the conversion value rule service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -302,7 +313,7 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.KeywordPlanCampaignServiceTransport]): The + transport (Union[str, ~.ConversionValueRuleServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. client_options (google.api_core.client_options.ClientOptions): Custom options for the @@ -382,8 +393,8 @@ def __init__( # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. - if isinstance(transport, KeywordPlanCampaignServiceTransport): - # transport is a KeywordPlanCampaignServiceTransport instance. + if isinstance(transport, ConversionValueRuleServiceTransport): + # transport is a ConversionValueRuleServiceTransport instance. if credentials: raise ValueError( "When providing a transport instance, " @@ -396,37 +407,35 @@ def __init__( credentials=credentials, host=self.DEFAULT_ENDPOINT ) else: - self._transport = KeywordPlanCampaignServiceGrpcTransport( + self._transport = ConversionValueRuleServiceGrpcTransport( credentials=credentials, host=api_endpoint, ssl_channel_credentials=ssl_credentials, client_info=client_info, ) - def get_keyword_plan_campaign( + def get_conversion_value_rule( self, - request: keyword_plan_campaign_service.GetKeywordPlanCampaignRequest = None, + request: conversion_value_rule_service.GetConversionValueRuleRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_campaign.KeywordPlanCampaign: - r"""Returns the requested Keyword Plan campaign in full - detail. + ) -> conversion_value_rule.ConversionValueRule: + r"""Returns the requested conversion value rule. Args: - request (:class:`google.ads.googleads.v6.services.types.GetKeywordPlanCampaignRequest`): + request (:class:`google.ads.googleads.v8.services.types.GetConversionValueRuleRequest`): The request object. Request message for - [KeywordPlanCampaignService.GetKeywordPlanCampaign][google.ads.googleads.v6.services.KeywordPlanCampaignService.GetKeywordPlanCampaign]. + [ConversionValueRuleService.GetConversionValueRule][google.ads.googleads.v8.services.ConversionValueRuleService.GetConversionValueRule]. resource_name (:class:`str`): Required. The resource name of the - Keyword Plan campaign to fetch. + conversion value rule to fetch. This corresponds to the ``resource_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -434,11 +443,8 @@ def get_keyword_plan_campaign( sent along with the request as metadata. Returns: - google.ads.googleads.v6.resources.types.KeywordPlanCampaign: - A Keyword Plan campaign. - Max number of keyword plan campaigns per - plan allowed: 1. - + google.ads.googleads.v8.resources.types.ConversionValueRule: + A conversion value rule """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have @@ -450,26 +456,24 @@ def get_keyword_plan_campaign( ) # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_campaign_service.GetKeywordPlanCampaignRequest. + # in a conversion_value_rule_service.GetConversionValueRuleRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, keyword_plan_campaign_service.GetKeywordPlanCampaignRequest + request, conversion_value_rule_service.GetConversionValueRuleRequest ): - request = keyword_plan_campaign_service.GetKeywordPlanCampaignRequest( + request = conversion_value_rule_service.GetConversionValueRuleRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if resource_name is not None: request.resource_name = resource_name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_keyword_plan_campaign + self._transport.get_conversion_value_rule ] # Certain fields should be provided within the metadata header; @@ -488,42 +492,41 @@ def get_keyword_plan_campaign( # Done; return the response. return response - def mutate_keyword_plan_campaigns( + def mutate_conversion_value_rules( self, - request: keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest = None, + request: conversion_value_rule_service.MutateConversionValueRulesRequest = None, *, customer_id: str = None, operations: Sequence[ - keyword_plan_campaign_service.KeywordPlanCampaignOperation + conversion_value_rule_service.ConversionValueRuleOperation ] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> keyword_plan_campaign_service.MutateKeywordPlanCampaignsResponse: - r"""Creates, updates, or removes Keyword Plan campaigns. + ) -> conversion_value_rule_service.MutateConversionValueRulesResponse: + r"""Creates, updates, or removes conversion value rules. Operation statuses are returned. Args: - request (:class:`google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignsRequest`): + request (:class:`google.ads.googleads.v8.services.types.MutateConversionValueRulesRequest`): The request object. Request message for - [KeywordPlanCampaignService.MutateKeywordPlanCampaigns][google.ads.googleads.v6.services.KeywordPlanCampaignService.MutateKeywordPlanCampaigns]. + [ConversionValueRuleService.MutateConversionValueRules][google.ads.googleads.v8.services.ConversionValueRuleService.MutateConversionValueRules]. customer_id (:class:`str`): Required. The ID of the customer - whose Keyword Plan campaigns are being + whose conversion value rules are being modified. This corresponds to the ``customer_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.KeywordPlanCampaignOperation]`): + operations (:class:`Sequence[google.ads.googleads.v8.services.types.ConversionValueRuleOperation]`): Required. The list of operations to - perform on individual Keyword Plan - campaigns. + perform on individual conversion value + rules. This corresponds to the ``operations`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -531,9 +534,9 @@ def mutate_keyword_plan_campaigns( sent along with the request as metadata. Returns: - google.ads.googleads.v6.services.types.MutateKeywordPlanCampaignsResponse: - Response message for a Keyword Plan - campaign mutate. + google.ads.googleads.v8.services.types.MutateConversionValueRulesResponse: + Response message for + [ConversionValueRuleService.MutateConversionValueRules][google.ads.googleads.v8.services.ConversionValueRuleService.MutateConversionValueRules]. """ # Create or coerce a protobuf request object. @@ -546,20 +549,18 @@ def mutate_keyword_plan_campaigns( ) # Minor optimization to avoid making a copy if the user passes - # in a keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest. + # in a conversion_value_rule_service.MutateConversionValueRulesRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( request, - keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest, + conversion_value_rule_service.MutateConversionValueRulesRequest, ): - request = keyword_plan_campaign_service.MutateKeywordPlanCampaignsRequest( + request = conversion_value_rule_service.MutateConversionValueRulesRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if customer_id is not None: request.customer_id = customer_id if operations is not None: @@ -568,7 +569,7 @@ def mutate_keyword_plan_campaigns( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.mutate_keyword_plan_campaigns + self._transport.mutate_conversion_value_rules ] # Certain fields should be provided within the metadata header; @@ -588,4 +589,4 @@ def mutate_keyword_plan_campaigns( return response -__all__ = ("KeywordPlanCampaignServiceClient",) +__all__ = ("ConversionValueRuleServiceClient",) diff --git a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/__init__.py b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/__init__.py similarity index 69% rename from google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/__init__.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/__init__.py index ee879e93f..9385cc3a6 100644 --- a/google/ads/googleads/v6/services/services/ad_group_audience_view_service/transports/__init__.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type -from .base import AdGroupAudienceViewServiceTransport -from .grpc import AdGroupAudienceViewServiceGrpcTransport +from .base import ConversionValueRuleServiceTransport +from .grpc import ConversionValueRuleServiceGrpcTransport # Compile a registry of transports. _transport_registry = ( OrderedDict() -) # type: Dict[str, Type[AdGroupAudienceViewServiceTransport]] -_transport_registry["grpc"] = AdGroupAudienceViewServiceGrpcTransport +) # type: Dict[str, Type[ConversionValueRuleServiceTransport]] +_transport_registry["grpc"] = ConversionValueRuleServiceGrpcTransport __all__ = ( - "AdGroupAudienceViewServiceTransport", - "AdGroupAudienceViewServiceGrpcTransport", + "ConversionValueRuleServiceTransport", + "ConversionValueRuleServiceGrpcTransport", ) diff --git a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/base.py b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/base.py similarity index 72% rename from google/ads/googleads/v6/services/services/ad_group_feed_service/transports/base.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/base.py index 02977857d..be6660bf9 100644 --- a/google/ads/googleads/v6/services/services/ad_group_feed_service/transports/base.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,19 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc import typing import pkg_resources -from google import auth +import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore - -from google.ads.googleads.v6.resources.types import ad_group_feed -from google.ads.googleads.v6.services.types import ad_group_feed_service +from google.auth import credentials as ga_credentials # type: ignore +from google.ads.googleads.v8.resources.types import conversion_value_rule +from google.ads.googleads.v8.services.types import conversion_value_rule_service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -36,8 +33,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -class AdGroupFeedServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for AdGroupFeedService.""" +class ConversionValueRuleServiceTransport(metaclass=abc.ABCMeta): + """Abstract transport class for ConversionValueRuleService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) @@ -45,13 +42,14 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -71,7 +69,7 @@ def __init__( # If no credentials are provided, then determine the appropriate # defaults. if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # Save the credentials. self._credentials = credentials @@ -82,34 +80,35 @@ def __init__( def _prep_wrapped_messages(self, client_info): # Precomputed wrapped methods self._wrapped_methods = { - self.get_ad_group_feed: gapic_v1.method.wrap_method( - self.get_ad_group_feed, + self.get_conversion_value_rule: gapic_v1.method.wrap_method( + self.get_conversion_value_rule, default_timeout=None, client_info=client_info, ), - self.mutate_ad_group_feeds: gapic_v1.method.wrap_method( - self.mutate_ad_group_feeds, + self.mutate_conversion_value_rules: gapic_v1.method.wrap_method( + self.mutate_conversion_value_rules, default_timeout=None, client_info=client_info, ), } @property - def get_ad_group_feed( + def get_conversion_value_rule( self, ) -> typing.Callable[ - [ad_group_feed_service.GetAdGroupFeedRequest], ad_group_feed.AdGroupFeed + [conversion_value_rule_service.GetConversionValueRuleRequest], + conversion_value_rule.ConversionValueRule, ]: raise NotImplementedError @property - def mutate_ad_group_feeds( + def mutate_conversion_value_rules( self, ) -> typing.Callable[ - [ad_group_feed_service.MutateAdGroupFeedsRequest], - ad_group_feed_service.MutateAdGroupFeedsResponse, + [conversion_value_rule_service.MutateConversionValueRulesRequest], + conversion_value_rule_service.MutateConversionValueRulesResponse, ]: raise NotImplementedError -__all__ = ("AdGroupFeedServiceTransport",) +__all__ = ("ConversionValueRuleServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/grpc.py b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/grpc.py similarity index 77% rename from google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/grpc.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/grpc.py index cd05a6501..c1e6cf0ed 100644 --- a/google/ads/googleads/v6/services/services/campaign_bid_modifier_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,30 +13,28 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore -from google.ads.googleads.v6.resources.types import campaign_bid_modifier -from google.ads.googleads.v6.services.types import campaign_bid_modifier_service - -from .base import CampaignBidModifierServiceTransport, DEFAULT_CLIENT_INFO +from google.ads.googleads.v8.resources.types import conversion_value_rule +from google.ads.googleads.v8.services.types import conversion_value_rule_service +from .base import ConversionValueRuleServiceTransport, DEFAULT_CLIENT_INFO -class CampaignBidModifierServiceGrpcTransport( - CampaignBidModifierServiceTransport +class ConversionValueRuleServiceGrpcTransport( + ConversionValueRuleServiceTransport ): - """gRPC backend transport for CampaignBidModifierService. + """gRPC backend transport for ConversionValueRuleService. - Service to manage campaign bid modifiers. + Service to manage conversion value rules. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -51,7 +48,7 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -64,7 +61,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -123,7 +121,7 @@ def __init__( ) if credentials is None: - credentials, _ = auth.default( + credentials, _ = google.auth.default( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) @@ -155,7 +153,7 @@ def __init__( host = host if ":" in host else host + ":443" if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( @@ -180,7 +178,7 @@ def __init__( def create_channel( cls, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: @@ -214,20 +212,19 @@ def grpc_channel(self) -> grpc.Channel: return self._grpc_channel @property - def get_campaign_bid_modifier( + def get_conversion_value_rule( self, ) -> Callable[ - [campaign_bid_modifier_service.GetCampaignBidModifierRequest], - campaign_bid_modifier.CampaignBidModifier, + [conversion_value_rule_service.GetConversionValueRuleRequest], + conversion_value_rule.ConversionValueRule, ]: - r"""Return a callable for the get campaign bid modifier method over gRPC. + r"""Return a callable for the get conversion value rule method over gRPC. - Returns the requested campaign bid modifier in full - detail. + Returns the requested conversion value rule. Returns: - Callable[[~.GetCampaignBidModifierRequest], - ~.CampaignBidModifier]: + Callable[[~.GetConversionValueRuleRequest], + ~.ConversionValueRule]: A function that, when called, will call the underlying RPC on the server. """ @@ -235,31 +232,31 @@ def get_campaign_bid_modifier( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "get_campaign_bid_modifier" not in self._stubs: + if "get_conversion_value_rule" not in self._stubs: self._stubs[ - "get_campaign_bid_modifier" + "get_conversion_value_rule" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignBidModifierService/GetCampaignBidModifier", - request_serializer=campaign_bid_modifier_service.GetCampaignBidModifierRequest.serialize, - response_deserializer=campaign_bid_modifier.CampaignBidModifier.deserialize, + "/google.ads.googleads.v8.services.ConversionValueRuleService/GetConversionValueRule", + request_serializer=conversion_value_rule_service.GetConversionValueRuleRequest.serialize, + response_deserializer=conversion_value_rule.ConversionValueRule.deserialize, ) - return self._stubs["get_campaign_bid_modifier"] + return self._stubs["get_conversion_value_rule"] @property - def mutate_campaign_bid_modifiers( + def mutate_conversion_value_rules( self, ) -> Callable[ - [campaign_bid_modifier_service.MutateCampaignBidModifiersRequest], - campaign_bid_modifier_service.MutateCampaignBidModifiersResponse, + [conversion_value_rule_service.MutateConversionValueRulesRequest], + conversion_value_rule_service.MutateConversionValueRulesResponse, ]: - r"""Return a callable for the mutate campaign bid modifiers method over gRPC. + r"""Return a callable for the mutate conversion value rules method over gRPC. - Creates, updates, or removes campaign bid modifiers. + Creates, updates, or removes conversion value rules. Operation statuses are returned. Returns: - Callable[[~.MutateCampaignBidModifiersRequest], - ~.MutateCampaignBidModifiersResponse]: + Callable[[~.MutateConversionValueRulesRequest], + ~.MutateConversionValueRulesResponse]: A function that, when called, will call the underlying RPC on the server. """ @@ -267,15 +264,15 @@ def mutate_campaign_bid_modifiers( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "mutate_campaign_bid_modifiers" not in self._stubs: + if "mutate_conversion_value_rules" not in self._stubs: self._stubs[ - "mutate_campaign_bid_modifiers" + "mutate_conversion_value_rules" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.CampaignBidModifierService/MutateCampaignBidModifiers", - request_serializer=campaign_bid_modifier_service.MutateCampaignBidModifiersRequest.serialize, - response_deserializer=campaign_bid_modifier_service.MutateCampaignBidModifiersResponse.deserialize, + "/google.ads.googleads.v8.services.ConversionValueRuleService/MutateConversionValueRules", + request_serializer=conversion_value_rule_service.MutateConversionValueRulesRequest.serialize, + response_deserializer=conversion_value_rule_service.MutateConversionValueRulesResponse.deserialize, ) - return self._stubs["mutate_campaign_bid_modifiers"] + return self._stubs["mutate_conversion_value_rules"] -__all__ = ("CampaignBidModifierServiceGrpcTransport",) +__all__ = ("ConversionValueRuleServiceGrpcTransport",) diff --git a/google/ads/googleads/v6/enums/types/__init__.py b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/__init__.py similarity index 84% rename from google/ads/googleads/v6/enums/types/__init__.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_set_service/__init__.py index 42ffdf2bc..9b88f5c98 100644 --- a/google/ads/googleads/v6/enums/types/__init__.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,3 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from .client import ConversionValueRuleSetServiceClient + +__all__ = ("ConversionValueRuleSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/client.py b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/client.py similarity index 75% rename from google/ads/googleads/v6/services/services/campaign_extension_setting_service/client.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_set_service/client.py index 993fc0dbe..6e1bbb2b9 100644 --- a/google/ads/googleads/v6/services/services/campaign_extension_setting_service/client.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/client.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,7 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from distutils import util import os @@ -22,30 +20,29 @@ from typing import Dict, Optional, Sequence, Tuple, Type, Union from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions # type: ignore +from google.api_core import exceptions as core_exceptions # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -from google.ads.googleads.v6.resources.types import campaign_extension_setting -from google.ads.googleads.v6.services.types import ( - campaign_extension_setting_service, +from google.ads.googleads.v8.resources.types import conversion_value_rule_set +from google.ads.googleads.v8.services.types import ( + conversion_value_rule_set_service, ) -from google.rpc import status_pb2 as status # type: ignore - +from google.rpc import status_pb2 # type: ignore from .transports.base import ( - CampaignExtensionSettingServiceTransport, + ConversionValueRuleSetServiceTransport, DEFAULT_CLIENT_INFO, ) -from .transports.grpc import CampaignExtensionSettingServiceGrpcTransport +from .transports.grpc import ConversionValueRuleSetServiceGrpcTransport -class CampaignExtensionSettingServiceClientMeta(type): - """Metaclass for the CampaignExtensionSettingService client. +class ConversionValueRuleSetServiceClientMeta(type): + """Metaclass for the ConversionValueRuleSetService client. This provides class-level methods for building and retrieving support objects (e.g. transport) without polluting the client instance @@ -54,12 +51,12 @@ class CampaignExtensionSettingServiceClientMeta(type): _transport_registry = ( OrderedDict() - ) # type: Dict[str, Type[CampaignExtensionSettingServiceTransport]] - _transport_registry["grpc"] = CampaignExtensionSettingServiceGrpcTransport + ) # type: Dict[str, Type[ConversionValueRuleSetServiceTransport]] + _transport_registry["grpc"] = ConversionValueRuleSetServiceGrpcTransport def get_transport_class( cls, label: str = None, - ) -> Type[CampaignExtensionSettingServiceTransport]: + ) -> Type[ConversionValueRuleSetServiceTransport]: """Return an appropriate transport class. Args: @@ -78,10 +75,10 @@ def get_transport_class( return next(iter(cls._transport_registry.values())) -class CampaignExtensionSettingServiceClient( - metaclass=CampaignExtensionSettingServiceClientMeta +class ConversionValueRuleSetServiceClient( + metaclass=ConversionValueRuleSetServiceClientMeta ): - """Service to manage campaign extension settings.""" + """Service to manage conversion value rule sets.""" @staticmethod def _get_default_mtls_endpoint(api_endpoint): @@ -127,7 +124,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignExtensionSettingServiceClient: The constructed client. + ConversionValueRuleSetServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_info( info @@ -147,7 +144,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - CampaignExtensionSettingServiceClient: The constructed client. + ConversionValueRuleSetServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file( filename @@ -158,11 +155,11 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file @property - def transport(self) -> CampaignExtensionSettingServiceTransport: + def transport(self) -> ConversionValueRuleSetServiceTransport: """Return the transport used by the client instance. Returns: - CampaignExtensionSettingServiceTransport: The transport used by the client instance. + ConversionValueRuleSetServiceTransport: The transport used by the client instance. """ return self._transport @@ -183,41 +180,54 @@ def parse_campaign_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def campaign_extension_setting_path( - customer_id: str, campaign_id: str, extension_type: str, + def conversion_value_rule_path( + customer_id: str, conversion_value_rule_id: str, ) -> str: - """Return a fully-qualified campaign_extension_setting string.""" - return "customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}".format( + """Return a fully-qualified conversion_value_rule string.""" + return "customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}".format( customer_id=customer_id, - campaign_id=campaign_id, - extension_type=extension_type, + conversion_value_rule_id=conversion_value_rule_id, ) @staticmethod - def parse_campaign_extension_setting_path(path: str) -> Dict[str, str]: - """Parse a campaign_extension_setting path into its component segments.""" + def parse_conversion_value_rule_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/campaignExtensionSettings/(?P.+?)~(?P.+?)$", + r"^customers/(?P.+?)/conversionValueRules/(?P.+?)$", path, ) return m.groupdict() if m else {} @staticmethod - def extension_feed_item_path(customer_id: str, feed_item_id: str,) -> str: - """Return a fully-qualified extension_feed_item string.""" - return "customers/{customer_id}/extensionFeedItems/{feed_item_id}".format( - customer_id=customer_id, feed_item_id=feed_item_id, + def conversion_value_rule_set_path( + customer_id: str, conversion_value_rule_set_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule_set string.""" + return "customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}".format( + customer_id=customer_id, + conversion_value_rule_set_id=conversion_value_rule_set_id, ) @staticmethod - def parse_extension_feed_item_path(path: str) -> Dict[str, str]: - """Parse a extension_feed_item path into its component segments.""" + def parse_conversion_value_rule_set_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule_set path into its component segments.""" m = re.match( - r"^customers/(?P.+?)/extensionFeedItems/(?P.+?)$", + r"^customers/(?P.+?)/conversionValueRuleSets/(?P.+?)$", path, ) return m.groupdict() if m else {} + @staticmethod + def customer_path(customer_id: str,) -> str: + """Return a fully-qualified customer string.""" + return "customers/{customer_id}".format(customer_id=customer_id,) + + @staticmethod + def parse_customer_path(path: str) -> Dict[str, str]: + """Parse a customer path into its component segments.""" + m = re.match(r"^customers/(?P.+?)$", path) + return m.groupdict() if m else {} + @staticmethod def common_billing_account_path(billing_account: str,) -> str: """Return a fully-qualified billing_account string.""" @@ -282,14 +292,14 @@ def parse_common_location_path(path: str) -> Dict[str, str]: def __init__( self, *, - credentials: Optional[credentials.Credentials] = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[ - str, CampaignExtensionSettingServiceTransport, None + str, ConversionValueRuleSetServiceTransport, None ] = None, client_options: Optional[client_options_lib.ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: - """Instantiate the campaign extension setting service client. + """Instantiate the conversion value rule set service client. Args: credentials (Optional[google.auth.credentials.Credentials]): The @@ -297,7 +307,7 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.CampaignExtensionSettingServiceTransport]): The + transport (Union[str, ~.ConversionValueRuleSetServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. client_options (google.api_core.client_options.ClientOptions): Custom options for the @@ -377,8 +387,8 @@ def __init__( # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. - if isinstance(transport, CampaignExtensionSettingServiceTransport): - # transport is a CampaignExtensionSettingServiceTransport instance. + if isinstance(transport, ConversionValueRuleSetServiceTransport): + # transport is a ConversionValueRuleSetServiceTransport instance. if credentials: raise ValueError( "When providing a transport instance, " @@ -391,37 +401,35 @@ def __init__( credentials=credentials, host=self.DEFAULT_ENDPOINT ) else: - self._transport = CampaignExtensionSettingServiceGrpcTransport( + self._transport = ConversionValueRuleSetServiceGrpcTransport( credentials=credentials, host=api_endpoint, ssl_channel_credentials=ssl_credentials, client_info=client_info, ) - def get_campaign_extension_setting( + def get_conversion_value_rule_set( self, - request: campaign_extension_setting_service.GetCampaignExtensionSettingRequest = None, + request: conversion_value_rule_set_service.GetConversionValueRuleSetRequest = None, *, resource_name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_extension_setting.CampaignExtensionSetting: - r"""Returns the requested campaign extension setting in - full detail. + ) -> conversion_value_rule_set.ConversionValueRuleSet: + r"""Returns the requested conversion value rule set. Args: - request (:class:`google.ads.googleads.v6.services.types.GetCampaignExtensionSettingRequest`): + request (:class:`google.ads.googleads.v8.services.types.GetConversionValueRuleSetRequest`): The request object. Request message for - [CampaignExtensionSettingService.GetCampaignExtensionSetting][google.ads.googleads.v6.services.CampaignExtensionSettingService.GetCampaignExtensionSetting]. + [ConversionValueRuleSetService.GetConversionValueRuleSet][google.ads.googleads.v8.services.ConversionValueRuleSetService.GetConversionValueRuleSet]. resource_name (:class:`str`): Required. The resource name of the - campaign extension setting to fetch. + conversion value rule set to fetch. This corresponds to the ``resource_name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -429,8 +437,8 @@ def get_campaign_extension_setting( sent along with the request as metadata. Returns: - google.ads.googleads.v6.resources.types.CampaignExtensionSetting: - A campaign extension setting. + google.ads.googleads.v8.resources.types.ConversionValueRuleSet: + A conversion value rule set """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have @@ -442,27 +450,25 @@ def get_campaign_extension_setting( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_extension_setting_service.GetCampaignExtensionSettingRequest. + # in a conversion_value_rule_set_service.GetConversionValueRuleSetRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( request, - campaign_extension_setting_service.GetCampaignExtensionSettingRequest, + conversion_value_rule_set_service.GetConversionValueRuleSetRequest, ): - request = campaign_extension_setting_service.GetCampaignExtensionSettingRequest( + request = conversion_value_rule_set_service.GetConversionValueRuleSetRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if resource_name is not None: request.resource_name = resource_name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_campaign_extension_setting + self._transport.get_conversion_value_rule_set ] # Certain fields should be provided within the metadata header; @@ -481,42 +487,41 @@ def get_campaign_extension_setting( # Done; return the response. return response - def mutate_campaign_extension_settings( + def mutate_conversion_value_rule_sets( self, - request: campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest = None, + request: conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest = None, *, customer_id: str = None, operations: Sequence[ - campaign_extension_setting_service.CampaignExtensionSettingOperation + conversion_value_rule_set_service.ConversionValueRuleSetOperation ] = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> campaign_extension_setting_service.MutateCampaignExtensionSettingsResponse: - r"""Creates, updates, or removes campaign extension - settings. Operation statuses are returned. + ) -> conversion_value_rule_set_service.MutateConversionValueRuleSetsResponse: + r"""Creates, updates or removes conversion value rule + sets. Operation statuses are returned. Args: - request (:class:`google.ads.googleads.v6.services.types.MutateCampaignExtensionSettingsRequest`): + request (:class:`google.ads.googleads.v8.services.types.MutateConversionValueRuleSetsRequest`): The request object. Request message for - [CampaignExtensionSettingService.MutateCampaignExtensionSettings][google.ads.googleads.v6.services.CampaignExtensionSettingService.MutateCampaignExtensionSettings]. + [ConversionValueRuleSetService.MutateConversionValueRuleSets][google.ads.googleads.v8.services.ConversionValueRuleSetService.MutateConversionValueRuleSets]. customer_id (:class:`str`): Required. The ID of the customer - whose campaign extension settings are + whose conversion value rule sets are being modified. This corresponds to the ``customer_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - operations (:class:`Sequence[google.ads.googleads.v6.services.types.CampaignExtensionSettingOperation]`): + operations (:class:`Sequence[google.ads.googleads.v8.services.types.ConversionValueRuleSetOperation]`): Required. The list of operations to - perform on individual campaign extension - settings. + perform on individual conversion value + rule sets. This corresponds to the ``operations`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -524,9 +529,9 @@ def mutate_campaign_extension_settings( sent along with the request as metadata. Returns: - google.ads.googleads.v6.services.types.MutateCampaignExtensionSettingsResponse: - Response message for a campaign - extension setting mutate. + google.ads.googleads.v8.services.types.MutateConversionValueRuleSetsResponse: + Response message for + [ConversionValueRuleSetService.MutateConversionValueRuleSets][google.ads.googleads.v8.services.ConversionValueRuleSetService.MutateConversionValueRuleSets]. """ # Create or coerce a protobuf request object. @@ -539,20 +544,18 @@ def mutate_campaign_extension_settings( ) # Minor optimization to avoid making a copy if the user passes - # in a campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest. + # in a conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( request, - campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest, + conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest, ): - request = campaign_extension_setting_service.MutateCampaignExtensionSettingsRequest( + request = conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest( request ) - # If we have keyword arguments corresponding to fields on the # request, apply these. - if customer_id is not None: request.customer_id = customer_id if operations is not None: @@ -561,7 +564,7 @@ def mutate_campaign_extension_settings( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.mutate_campaign_extension_settings + self._transport.mutate_conversion_value_rule_sets ] # Certain fields should be provided within the metadata header; @@ -581,4 +584,4 @@ def mutate_campaign_extension_settings( return response -__all__ = ("CampaignExtensionSettingServiceClient",) +__all__ = ("ConversionValueRuleSetServiceClient",) diff --git a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/__init__.py b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/__init__.py similarity index 68% rename from google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/__init__.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/__init__.py index 38d03b6b1..b023ce8f3 100644 --- a/google/ads/googleads/v6/services/services/account_budget_proposal_service/transports/__init__.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/__init__.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. # - from collections import OrderedDict from typing import Dict, Type -from .base import AccountBudgetProposalServiceTransport -from .grpc import AccountBudgetProposalServiceGrpcTransport +from .base import ConversionValueRuleSetServiceTransport +from .grpc import ConversionValueRuleSetServiceGrpcTransport # Compile a registry of transports. _transport_registry = ( OrderedDict() -) # type: Dict[str, Type[AccountBudgetProposalServiceTransport]] -_transport_registry["grpc"] = AccountBudgetProposalServiceGrpcTransport +) # type: Dict[str, Type[ConversionValueRuleSetServiceTransport]] +_transport_registry["grpc"] = ConversionValueRuleSetServiceGrpcTransport __all__ = ( - "AccountBudgetProposalServiceTransport", - "AccountBudgetProposalServiceGrpcTransport", + "ConversionValueRuleSetServiceTransport", + "ConversionValueRuleSetServiceGrpcTransport", ) diff --git a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/base.py b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/base.py similarity index 69% rename from google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/base.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/base.py index cca45d3ec..fd4e0f1f2 100644 --- a/google/ads/googleads/v6/services/services/customer_negative_criterion_service/transports/base.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/base.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import abc import typing import pkg_resources -from google import auth +import google.auth # type: ignore from google.api_core import gapic_v1 # type: ignore from google.api_core import retry as retries # type: ignore -from google.auth import credentials # type: ignore +from google.auth import credentials as ga_credentials # type: ignore -from google.ads.googleads.v6.resources.types import customer_negative_criterion -from google.ads.googleads.v6.services.types import ( - customer_negative_criterion_service, +from google.ads.googleads.v8.resources.types import conversion_value_rule_set +from google.ads.googleads.v8.services.types import ( + conversion_value_rule_set_service, ) - try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( gapic_version=pkg_resources.get_distribution("google-ads",).version, @@ -38,8 +35,8 @@ DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() -class CustomerNegativeCriterionServiceTransport(metaclass=abc.ABCMeta): - """Abstract transport class for CustomerNegativeCriterionService.""" +class ConversionValueRuleSetServiceTransport(metaclass=abc.ABCMeta): + """Abstract transport class for ConversionValueRuleSetService.""" AUTH_SCOPES = ("https://www.googleapis.com/auth/adwords",) @@ -47,13 +44,14 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -73,7 +71,7 @@ def __init__( # If no credentials are provided, then determine the appropriate # defaults. if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # Save the credentials. self._credentials = credentials @@ -84,39 +82,37 @@ def __init__( def _prep_wrapped_messages(self, client_info): # Precomputed wrapped methods self._wrapped_methods = { - self.get_customer_negative_criterion: gapic_v1.method.wrap_method( - self.get_customer_negative_criterion, + self.get_conversion_value_rule_set: gapic_v1.method.wrap_method( + self.get_conversion_value_rule_set, default_timeout=None, client_info=client_info, ), - self.mutate_customer_negative_criteria: gapic_v1.method.wrap_method( - self.mutate_customer_negative_criteria, + self.mutate_conversion_value_rule_sets: gapic_v1.method.wrap_method( + self.mutate_conversion_value_rule_sets, default_timeout=None, client_info=client_info, ), } @property - def get_customer_negative_criterion( + def get_conversion_value_rule_set( self, ) -> typing.Callable[ - [ - customer_negative_criterion_service.GetCustomerNegativeCriterionRequest - ], - customer_negative_criterion.CustomerNegativeCriterion, + [conversion_value_rule_set_service.GetConversionValueRuleSetRequest], + conversion_value_rule_set.ConversionValueRuleSet, ]: raise NotImplementedError @property - def mutate_customer_negative_criteria( + def mutate_conversion_value_rule_sets( self, ) -> typing.Callable[ [ - customer_negative_criterion_service.MutateCustomerNegativeCriteriaRequest + conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest ], - customer_negative_criterion_service.MutateCustomerNegativeCriteriaResponse, + conversion_value_rule_set_service.MutateConversionValueRuleSetsResponse, ]: raise NotImplementedError -__all__ = ("CustomerNegativeCriterionServiceTransport",) +__all__ = ("ConversionValueRuleSetServiceTransport",) diff --git a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/grpc.py b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/grpc.py similarity index 75% rename from google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/grpc.py rename to google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/grpc.py index b9c1b97ec..ebbd669d4 100644 --- a/google/ads/googleads/v6/services/services/ad_group_extension_setting_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/conversion_value_rule_set_service/transports/grpc.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,32 +13,30 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import warnings from typing import Callable, Dict, Optional, Sequence, Tuple from google.api_core import grpc_helpers # type: ignore from google.api_core import gapic_v1 # type: ignore -from google import auth # type: ignore -from google.auth import credentials # type: ignore +import google.auth # type: ignore +from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore import grpc # type: ignore -from google.ads.googleads.v6.resources.types import ad_group_extension_setting -from google.ads.googleads.v6.services.types import ( - ad_group_extension_setting_service, +from google.ads.googleads.v8.resources.types import conversion_value_rule_set +from google.ads.googleads.v8.services.types import ( + conversion_value_rule_set_service, ) - -from .base import AdGroupExtensionSettingServiceTransport, DEFAULT_CLIENT_INFO +from .base import ConversionValueRuleSetServiceTransport, DEFAULT_CLIENT_INFO -class AdGroupExtensionSettingServiceGrpcTransport( - AdGroupExtensionSettingServiceTransport +class ConversionValueRuleSetServiceGrpcTransport( + ConversionValueRuleSetServiceTransport ): - """gRPC backend transport for AdGroupExtensionSettingService. + """gRPC backend transport for ConversionValueRuleSetService. - Service to manage ad group extension settings. + Service to manage conversion value rule sets. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -53,7 +50,7 @@ def __init__( self, *, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, credentials_file: str = None, scopes: Sequence[str] = None, channel: grpc.Channel = None, @@ -66,7 +63,8 @@ def __init__( """Instantiate the transport. Args: - host (Optional[str]): The hostname to connect to. + host (Optional[str]): + The hostname to connect to. credentials (Optional[google.auth.credentials.Credentials]): The authorization credentials to attach to requests. These credentials identify the application to the service; if none @@ -125,7 +123,7 @@ def __init__( ) if credentials is None: - credentials, _ = auth.default( + credentials, _ = google.auth.default( scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id ) @@ -157,7 +155,7 @@ def __init__( host = host if ":" in host else host + ":443" if credentials is None: - credentials, _ = auth.default(scopes=self.AUTH_SCOPES) + credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES) # create a new channel. The provided one is ignored. self._grpc_channel = type(self).create_channel( @@ -182,7 +180,7 @@ def __init__( def create_channel( cls, host: str = "googleads.googleapis.com", - credentials: credentials.Credentials = None, + credentials: ga_credentials.Credentials = None, scopes: Optional[Sequence[str]] = None, **kwargs, ) -> grpc.Channel: @@ -216,20 +214,19 @@ def grpc_channel(self) -> grpc.Channel: return self._grpc_channel @property - def get_ad_group_extension_setting( + def get_conversion_value_rule_set( self, ) -> Callable[ - [ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest], - ad_group_extension_setting.AdGroupExtensionSetting, + [conversion_value_rule_set_service.GetConversionValueRuleSetRequest], + conversion_value_rule_set.ConversionValueRuleSet, ]: - r"""Return a callable for the get ad group extension setting method over gRPC. + r"""Return a callable for the get conversion value rule set method over gRPC. - Returns the requested ad group extension setting in - full detail. + Returns the requested conversion value rule set. Returns: - Callable[[~.GetAdGroupExtensionSettingRequest], - ~.AdGroupExtensionSetting]: + Callable[[~.GetConversionValueRuleSetRequest], + ~.ConversionValueRuleSet]: A function that, when called, will call the underlying RPC on the server. """ @@ -237,34 +234,34 @@ def get_ad_group_extension_setting( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "get_ad_group_extension_setting" not in self._stubs: + if "get_conversion_value_rule_set" not in self._stubs: self._stubs[ - "get_ad_group_extension_setting" + "get_conversion_value_rule_set" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupExtensionSettingService/GetAdGroupExtensionSetting", - request_serializer=ad_group_extension_setting_service.GetAdGroupExtensionSettingRequest.serialize, - response_deserializer=ad_group_extension_setting.AdGroupExtensionSetting.deserialize, + "/google.ads.googleads.v8.services.ConversionValueRuleSetService/GetConversionValueRuleSet", + request_serializer=conversion_value_rule_set_service.GetConversionValueRuleSetRequest.serialize, + response_deserializer=conversion_value_rule_set.ConversionValueRuleSet.deserialize, ) - return self._stubs["get_ad_group_extension_setting"] + return self._stubs["get_conversion_value_rule_set"] @property - def mutate_ad_group_extension_settings( + def mutate_conversion_value_rule_sets( self, ) -> Callable[ [ - ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest + conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest ], - ad_group_extension_setting_service.MutateAdGroupExtensionSettingsResponse, + conversion_value_rule_set_service.MutateConversionValueRuleSetsResponse, ]: - r"""Return a callable for the mutate ad group extension - settings method over gRPC. + r"""Return a callable for the mutate conversion value rule + sets method over gRPC. - Creates, updates, or removes ad group extension - settings. Operation statuses are returned. + Creates, updates or removes conversion value rule + sets. Operation statuses are returned. Returns: - Callable[[~.MutateAdGroupExtensionSettingsRequest], - ~.MutateAdGroupExtensionSettingsResponse]: + Callable[[~.MutateConversionValueRuleSetsRequest], + ~.MutateConversionValueRuleSetsResponse]: A function that, when called, will call the underlying RPC on the server. """ @@ -272,15 +269,15 @@ def mutate_ad_group_extension_settings( # the request. # gRPC handles serialization and deserialization, so we just need # to pass in the functions for each. - if "mutate_ad_group_extension_settings" not in self._stubs: + if "mutate_conversion_value_rule_sets" not in self._stubs: self._stubs[ - "mutate_ad_group_extension_settings" + "mutate_conversion_value_rule_sets" ] = self.grpc_channel.unary_unary( - "/google.ads.googleads.v6.services.AdGroupExtensionSettingService/MutateAdGroupExtensionSettings", - request_serializer=ad_group_extension_setting_service.MutateAdGroupExtensionSettingsRequest.serialize, - response_deserializer=ad_group_extension_setting_service.MutateAdGroupExtensionSettingsResponse.deserialize, + "/google.ads.googleads.v8.services.ConversionValueRuleSetService/MutateConversionValueRuleSets", + request_serializer=conversion_value_rule_set_service.MutateConversionValueRuleSetsRequest.serialize, + response_deserializer=conversion_value_rule_set_service.MutateConversionValueRuleSetsResponse.deserialize, ) - return self._stubs["mutate_ad_group_extension_settings"] + return self._stubs["mutate_conversion_value_rule_sets"] -__all__ = ("AdGroupExtensionSettingServiceGrpcTransport",) +__all__ = ("ConversionValueRuleSetServiceGrpcTransport",) diff --git a/google/ads/googleads/v8/services/services/google_ads_service/client.py b/google/ads/googleads/v8/services/services/google_ads_service/client.py index d08061fd0..4bc305be9 100644 --- a/google/ads/googleads/v8/services/services/google_ads_service/client.py +++ b/google/ads/googleads/v8/services/services/google_ads_service/client.py @@ -649,6 +649,42 @@ def parse_batch_job_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def bidding_data_exclusion_path( + customer_id: str, seasonality_event_id: str, + ) -> str: + """Return a fully-qualified bidding_data_exclusion string.""" + return "customers/{customer_id}/biddingDataExclusions/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, + ) + + @staticmethod + def parse_bidding_data_exclusion_path(path: str) -> Dict[str, str]: + """Parse a bidding_data_exclusion path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/biddingDataExclusions/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def bidding_seasonality_adjustment_path( + customer_id: str, seasonality_event_id: str, + ) -> str: + """Return a fully-qualified bidding_seasonality_adjustment string.""" + return "customers/{customer_id}/biddingSeasonalityAdjustments/{seasonality_event_id}".format( + customer_id=customer_id, seasonality_event_id=seasonality_event_id, + ) + + @staticmethod + def parse_bidding_seasonality_adjustment_path(path: str) -> Dict[str, str]: + """Parse a bidding_seasonality_adjustment path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/biddingSeasonalityAdjustments/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def bidding_strategy_path( customer_id: str, bidding_strategy_id: str, @@ -1137,6 +1173,44 @@ def parse_conversion_custom_variable_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def conversion_value_rule_path( + customer_id: str, conversion_value_rule_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule string.""" + return "customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}".format( + customer_id=customer_id, + conversion_value_rule_id=conversion_value_rule_id, + ) + + @staticmethod + def parse_conversion_value_rule_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/conversionValueRules/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def conversion_value_rule_set_path( + customer_id: str, conversion_value_rule_set_id: str, + ) -> str: + """Return a fully-qualified conversion_value_rule_set string.""" + return "customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}".format( + customer_id=customer_id, + conversion_value_rule_set_id=conversion_value_rule_set_id, + ) + + @staticmethod + def parse_conversion_value_rule_set_path(path: str) -> Dict[str, str]: + """Parse a conversion_value_rule_set path into its component segments.""" + m = re.match( + r"^customers/(?P.+?)/conversionValueRuleSets/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def currency_constant_path(code: str,) -> str: """Return a fully-qualified currency_constant string.""" diff --git a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/client.py b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/client.py index 8ecf360f8..483ad28ba 100644 --- a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/client.py +++ b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/client.py @@ -370,7 +370,7 @@ def suggest_smart_campaign_budget_options( Args: request (:class:`google.ads.googleads.v8.services.types.SuggestSmartCampaignBudgetOptionsRequest`): The request object. Request message for - [SmartCampaignBudgetSuggestService.SuggestSmartCampaignBudgets][]. + [SmartCampaignSuggestService.SuggestSmartCampaignBudgets][]. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -380,7 +380,7 @@ def suggest_smart_campaign_budget_options( Returns: google.ads.googleads.v8.services.types.SuggestSmartCampaignBudgetOptionsResponse: Response message for - [SmartCampaignBudgetSuggestService.SuggestSmartCampaignBudgets][]. + [SmartCampaignSuggestService.SuggestSmartCampaignBudgets][]. Depending on whether the system could suggest the options, either all of the options or none of them might be returned. @@ -421,5 +421,68 @@ def suggest_smart_campaign_budget_options( # Done; return the response. return response + def suggest_smart_campaign_ad( + self, + request: smart_campaign_suggest_service.SuggestSmartCampaignAdRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> smart_campaign_suggest_service.SuggestSmartCampaignAdResponse: + r"""Suggests a Smart campaign ad compatible with the Ad + family of resources, based on data points such as + targeting and the business to advertise. + + Args: + request (:class:`google.ads.googleads.v8.services.types.SuggestSmartCampaignAdRequest`): + The request object. Request message for + [SmartCampaignSuggestService.SuggestSmartCampaignAd][google.ads.googleads.v8.services.SmartCampaignSuggestService.SuggestSmartCampaignAd]. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.ads.googleads.v8.services.types.SuggestSmartCampaignAdResponse: + Response message for + [SmartCampaignSuggestService.SuggestSmartCampaignAd][google.ads.googleads.v8.services.SmartCampaignSuggestService.SuggestSmartCampaignAd]. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a smart_campaign_suggest_service.SuggestSmartCampaignAdRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, + smart_campaign_suggest_service.SuggestSmartCampaignAdRequest, + ): + request = smart_campaign_suggest_service.SuggestSmartCampaignAdRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.suggest_smart_campaign_ad + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("customer_id", request.customer_id),) + ), + ) + + # Send the request. + response = rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + # Done; return the response. + return response + __all__ = ("SmartCampaignSuggestServiceClient",) diff --git a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/base.py b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/base.py index 005f6ccef..3d30d63f1 100644 --- a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/base.py +++ b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/base.py @@ -86,6 +86,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.suggest_smart_campaign_ad: gapic_v1.method.wrap_method( + self.suggest_smart_campaign_ad, + default_timeout=None, + client_info=client_info, + ), } @property @@ -99,5 +104,14 @@ def suggest_smart_campaign_budget_options( ]: raise NotImplementedError + @property + def suggest_smart_campaign_ad( + self, + ) -> typing.Callable[ + [smart_campaign_suggest_service.SuggestSmartCampaignAdRequest], + smart_campaign_suggest_service.SuggestSmartCampaignAdResponse, + ]: + raise NotImplementedError + __all__ = ("SmartCampaignSuggestServiceTransport",) diff --git a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/grpc.py b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/grpc.py index 205ad6278..6b65ba952 100644 --- a/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/smart_campaign_suggest_service/transports/grpc.py @@ -246,5 +246,38 @@ def suggest_smart_campaign_budget_options( ) return self._stubs["suggest_smart_campaign_budget_options"] + @property + def suggest_smart_campaign_ad( + self, + ) -> Callable[ + [smart_campaign_suggest_service.SuggestSmartCampaignAdRequest], + smart_campaign_suggest_service.SuggestSmartCampaignAdResponse, + ]: + r"""Return a callable for the suggest smart campaign ad method over gRPC. + + Suggests a Smart campaign ad compatible with the Ad + family of resources, based on data points such as + targeting and the business to advertise. + + Returns: + Callable[[~.SuggestSmartCampaignAdRequest], + ~.SuggestSmartCampaignAdResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "suggest_smart_campaign_ad" not in self._stubs: + self._stubs[ + "suggest_smart_campaign_ad" + ] = self.grpc_channel.unary_unary( + "/google.ads.googleads.v8.services.SmartCampaignSuggestService/SuggestSmartCampaignAd", + request_serializer=smart_campaign_suggest_service.SuggestSmartCampaignAdRequest.serialize, + response_deserializer=smart_campaign_suggest_service.SuggestSmartCampaignAdResponse.deserialize, + ) + return self._stubs["suggest_smart_campaign_ad"] + __all__ = ("SmartCampaignSuggestServiceGrpcTransport",) diff --git a/google/ads/googleads/v8/services/services/user_data_service/client.py b/google/ads/googleads/v8/services/services/user_data_service/client.py index 9c05eca11..b13727329 100644 --- a/google/ads/googleads/v8/services/services/user_data_service/client.py +++ b/google/ads/googleads/v8/services/services/user_data_service/client.py @@ -69,9 +69,7 @@ def get_transport_class( class UserDataServiceClient(metaclass=UserDataServiceClientMeta): - """Service to manage user data uploads. - Accessible only to customers on the allow-list. - """ + """Service to manage user data uploads.""" @staticmethod def _get_default_mtls_endpoint(api_endpoint): diff --git a/google/ads/googleads/v8/services/services/user_data_service/transports/grpc.py b/google/ads/googleads/v8/services/services/user_data_service/transports/grpc.py index aeb12ad1a..ece9d391e 100644 --- a/google/ads/googleads/v8/services/services/user_data_service/transports/grpc.py +++ b/google/ads/googleads/v8/services/services/user_data_service/transports/grpc.py @@ -32,7 +32,6 @@ class UserDataServiceGrpcTransport(UserDataServiceTransport): """gRPC backend transport for UserDataService. Service to manage user data uploads. - Accessible only to customers on the allow-list. This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation diff --git a/google/ads/googleads/v6/services/types/extension_feed_item_service.py b/google/ads/googleads/v8/services/types/bidding_data_exclusion_service.py similarity index 50% rename from google/ads/googleads/v6/services/types/extension_feed_item_service.py rename to google/ads/googleads/v8/services/types/bidding_data_exclusion_service.py index 0148ae4a7..9ea36bfc2 100644 --- a/google/ads/googleads/v6/services/types/extension_feed_item_service.py +++ b/google/ads/googleads/v8/services/types/bidding_data_exclusion_service.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- - # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,57 +13,55 @@ # See the License for the specific language governing permissions and # limitations under the License. # - import proto # type: ignore - -from google.ads.googleads.v6.enums.types import ( +from google.ads.googleads.v8.enums.types import ( response_content_type as gage_response_content_type, ) -from google.ads.googleads.v6.resources.types import ( - extension_feed_item as gagr_extension_feed_item, +from google.ads.googleads.v8.resources.types import ( + bidding_data_exclusion as gagr_bidding_data_exclusion, ) -from google.protobuf import field_mask_pb2 as field_mask # type: ignore -from google.rpc import status_pb2 as status # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore __protobuf__ = proto.module( - package="google.ads.googleads.v6.services", - marshal="google.ads.googleads.v6", + package="google.ads.googleads.v8.services", + marshal="google.ads.googleads.v8", manifest={ - "GetExtensionFeedItemRequest", - "MutateExtensionFeedItemsRequest", - "ExtensionFeedItemOperation", - "MutateExtensionFeedItemsResponse", - "MutateExtensionFeedItemResult", + "GetBiddingDataExclusionRequest", + "MutateBiddingDataExclusionsRequest", + "BiddingDataExclusionOperation", + "MutateBiddingDataExclusionsResponse", + "MutateBiddingDataExclusionsResult", }, ) -class GetExtensionFeedItemRequest(proto.Message): +class GetBiddingDataExclusionRequest(proto.Message): r"""Request message for - [ExtensionFeedItemService.GetExtensionFeedItem][google.ads.googleads.v6.services.ExtensionFeedItemService.GetExtensionFeedItem]. + [BiddingDataExclusionService.GetBiddingDataExclusion][google.ads.googleads.v8.services.BiddingDataExclusionService.GetBiddingDataExclusion]. Attributes: resource_name (str): - Required. The resource name of the extension - feed item to fetch. + Required. The resource name of the data + exclusion to fetch. """ - resource_name = proto.Field(proto.STRING, number=1) + resource_name = proto.Field(proto.STRING, number=1,) -class MutateExtensionFeedItemsRequest(proto.Message): +class MutateBiddingDataExclusionsRequest(proto.Message): r"""Request message for - [ExtensionFeedItemService.MutateExtensionFeedItems][google.ads.googleads.v6.services.ExtensionFeedItemService.MutateExtensionFeedItems]. + [BiddingDataExclusionService.MutateBiddingDataExclusions][google.ads.googleads.v8.services.BiddingDataExclusionService.MutateBiddingDataExclusions]. Attributes: customer_id (str): - Required. The ID of the customer whose - extension feed items are being modified. - operations (Sequence[google.ads.googleads.v6.services.types.ExtensionFeedItemOperation]): + Required. ID of the customer whose data + exclusions are being modified. + operations (Sequence[google.ads.googleads.v8.services.types.BiddingDataExclusionOperation]): Required. The list of operations to perform - on individual extension feed items. + on individual data exclusions. partial_failure (bool): If true, successful operations will be carried out and invalid operations will return @@ -74,18 +71,18 @@ class MutateExtensionFeedItemsRequest(proto.Message): validate_only (bool): If true, the request is validated but not executed. Only errors are returned, not results. - response_content_type (google.ads.googleads.v6.enums.types.ResponseContentTypeEnum.ResponseContentType): + response_content_type (google.ads.googleads.v8.enums.types.ResponseContentTypeEnum.ResponseContentType): The response content type setting. Determines whether the mutable resource or just the resource name should be returned post mutation. """ - customer_id = proto.Field(proto.STRING, number=1) + customer_id = proto.Field(proto.STRING, number=1,) operations = proto.RepeatedField( - proto.MESSAGE, number=2, message="ExtensionFeedItemOperation", + proto.MESSAGE, number=2, message="BiddingDataExclusionOperation", ) - partial_failure = proto.Field(proto.BOOL, number=3) - validate_only = proto.Field(proto.BOOL, number=4) + partial_failure = proto.Field(proto.BOOL, number=3,) + validate_only = proto.Field(proto.BOOL, number=4,) response_content_type = proto.Field( proto.ENUM, number=5, @@ -93,48 +90,47 @@ class MutateExtensionFeedItemsRequest(proto.Message): ) -class ExtensionFeedItemOperation(proto.Message): - r"""A single operation (create, update, remove) on an extension - feed item. +class BiddingDataExclusionOperation(proto.Message): + r"""A single operation (create, remove, update) on a data + exclusion. Attributes: update_mask (google.protobuf.field_mask_pb2.FieldMask): FieldMask that determines which resource fields are modified in an update. - create (google.ads.googleads.v6.resources.types.ExtensionFeedItem): + create (google.ads.googleads.v8.resources.types.BiddingDataExclusion): Create operation: No resource name is - expected for the new extension feed item. - update (google.ads.googleads.v6.resources.types.ExtensionFeedItem): - Update operation: The extension feed item is + expected for the new data exclusion. + update (google.ads.googleads.v8.resources.types.BiddingDataExclusion): + Update operation: The data exclusion is expected to have a valid resource name. remove (str): - Remove operation: A resource name for the removed extension - feed item is expected, in this format: + Remove operation: A resource name for the removed data + exclusion is expected, in this format: - ``customers/{customer_id}/extensionFeedItems/{feed_item_id}`` + ``customers/{customer_id}/biddingDataExclusions/{data_exclusion_id}`` """ update_mask = proto.Field( - proto.MESSAGE, number=4, message=field_mask.FieldMask, + proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, ) create = proto.Field( proto.MESSAGE, number=1, oneof="operation", - message=gagr_extension_feed_item.ExtensionFeedItem, + message=gagr_bidding_data_exclusion.BiddingDataExclusion, ) update = proto.Field( proto.MESSAGE, number=2, oneof="operation", - message=gagr_extension_feed_item.ExtensionFeedItem, + message=gagr_bidding_data_exclusion.BiddingDataExclusion, ) - remove = proto.Field(proto.STRING, number=3, oneof="operation") + remove = proto.Field(proto.STRING, number=3, oneof="operation",) -class MutateExtensionFeedItemsResponse(proto.Message): - r"""Response message for an extension feed item mutate. - +class MutateBiddingDataExclusionsResponse(proto.Message): + r"""Response message for data exlusions mutate. Attributes: partial_failure_error (google.rpc.status_pb2.Status): Errors that pertain to operation failures in the partial @@ -142,35 +138,34 @@ class MutateExtensionFeedItemsResponse(proto.Message): all errors occur inside the operations. If any errors occur outside the operations (e.g. auth errors), we return an RPC level error. - results (Sequence[google.ads.googleads.v6.services.types.MutateExtensionFeedItemResult]): + results (Sequence[google.ads.googleads.v8.services.types.MutateBiddingDataExclusionsResult]): All results for the mutate. """ partial_failure_error = proto.Field( - proto.MESSAGE, number=3, message=status.Status, + proto.MESSAGE, number=3, message=status_pb2.Status, ) results = proto.RepeatedField( - proto.MESSAGE, number=2, message="MutateExtensionFeedItemResult", + proto.MESSAGE, number=2, message="MutateBiddingDataExclusionsResult", ) -class MutateExtensionFeedItemResult(proto.Message): - r"""The result for the extension feed item mutate. - +class MutateBiddingDataExclusionsResult(proto.Message): + r"""The result for the data exclusion mutate. Attributes: resource_name (str): Returned for successful operations. - extension_feed_item (google.ads.googleads.v6.resources.types.ExtensionFeedItem): - The mutated extension feed item with only mutable fields + bidding_data_exclusion (google.ads.googleads.v8.resources.types.BiddingDataExclusion): + The mutated bidding data exclusion with only mutable fields after mutate. The field will only be returned when response_content_type is set to "MUTABLE_RESOURCE". """ - resource_name = proto.Field(proto.STRING, number=1) - extension_feed_item = proto.Field( + resource_name = proto.Field(proto.STRING, number=1,) + bidding_data_exclusion = proto.Field( proto.MESSAGE, number=2, - message=gagr_extension_feed_item.ExtensionFeedItem, + message=gagr_bidding_data_exclusion.BiddingDataExclusion, ) diff --git a/google/ads/googleads/v8/services/types/bidding_seasonality_adjustment_service.py b/google/ads/googleads/v8/services/types/bidding_seasonality_adjustment_service.py new file mode 100644 index 000000000..f8a353c81 --- /dev/null +++ b/google/ads/googleads/v8/services/types/bidding_seasonality_adjustment_service.py @@ -0,0 +1,176 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import ( + response_content_type as gage_response_content_type, +) +from google.ads.googleads.v8.resources.types import ( + bidding_seasonality_adjustment as gagr_bidding_seasonality_adjustment, +) +from google.protobuf import field_mask_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.services", + marshal="google.ads.googleads.v8", + manifest={ + "GetBiddingSeasonalityAdjustmentRequest", + "MutateBiddingSeasonalityAdjustmentsRequest", + "BiddingSeasonalityAdjustmentOperation", + "MutateBiddingSeasonalityAdjustmentsResponse", + "MutateBiddingSeasonalityAdjustmentsResult", + }, +) + + +class GetBiddingSeasonalityAdjustmentRequest(proto.Message): + r"""Request message for + [BiddingSeasonalityAdjustmentService.GetBiddingSeasonalityAdjustment][google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService.GetBiddingSeasonalityAdjustment]. + + Attributes: + resource_name (str): + Required. The resource name of the + seasonality adjustment to fetch. + """ + + resource_name = proto.Field(proto.STRING, number=1,) + + +class MutateBiddingSeasonalityAdjustmentsRequest(proto.Message): + r"""Request message for + [BiddingSeasonalityAdjustmentService.MutateBiddingSeasonalityAdjustments][google.ads.googleads.v8.services.BiddingSeasonalityAdjustmentService.MutateBiddingSeasonalityAdjustments]. + + Attributes: + customer_id (str): + Required. ID of the customer whose + seasonality adjustments are being modified. + operations (Sequence[google.ads.googleads.v8.services.types.BiddingSeasonalityAdjustmentOperation]): + Required. The list of operations to perform + on individual seasonality adjustments. + partial_failure (bool): + If true, successful operations will be + carried out and invalid operations will return + errors. If false, all operations will be carried + out in one transaction if and only if they are + all valid. Default is false. + validate_only (bool): + If true, the request is validated but not + executed. Only errors are returned, not results. + response_content_type (google.ads.googleads.v8.enums.types.ResponseContentTypeEnum.ResponseContentType): + The response content type setting. Determines + whether the mutable resource or just the + resource name should be returned post mutation. + """ + + customer_id = proto.Field(proto.STRING, number=1,) + operations = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="BiddingSeasonalityAdjustmentOperation", + ) + partial_failure = proto.Field(proto.BOOL, number=3,) + validate_only = proto.Field(proto.BOOL, number=4,) + response_content_type = proto.Field( + proto.ENUM, + number=5, + enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, + ) + + +class BiddingSeasonalityAdjustmentOperation(proto.Message): + r"""A single operation (create, remove, update) on a seasonality + adjustment. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + FieldMask that determines which resource + fields are modified in an update. + create (google.ads.googleads.v8.resources.types.BiddingSeasonalityAdjustment): + Create operation: No resource name is + expected for the new seasonality adjustment. + update (google.ads.googleads.v8.resources.types.BiddingSeasonalityAdjustment): + Update operation: The seasonality adjustment + is expected to have a valid resource name. + remove (str): + Remove operation: A resource name for the removed + seasonality adjustment is expected, in this format: + + ``customers/{customer_id}/biddingSeasonalityAdjustments/{seasonality_adjustment_id}`` + """ + + update_mask = proto.Field( + proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, + ) + create = proto.Field( + proto.MESSAGE, + number=1, + oneof="operation", + message=gagr_bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, + ) + update = proto.Field( + proto.MESSAGE, + number=2, + oneof="operation", + message=gagr_bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, + ) + remove = proto.Field(proto.STRING, number=3, oneof="operation",) + + +class MutateBiddingSeasonalityAdjustmentsResponse(proto.Message): + r"""Response message for seasonality adjustments mutate. + Attributes: + partial_failure_error (google.rpc.status_pb2.Status): + Errors that pertain to operation failures in the partial + failure mode. Returned only when partial_failure = true and + all errors occur inside the operations. If any errors occur + outside the operations (e.g. auth errors), we return an RPC + level error. + results (Sequence[google.ads.googleads.v8.services.types.MutateBiddingSeasonalityAdjustmentsResult]): + All results for the mutate. + """ + + partial_failure_error = proto.Field( + proto.MESSAGE, number=3, message=status_pb2.Status, + ) + results = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="MutateBiddingSeasonalityAdjustmentsResult", + ) + + +class MutateBiddingSeasonalityAdjustmentsResult(proto.Message): + r"""The result for the seasonality adjustment mutate. + Attributes: + resource_name (str): + Returned for successful operations. + bidding_seasonality_adjustment (google.ads.googleads.v8.resources.types.BiddingSeasonalityAdjustment): + The mutated bidding seasonality adjustment with only mutable + fields after mutate. The field will only be returned when + response_content_type is set to "MUTABLE_RESOURCE". + """ + + resource_name = proto.Field(proto.STRING, number=1,) + bidding_seasonality_adjustment = proto.Field( + proto.MESSAGE, + number=2, + message=gagr_bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/services/types/conversion_adjustment_upload_service.py b/google/ads/googleads/v8/services/types/conversion_adjustment_upload_service.py index 4aa0f5c12..14299f0a0 100644 --- a/google/ads/googleads/v8/services/types/conversion_adjustment_upload_service.py +++ b/google/ads/googleads/v8/services/types/conversion_adjustment_upload_service.py @@ -15,6 +15,7 @@ # import proto # type: ignore +from google.ads.googleads.v8.common.types import offline_user_data from google.ads.googleads.v8.enums.types import conversion_adjustment_type from google.rpc import status_pb2 # type: ignore @@ -125,6 +126,18 @@ class ConversionAdjustment(proto.Message): new, more recent, adjustment occurrence time. Otherwise, it will be treated as a duplicate of the previous restatement and ignored. + user_identifiers (Sequence[google.ads.googleads.v8.common.types.UserIdentifier]): + The user identifiers to enhance the original + conversion. ConversionAdjustmentUploadService + only accepts user identifiers in enhancements. + The maximum number of user identifiers for each + enhancement is 5. + user_agent (str): + The user agent to enhance the original conversion. This can + be found in your user's HTTP request header when they + convert on your web page. Example, "Mozilla/5.0 (iPhone; CPU + iPhone OS 12_2 like Mac OS X)". User agent can only be + specified in enhancements with user identifiers. gclid_date_time_pair (google.ads.googleads.v8.services.types.GclidDateTimePair): Uniquely identifies a conversion that was reported without an order ID specified. @@ -132,7 +145,8 @@ class ConversionAdjustment(proto.Message): The order ID of the conversion to be adjusted. If the conversion was reported with an order ID specified, that order ID must be used - as the identifier here. + as the identifier here. The order ID is required + for enhancements. """ conversion_action = proto.Field(proto.STRING, number=8, optional=True,) @@ -145,6 +159,10 @@ class ConversionAdjustment(proto.Message): restatement_value = proto.Field( proto.MESSAGE, number=6, message="RestatementValue", ) + user_identifiers = proto.RepeatedField( + proto.MESSAGE, number=10, message=offline_user_data.UserIdentifier, + ) + user_agent = proto.Field(proto.STRING, number=11, optional=True,) gclid_date_time_pair = proto.Field( proto.MESSAGE, number=1, diff --git a/google/ads/googleads/v8/services/types/conversion_upload_service.py b/google/ads/googleads/v8/services/types/conversion_upload_service.py index 03363a5ad..da33c5614 100644 --- a/google/ads/googleads/v8/services/types/conversion_upload_service.py +++ b/google/ads/googleads/v8/services/types/conversion_upload_service.py @@ -15,6 +15,7 @@ # import proto # type: ignore +from google.ads.googleads.v8.common.types import offline_user_data from google.rpc import status_pb2 # type: ignore @@ -204,6 +205,11 @@ class ClickConversion(proto.Message): cart_data (google.ads.googleads.v8.services.types.CartData): The cart data associated with this conversion. + user_identifiers (Sequence[google.ads.googleads.v8.common.types.UserIdentifier]): + The user identifiers associated with this conversion. Only + hashed_email and hashed_phone_number are supported for + conversion uploads. The maximum number of user identifiers + for each conversion is 5. """ gclid = proto.Field(proto.STRING, number=9, optional=True,) @@ -219,6 +225,9 @@ class ClickConversion(proto.Message): proto.MESSAGE, number=15, message="CustomVariable", ) cart_data = proto.Field(proto.MESSAGE, number=16, message="CartData",) + user_identifiers = proto.RepeatedField( + proto.MESSAGE, number=17, message=offline_user_data.UserIdentifier, + ) class CallConversion(proto.Message): @@ -303,11 +312,19 @@ class ClickConversionResult(proto.Message): The date time at which the conversion occurred. The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. “2019-01-01 12:32:45-08:00”. + user_identifiers (Sequence[google.ads.googleads.v8.common.types.UserIdentifier]): + The user identifiers associated with this conversion. Only + hashed_email and hashed_phone_number are supported for + conversion uploads. The maximum number of user identifiers + for each conversion is 5. """ gclid = proto.Field(proto.STRING, number=4, optional=True,) conversion_action = proto.Field(proto.STRING, number=5, optional=True,) conversion_date_time = proto.Field(proto.STRING, number=6, optional=True,) + user_identifiers = proto.RepeatedField( + proto.MESSAGE, number=7, message=offline_user_data.UserIdentifier, + ) class CallConversionResult(proto.Message): diff --git a/google/ads/googleads/v8/services/types/conversion_value_rule_service.py b/google/ads/googleads/v8/services/types/conversion_value_rule_service.py new file mode 100644 index 000000000..475b0c44e --- /dev/null +++ b/google/ads/googleads/v8/services/types/conversion_value_rule_service.py @@ -0,0 +1,174 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import ( + response_content_type as gage_response_content_type, +) +from google.ads.googleads.v8.resources.types import ( + conversion_value_rule as gagr_conversion_value_rule, +) +from google.protobuf import field_mask_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.services", + marshal="google.ads.googleads.v8", + manifest={ + "GetConversionValueRuleRequest", + "MutateConversionValueRulesRequest", + "ConversionValueRuleOperation", + "MutateConversionValueRulesResponse", + "MutateConversionValueRuleResult", + }, +) + + +class GetConversionValueRuleRequest(proto.Message): + r"""Request message for + [ConversionValueRuleService.GetConversionValueRule][google.ads.googleads.v8.services.ConversionValueRuleService.GetConversionValueRule]. + + Attributes: + resource_name (str): + Required. The resource name of the conversion + value rule to fetch. + """ + + resource_name = proto.Field(proto.STRING, number=1,) + + +class MutateConversionValueRulesRequest(proto.Message): + r"""Request message for + [ConversionValueRuleService.MutateConversionValueRules][google.ads.googleads.v8.services.ConversionValueRuleService.MutateConversionValueRules]. + + Attributes: + customer_id (str): + Required. The ID of the customer whose + conversion value rules are being modified. + operations (Sequence[google.ads.googleads.v8.services.types.ConversionValueRuleOperation]): + Required. The list of operations to perform + on individual conversion value rules. + partial_failure (bool): + If true, successful operations will be + carried out and invalid operations will return + errors. If false, all operations will be carried + out in one transaction if and only if they are + all valid. Default is false. + validate_only (bool): + If true, the request is validated but not + executed. Only errors are returned, not results. + response_content_type (google.ads.googleads.v8.enums.types.ResponseContentTypeEnum.ResponseContentType): + The response content type setting. Determines + whether the mutable resource or just the + resource name should be returned post mutation. + """ + + customer_id = proto.Field(proto.STRING, number=1,) + operations = proto.RepeatedField( + proto.MESSAGE, number=2, message="ConversionValueRuleOperation", + ) + partial_failure = proto.Field(proto.BOOL, number=5,) + validate_only = proto.Field(proto.BOOL, number=3,) + response_content_type = proto.Field( + proto.ENUM, + number=4, + enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, + ) + + +class ConversionValueRuleOperation(proto.Message): + r"""A single operation (create, update, remove) on a conversion + value rule. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + FieldMask that determines which resource + fields are modified in an update. + create (google.ads.googleads.v8.resources.types.ConversionValueRule): + Create operation: No resource name is + expected for the new conversion value rule. + update (google.ads.googleads.v8.resources.types.ConversionValueRule): + Update operation: The conversion action is + expected to have a valid resource name. + remove (str): + Remove operation: A resource name for the removed conversion + action is expected, in this format: + + ``customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}`` + """ + + update_mask = proto.Field( + proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, + ) + create = proto.Field( + proto.MESSAGE, + number=1, + oneof="operation", + message=gagr_conversion_value_rule.ConversionValueRule, + ) + update = proto.Field( + proto.MESSAGE, + number=2, + oneof="operation", + message=gagr_conversion_value_rule.ConversionValueRule, + ) + remove = proto.Field(proto.STRING, number=3, oneof="operation",) + + +class MutateConversionValueRulesResponse(proto.Message): + r"""Response message for + [ConversionValueRuleService.MutateConversionValueRules][google.ads.googleads.v8.services.ConversionValueRuleService.MutateConversionValueRules]. + + Attributes: + results (Sequence[google.ads.googleads.v8.services.types.MutateConversionValueRuleResult]): + All results for the mutate. + partial_failure_error (google.rpc.status_pb2.Status): + Errors that pertain to operation failures in the partial + failure mode. Returned only when partial_failure = true and + all errors occur inside the operations. If any errors occur + outside the operations (e.g. auth errors), we return an RPC + level error. + """ + + results = proto.RepeatedField( + proto.MESSAGE, number=2, message="MutateConversionValueRuleResult", + ) + partial_failure_error = proto.Field( + proto.MESSAGE, number=3, message=status_pb2.Status, + ) + + +class MutateConversionValueRuleResult(proto.Message): + r"""The result for the conversion value rule mutate. + Attributes: + resource_name (str): + Returned for successful operations. + conversion_value_rule (google.ads.googleads.v8.resources.types.ConversionValueRule): + The mutated conversion value rule with only mutable fields + after mutate. The field will only be returned when + response_content_type is set to "MUTABLE_RESOURCE". + """ + + resource_name = proto.Field(proto.STRING, number=1,) + conversion_value_rule = proto.Field( + proto.MESSAGE, + number=2, + message=gagr_conversion_value_rule.ConversionValueRule, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/services/types/conversion_value_rule_set_service.py b/google/ads/googleads/v8/services/types/conversion_value_rule_set_service.py new file mode 100644 index 000000000..5db0fd992 --- /dev/null +++ b/google/ads/googleads/v8/services/types/conversion_value_rule_set_service.py @@ -0,0 +1,174 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 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. +# +import proto # type: ignore + +from google.ads.googleads.v8.enums.types import ( + response_content_type as gage_response_content_type, +) +from google.ads.googleads.v8.resources.types import ( + conversion_value_rule_set as gagr_conversion_value_rule_set, +) +from google.protobuf import field_mask_pb2 # type: ignore +from google.rpc import status_pb2 # type: ignore + + +__protobuf__ = proto.module( + package="google.ads.googleads.v8.services", + marshal="google.ads.googleads.v8", + manifest={ + "GetConversionValueRuleSetRequest", + "MutateConversionValueRuleSetsRequest", + "ConversionValueRuleSetOperation", + "MutateConversionValueRuleSetsResponse", + "MutateConversionValueRuleSetResult", + }, +) + + +class GetConversionValueRuleSetRequest(proto.Message): + r"""Request message for + [ConversionValueRuleSetService.GetConversionValueRuleSet][google.ads.googleads.v8.services.ConversionValueRuleSetService.GetConversionValueRuleSet]. + + Attributes: + resource_name (str): + Required. The resource name of the conversion + value rule set to fetch. + """ + + resource_name = proto.Field(proto.STRING, number=1,) + + +class MutateConversionValueRuleSetsRequest(proto.Message): + r"""Request message for + [ConversionValueRuleSetService.MutateConversionValueRuleSets][google.ads.googleads.v8.services.ConversionValueRuleSetService.MutateConversionValueRuleSets]. + + Attributes: + customer_id (str): + Required. The ID of the customer whose + conversion value rule sets are being modified. + operations (Sequence[google.ads.googleads.v8.services.types.ConversionValueRuleSetOperation]): + Required. The list of operations to perform + on individual conversion value rule sets. + partial_failure (bool): + If true, successful operations will be + carried out and invalid operations will return + errors. If false, all operations will be carried + out in one transaction if and only if they are + all valid. Default is false. + validate_only (bool): + If true, the request is validated but not + executed. Only errors are returned, not results. + response_content_type (google.ads.googleads.v8.enums.types.ResponseContentTypeEnum.ResponseContentType): + The response content type setting. Determines + whether the mutable resource or just the + resource name should be returned post mutation. + """ + + customer_id = proto.Field(proto.STRING, number=1,) + operations = proto.RepeatedField( + proto.MESSAGE, number=2, message="ConversionValueRuleSetOperation", + ) + partial_failure = proto.Field(proto.BOOL, number=5,) + validate_only = proto.Field(proto.BOOL, number=3,) + response_content_type = proto.Field( + proto.ENUM, + number=4, + enum=gage_response_content_type.ResponseContentTypeEnum.ResponseContentType, + ) + + +class ConversionValueRuleSetOperation(proto.Message): + r"""A single operation (create, update, remove) on a conversion + value rule set. + + Attributes: + update_mask (google.protobuf.field_mask_pb2.FieldMask): + FieldMask that determines which resource + fields are modified in an update. + create (google.ads.googleads.v8.resources.types.ConversionValueRuleSet): + Create operation: No resource name is + expected for the new conversion value rule set. + update (google.ads.googleads.v8.resources.types.ConversionValueRuleSet): + Update operation: The conversion action is + expected to have a valid resource name. + remove (str): + Remove operation: A resource name for the removed conversion + action is expected, in this format: + + ``customers/{customer_id}/conversionValueRuleSets/{conversion_value_rule_set_id}`` + """ + + update_mask = proto.Field( + proto.MESSAGE, number=4, message=field_mask_pb2.FieldMask, + ) + create = proto.Field( + proto.MESSAGE, + number=1, + oneof="operation", + message=gagr_conversion_value_rule_set.ConversionValueRuleSet, + ) + update = proto.Field( + proto.MESSAGE, + number=2, + oneof="operation", + message=gagr_conversion_value_rule_set.ConversionValueRuleSet, + ) + remove = proto.Field(proto.STRING, number=3, oneof="operation",) + + +class MutateConversionValueRuleSetsResponse(proto.Message): + r"""Response message for + [ConversionValueRuleSetService.MutateConversionValueRuleSets][google.ads.googleads.v8.services.ConversionValueRuleSetService.MutateConversionValueRuleSets]. + + Attributes: + results (Sequence[google.ads.googleads.v8.services.types.MutateConversionValueRuleSetResult]): + All results for the mutate. + partial_failure_error (google.rpc.status_pb2.Status): + Errors that pertain to operation failures in the partial + failure mode. Returned only when partial_failure = true and + all errors occur inside the operations. If any errors occur + outside the operations (e.g. auth errors), we return an RPC + level error. + """ + + results = proto.RepeatedField( + proto.MESSAGE, number=1, message="MutateConversionValueRuleSetResult", + ) + partial_failure_error = proto.Field( + proto.MESSAGE, number=2, message=status_pb2.Status, + ) + + +class MutateConversionValueRuleSetResult(proto.Message): + r"""The result for the conversion value rule set mutate. + Attributes: + resource_name (str): + Returned for successful operations. + conversion_value_rule_set (google.ads.googleads.v8.resources.types.ConversionValueRuleSet): + The mutated conversion value rule set with only mutable + fields after mutate. The field will only be returned when + response_content_type is set to "MUTABLE_RESOURCE". + """ + + resource_name = proto.Field(proto.STRING, number=1,) + conversion_value_rule_set = proto.Field( + proto.MESSAGE, + number=2, + message=gagr_conversion_value_rule_set.ConversionValueRuleSet, + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/services/types/google_ads_service.py b/google/ads/googleads/v8/services/types/google_ads_service.py index 55a9758f5..9e3a06427 100644 --- a/google/ads/googleads/v8/services/types/google_ads_service.py +++ b/google/ads/googleads/v8/services/types/google_ads_service.py @@ -89,6 +89,12 @@ asset_field_type_view as gagr_asset_field_type_view, ) from google.ads.googleads.v8.resources.types import batch_job as gagr_batch_job +from google.ads.googleads.v8.resources.types import ( + bidding_data_exclusion as gagr_bidding_data_exclusion, +) +from google.ads.googleads.v8.resources.types import ( + bidding_seasonality_adjustment as gagr_bidding_seasonality_adjustment, +) from google.ads.googleads.v8.resources.types import ( bidding_strategy as gagr_bidding_strategy, ) @@ -160,6 +166,12 @@ from google.ads.googleads.v8.resources.types import ( conversion_custom_variable as gagr_conversion_custom_variable, ) +from google.ads.googleads.v8.resources.types import ( + conversion_value_rule as gagr_conversion_value_rule, +) +from google.ads.googleads.v8.resources.types import ( + conversion_value_rule_set as gagr_conversion_value_rule_set, +) from google.ads.googleads.v8.resources.types import ( currency_constant as gagr_currency_constant, ) @@ -387,6 +399,12 @@ from google.ads.googleads.v8.services.types import ad_parameter_service from google.ads.googleads.v8.services.types import ad_service from google.ads.googleads.v8.services.types import asset_service +from google.ads.googleads.v8.services.types import ( + bidding_data_exclusion_service, +) +from google.ads.googleads.v8.services.types import ( + bidding_seasonality_adjustment_service, +) from google.ads.googleads.v8.services.types import bidding_strategy_service from google.ads.googleads.v8.services.types import campaign_asset_service from google.ads.googleads.v8.services.types import campaign_bid_modifier_service @@ -405,6 +423,10 @@ from google.ads.googleads.v8.services.types import ( conversion_custom_variable_service, ) +from google.ads.googleads.v8.services.types import conversion_value_rule_service +from google.ads.googleads.v8.services.types import ( + conversion_value_rule_set_service, +) from google.ads.googleads.v8.services.types import customer_asset_service from google.ads.googleads.v8.services.types import ( customer_extension_setting_service, @@ -665,6 +687,12 @@ class GoogleAdsRow(proto.Message): query. batch_job (google.ads.googleads.v8.resources.types.BatchJob): The batch job referenced in the query. + bidding_data_exclusion (google.ads.googleads.v8.resources.types.BiddingDataExclusion): + The bidding data exclusion referenced in the + query. + bidding_seasonality_adjustment (google.ads.googleads.v8.resources.types.BiddingSeasonalityAdjustment): + The bidding seasonality adjustment referenced + in the query. bidding_strategy (google.ads.googleads.v8.resources.types.BiddingStrategy): The bidding strategy referenced in the query. bidding_strategy_simulation (google.ads.googleads.v8.resources.types.BiddingStrategySimulation): @@ -723,6 +751,12 @@ class GoogleAdsRow(proto.Message): conversion_custom_variable (google.ads.googleads.v8.resources.types.ConversionCustomVariable): The conversion custom variable referenced in the query. + conversion_value_rule (google.ads.googleads.v8.resources.types.ConversionValueRule): + The conversion value rule referenced in the + query. + conversion_value_rule_set (google.ads.googleads.v8.resources.types.ConversionValueRuleSet): + The conversion value rule set referenced in + the query. click_view (google.ads.googleads.v8.resources.types.ClickView): The ClickView referenced in the query. currency_constant (google.ads.googleads.v8.resources.types.CurrencyConstant): @@ -1012,6 +1046,16 @@ class GoogleAdsRow(proto.Message): batch_job = proto.Field( proto.MESSAGE, number=139, message=gagr_batch_job.BatchJob, ) + bidding_data_exclusion = proto.Field( + proto.MESSAGE, + number=159, + message=gagr_bidding_data_exclusion.BiddingDataExclusion, + ) + bidding_seasonality_adjustment = proto.Field( + proto.MESSAGE, + number=160, + message=gagr_bidding_seasonality_adjustment.BiddingSeasonalityAdjustment, + ) bidding_strategy = proto.Field( proto.MESSAGE, number=18, message=gagr_bidding_strategy.BiddingStrategy, ) @@ -1108,6 +1152,16 @@ class GoogleAdsRow(proto.Message): number=153, message=gagr_conversion_custom_variable.ConversionCustomVariable, ) + conversion_value_rule = proto.Field( + proto.MESSAGE, + number=164, + message=gagr_conversion_value_rule.ConversionValueRule, + ) + conversion_value_rule_set = proto.Field( + proto.MESSAGE, + number=165, + message=gagr_conversion_value_rule_set.ConversionValueRuleSet, + ) click_view = proto.Field( proto.MESSAGE, number=122, message=gagr_click_view.ClickView, ) @@ -1514,6 +1568,11 @@ class MutateOperation(proto.Message): An ad parameter mutate operation. asset_operation (google.ads.googleads.v8.services.types.AssetOperation): An asset mutate operation. + bidding_data_exclusion_operation (google.ads.googleads.v8.services.types.BiddingDataExclusionOperation): + A bidding data exclusion mutate operation. + bidding_seasonality_adjustment_operation (google.ads.googleads.v8.services.types.BiddingSeasonalityAdjustmentOperation): + A bidding seasonality adjustment mutate + operation. bidding_strategy_operation (google.ads.googleads.v8.services.types.BiddingStrategyOperation): A bidding strategy mutate operation. campaign_asset_operation (google.ads.googleads.v8.services.types.CampaignAssetOperation): @@ -1544,6 +1603,10 @@ class MutateOperation(proto.Message): conversion_custom_variable_operation (google.ads.googleads.v8.services.types.ConversionCustomVariableOperation): A conversion custom variable mutate operation. + conversion_value_rule_operation (google.ads.googleads.v8.services.types.ConversionValueRuleOperation): + A conversion value rule mutate operation. + conversion_value_rule_set_operation (google.ads.googleads.v8.services.types.ConversionValueRuleSetOperation): + A conversion value rule set mutate operation. customer_asset_operation (google.ads.googleads.v8.services.types.CustomerAssetOperation): A customer asset mutate operation. customer_extension_setting_operation (google.ads.googleads.v8.services.types.CustomerExtensionSettingOperation): @@ -1676,6 +1739,18 @@ class MutateOperation(proto.Message): oneof="operation", message=asset_service.AssetOperation, ) + bidding_data_exclusion_operation = proto.Field( + proto.MESSAGE, + number=58, + oneof="operation", + message=bidding_data_exclusion_service.BiddingDataExclusionOperation, + ) + bidding_seasonality_adjustment_operation = proto.Field( + proto.MESSAGE, + number=59, + oneof="operation", + message=bidding_seasonality_adjustment_service.BiddingSeasonalityAdjustmentOperation, + ) bidding_strategy_operation = proto.Field( proto.MESSAGE, number=6, @@ -1760,6 +1835,18 @@ class MutateOperation(proto.Message): oneof="operation", message=conversion_custom_variable_service.ConversionCustomVariableOperation, ) + conversion_value_rule_operation = proto.Field( + proto.MESSAGE, + number=63, + oneof="operation", + message=conversion_value_rule_service.ConversionValueRuleOperation, + ) + conversion_value_rule_set_operation = proto.Field( + proto.MESSAGE, + number=64, + oneof="operation", + message=conversion_value_rule_set_service.ConversionValueRuleSetOperation, + ) customer_asset_operation = proto.Field( proto.MESSAGE, number=57, @@ -1944,6 +2031,12 @@ class MutateOperationResponse(proto.Message): The result for the ad mutate. asset_result (google.ads.googleads.v8.services.types.MutateAssetResult): The result for the asset mutate. + bidding_data_exclusion_result (google.ads.googleads.v8.services.types.MutateBiddingDataExclusionsResult): + The result for the bidding data exclusion + mutate. + bidding_seasonality_adjustment_result (google.ads.googleads.v8.services.types.MutateBiddingSeasonalityAdjustmentsResult): + The result for the bidding seasonality + adjustment mutate. bidding_strategy_result (google.ads.googleads.v8.services.types.MutateBiddingStrategyResult): The result for the bidding strategy mutate. campaign_asset_result (google.ads.googleads.v8.services.types.MutateCampaignAssetResult): @@ -1977,6 +2070,12 @@ class MutateOperationResponse(proto.Message): conversion_custom_variable_result (google.ads.googleads.v8.services.types.MutateConversionCustomVariableResult): The result for the conversion custom variable mutate. + conversion_value_rule_result (google.ads.googleads.v8.services.types.MutateConversionValueRuleResult): + The result for the conversion value rule + mutate. + conversion_value_rule_set_result (google.ads.googleads.v8.services.types.MutateConversionValueRuleSetResult): + The result for the conversion value rule set + mutate. customer_asset_result (google.ads.googleads.v8.services.types.MutateCustomerAssetResult): The result for the customer asset mutate. customer_extension_setting_result (google.ads.googleads.v8.services.types.MutateCustomerExtensionSettingResult): @@ -2115,6 +2214,18 @@ class MutateOperationResponse(proto.Message): oneof="response", message=asset_service.MutateAssetResult, ) + bidding_data_exclusion_result = proto.Field( + proto.MESSAGE, + number=58, + oneof="response", + message=bidding_data_exclusion_service.MutateBiddingDataExclusionsResult, + ) + bidding_seasonality_adjustment_result = proto.Field( + proto.MESSAGE, + number=59, + oneof="response", + message=bidding_seasonality_adjustment_service.MutateBiddingSeasonalityAdjustmentsResult, + ) bidding_strategy_result = proto.Field( proto.MESSAGE, number=6, @@ -2199,6 +2310,18 @@ class MutateOperationResponse(proto.Message): oneof="response", message=conversion_custom_variable_service.MutateConversionCustomVariableResult, ) + conversion_value_rule_result = proto.Field( + proto.MESSAGE, + number=63, + oneof="response", + message=conversion_value_rule_service.MutateConversionValueRuleResult, + ) + conversion_value_rule_set_result = proto.Field( + proto.MESSAGE, + number=64, + oneof="response", + message=conversion_value_rule_set_service.MutateConversionValueRuleSetResult, + ) customer_asset_result = proto.Field( proto.MESSAGE, number=57, diff --git a/google/ads/googleads/v8/services/types/reach_plan_service.py b/google/ads/googleads/v8/services/types/reach_plan_service.py index 6d85c07f6..efe4966a6 100644 --- a/google/ads/googleads/v8/services/types/reach_plan_service.py +++ b/google/ads/googleads/v8/services/types/reach_plan_service.py @@ -38,6 +38,7 @@ "GenerateProductMixIdeasResponse", "ProductAllocation", "GenerateReachForecastRequest", + "EffectiveFrequencyLimit", "FrequencyCap", "Targeting", "CampaignDuration", @@ -49,6 +50,7 @@ "PlannedProductReachForecast", "PlannedProductForecast", "OnTargetAudienceMetrics", + "EffectiveFrequencyBreakdown", }, ) @@ -309,6 +311,22 @@ class GenerateReachForecastRequest(proto.Message): person was exposed to the ad) for the reported reach metrics [1-10]. This won't affect the targeting, but just the reporting. If not specified, a default of 1 is applied. + + This field cannot be combined with the + effective_frequency_limit field. + effective_frequency_limit (google.ads.googleads.v8.services.types.EffectiveFrequencyLimit): + The highest minimum effective frequency (the number of times + a person was exposed to the ad) value [1-10] to include in + Forecast.effective_frequency_breakdowns. If not specified, + Forecast.effective_frequency_breakdowns will not be + provided. + + The effective frequency value provided here will also be + used as the minimum effective frequency for the reported + reach metrics. + + This field cannot be combined with the + min_effective_frequency field. targeting (google.ads.googleads.v8.services.types.Targeting): The targeting to be applied to all products selected in the product mix. @@ -335,12 +353,30 @@ class GenerateReachForecastRequest(proto.Message): min_effective_frequency = proto.Field( proto.INT32, number=11, optional=True, ) + effective_frequency_limit = proto.Field( + proto.MESSAGE, + number=12, + optional=True, + message="EffectiveFrequencyLimit", + ) targeting = proto.Field(proto.MESSAGE, number=6, message="Targeting",) planned_products = proto.RepeatedField( proto.MESSAGE, number=7, message="PlannedProduct", ) +class EffectiveFrequencyLimit(proto.Message): + r"""Effective frequency limit. + Attributes: + effective_frequency_breakdown_limit (int): + The highest effective frequency value to include in + Forecast.effective_frequency_breakdowns. This field supports + frequencies 1-10, inclusive. + """ + + effective_frequency_breakdown_limit = proto.Field(proto.INT32, number=1,) + + class FrequencyCap(proto.Message): r"""A rule specifying the maximum number of times an ad can be shown to a user over a particular time period. @@ -491,13 +527,23 @@ class Forecast(proto.Message): Attributes: on_target_reach (int): Number of unique people reached at least - GenerateReachForecastRequest.min_effective_frequency times + GenerateReachForecastRequest.min_effective_frequency or + GenerateReachForecastRequest.effective_frequency_limit times that exactly matches the Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the on_target_reach value will be rounded to 0. total_reach (int): Total number of unique people reached at least - GenerateReachForecastRequest.min_effective_frequency times. - This includes people that may fall outside the specified - Targeting. + GenerateReachForecastRequest.min_effective_frequency or + GenerateReachForecastRequest.effective_frequency_limit + times. This includes people that may fall outside the + specified Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the total_reach value will be rounded to 0. on_target_impressions (int): Number of ad impressions that exactly matches the Targeting. @@ -513,6 +559,12 @@ class Forecast(proto.Message): ads/answer/7029393 for more information about what makes an ad viewable and how viewability is measured. + effective_frequency_breakdowns (Sequence[google.ads.googleads.v8.services.types.EffectiveFrequencyBreakdown]): + A list of effective frequency forecasts. The list is ordered + starting with 1+ and ending with the value set in + GenerateReachForecastRequest.effective_frequency_limit. If + no effective_frequency_limit was set, this list will be + empty. """ on_target_reach = proto.Field(proto.INT64, number=5, optional=True,) @@ -520,6 +572,9 @@ class Forecast(proto.Message): on_target_impressions = proto.Field(proto.INT64, number=7, optional=True,) total_impressions = proto.Field(proto.INT64, number=8, optional=True,) viewable_impressions = proto.Field(proto.INT64, number=9, optional=True,) + effective_frequency_breakdowns = proto.RepeatedField( + proto.MESSAGE, number=10, message="EffectiveFrequencyBreakdown", + ) class PlannedProductReachForecast(proto.Message): @@ -552,12 +607,19 @@ class PlannedProductForecast(proto.Message): r"""Forecasted traffic metrics for a planned product. Attributes: on_target_reach (int): - Number of unique people reached that exactly - matches the Targeting. + Number of unique people reached that exactly matches the + Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the on_target_reach value will be rounded to 0. total_reach (int): - Number of unique people reached. This - includes people that may fall outside the - specified Targeting. + Number of unique people reached. This includes people that + may fall outside the specified Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the total_reach value will be rounded to 0. on_target_impressions (int): Number of ad impressions that exactly matches the Targeting. @@ -602,4 +664,34 @@ class OnTargetAudienceMetrics(proto.Message): census_audience_size = proto.Field(proto.INT64, number=4, optional=True,) +class EffectiveFrequencyBreakdown(proto.Message): + r"""A breakdown of the number of unique people reached at a given + effective frequency. + + Attributes: + effective_frequency (int): + The effective frequency [1-10]. + on_target_reach (int): + The number of unique people reached at least + effective_frequency times that exactly matches the + Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the on_target_reach value will be rounded to 0. + total_reach (int): + Total number of unique people reached at least + effective_frequency times. This includes people that may + fall outside the specified Targeting. + + Note that a minimum number of unique people must be reached + in order for data to be reported. If the minimum number is + not met, the total_reach value will be rounded to 0. + """ + + effective_frequency = proto.Field(proto.INT32, number=1,) + on_target_reach = proto.Field(proto.INT64, number=2,) + total_reach = proto.Field(proto.INT64, number=3,) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/ads/googleads/v8/services/types/recommendation_service.py b/google/ads/googleads/v8/services/types/recommendation_service.py index 33d673332..beeb298d9 100644 --- a/google/ads/googleads/v8/services/types/recommendation_service.py +++ b/google/ads/googleads/v8/services/types/recommendation_service.py @@ -187,10 +187,10 @@ class TargetRoasOptInParameters(proto.Message): Attributes: target_roas (float): - Average ROAS (revenue per unit of spend) to - use for Target ROAS bidding strategy. The value - is between 0.01 and 1000.0, inclusive. This is a - required field. + Average ROAS (revenue per unit of spend) to use for Target + ROAS bidding strategy. The value is between 0.01 and 1000.0, + inclusive. This is a required field, unless + new_campaign_budget_amount_micros is set. new_campaign_budget_amount_micros (int): Optional, budget amount to set for the campaign. diff --git a/google/ads/googleads/v8/services/types/smart_campaign_suggest_service.py b/google/ads/googleads/v8/services/types/smart_campaign_suggest_service.py index 9a52a3941..55a3e5c21 100644 --- a/google/ads/googleads/v8/services/types/smart_campaign_suggest_service.py +++ b/google/ads/googleads/v8/services/types/smart_campaign_suggest_service.py @@ -15,6 +15,7 @@ # import proto # type: ignore +from google.ads.googleads.v8.common.types import ad_type_infos from google.ads.googleads.v8.common.types import criteria @@ -25,13 +26,15 @@ "SuggestSmartCampaignBudgetOptionsRequest", "SmartCampaignSuggestionInfo", "SuggestSmartCampaignBudgetOptionsResponse", + "SuggestSmartCampaignAdRequest", + "SuggestSmartCampaignAdResponse", }, ) class SuggestSmartCampaignBudgetOptionsRequest(proto.Message): r"""Request message for - [SmartCampaignBudgetSuggestService.SuggestSmartCampaignBudgets][]. + [SmartCampaignSuggestService.SuggestSmartCampaignBudgets][]. Attributes: customer_id (str): @@ -63,13 +66,6 @@ class SmartCampaignSuggestionInfo(proto.Message): Attributes: final_url (str): Optional. Landing page URL of the campaign. - business_location_id (int): - Optional. The ID of the Google My Business (GMB) Location. - The location ID can be fetched by GMB API with its form: - accounts/{accountId}/locations/{locationId}. The last - {locationId} component from the GMB API represents the - business_location_id. See the [Google My Business API] - (https://developers.google.com/my-business/reference/rest/v4/accounts.locations) language_code (str): Optional. The two letter advertising language for the Smart campaign to be constructed, @@ -80,6 +76,16 @@ class SmartCampaignSuggestionInfo(proto.Message): Optional. Smart campaign keyword themes. This field may greatly improve suggestion accuracy and we recommend always setting it if possible. + business_context (google.ads.googleads.v8.services.types.SmartCampaignSuggestionInfo.BusinessContext): + Optional. Context describing the business to + advertise. + business_location_id (int): + Optional. The ID of the Google My Business (GMB) Location. + The location ID can be fetched by GMB API with its form: + accounts/{accountId}/locations/{locationId}. The last + {locationId} component from the GMB API represents the + business_location_id. See the [Google My Business API] + (https://developers.google.com/my-business/reference/rest/v4/accounts.locations) location_list (google.ads.googleads.v8.services.types.SmartCampaignSuggestionInfo.LocationList): Optional. The targeting geo location by locations. @@ -99,8 +105,16 @@ class LocationList(proto.Message): proto.MESSAGE, number=1, message=criteria.LocationInfo, ) + class BusinessContext(proto.Message): + r"""A context that describes a business. + Attributes: + business_name (str): + Optional. The name of the business. + """ + + business_name = proto.Field(proto.STRING, number=1,) + final_url = proto.Field(proto.STRING, number=1,) - business_location_id = proto.Field(proto.INT64, number=2,) language_code = proto.Field(proto.STRING, number=3,) ad_schedules = proto.RepeatedField( proto.MESSAGE, number=6, message=criteria.AdScheduleInfo, @@ -108,6 +122,15 @@ class LocationList(proto.Message): keyword_themes = proto.RepeatedField( proto.MESSAGE, number=7, message=criteria.KeywordThemeInfo, ) + business_context = proto.Field( + proto.MESSAGE, + number=8, + oneof="business_setting", + message=BusinessContext, + ) + business_location_id = proto.Field( + proto.INT64, number=2, oneof="business_setting", + ) location_list = proto.Field( proto.MESSAGE, number=4, oneof="geo_target", message=LocationList, ) @@ -121,7 +144,7 @@ class LocationList(proto.Message): class SuggestSmartCampaignBudgetOptionsResponse(proto.Message): r"""Response message for - [SmartCampaignBudgetSuggestService.SuggestSmartCampaignBudgets][]. + [SmartCampaignSuggestService.SuggestSmartCampaignBudgets][]. Depending on whether the system could suggest the options, either all of the options or none of them might be returned. @@ -178,4 +201,39 @@ class BudgetOption(proto.Message): ) +class SuggestSmartCampaignAdRequest(proto.Message): + r"""Request message for + [SmartCampaignSuggestService.SuggestSmartCampaignAd][google.ads.googleads.v8.services.SmartCampaignSuggestService.SuggestSmartCampaignAd]. + + Attributes: + customer_id (str): + Required. The ID of the customer. + suggestion_info (google.ads.googleads.v8.services.types.SmartCampaignSuggestionInfo): + Required. Inputs used to suggest a Smart campaign ad. + Required fields: final_url, language_code, keyword_themes. + Optional but recommended fields to improve the quality of + the suggestion: business_setting and geo_target. + """ + + customer_id = proto.Field(proto.STRING, number=1,) + suggestion_info = proto.Field( + proto.MESSAGE, number=2, message="SmartCampaignSuggestionInfo", + ) + + +class SuggestSmartCampaignAdResponse(proto.Message): + r"""Response message for + [SmartCampaignSuggestService.SuggestSmartCampaignAd][google.ads.googleads.v8.services.SmartCampaignSuggestService.SuggestSmartCampaignAd]. + + Attributes: + ad_info (google.ads.googleads.v8.common.types.SmartCampaignAdInfo): + Optional. Ad info includes 3 creative + headlines and 2 creative descriptions. + """ + + ad_info = proto.Field( + proto.MESSAGE, number=1, message=ad_type_infos.SmartCampaignAdInfo, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/setup.py b/setup.py index 39d798308..c228f8e43 100644 --- a/setup.py +++ b/setup.py @@ -18,10 +18,13 @@ install_requires = [ "google-auth-oauthlib >= 0.3.0, < 1.0.0", - "google-api-core >= 1.21.0, < 2.0.0", + # NOTE: Require google-api-core > 1.31.2 until + # https://github.com/googleapis/google-cloud-python/issues/10566 + # is resolved. Once resolved, require google-api-core >=2.x.x + "google-api-core >= 1.31.2, < 3.0.0", "googleapis-common-protos >= 1.5.8, < 2.0.0", "grpcio >= 1.38.1, < 2.0.0", - "proto-plus >= 1.18.0, < 2.0.0", + "proto-plus == 1.18.1", "PyYAML >= 5.1, < 6.0", "setuptools >= 40.3.0", "nox == 2020.12.31", @@ -33,7 +36,7 @@ setup( name="google-ads", - version="13.0.0", + version="14.0.0", author="Google LLC", author_email="googleapis-packages@google.com", classifiers=[ diff --git a/tests/client_test.py b/tests/client_test.py index 3d6981a91..8c5263cc9 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -21,7 +21,9 @@ from pyfakefs.fake_filesystem_unittest import TestCase as FileTestCase import yaml +from google.protobuf.message import Message as ProtobufMessageType from proto.enums import ProtoEnumMeta +from proto import Message from google.ads.googleads import client as Client @@ -49,12 +51,14 @@ def _create_test_client(self, **kwargs): endpoint=kwargs.get("endpoint"), version=kwargs.get("version"), http_proxy=kwargs.get("http_proxy"), + use_proto_plus=kwargs.get("use_proto_plus"), ) return client def setUp(self): self.setUpPyfakefs() self.developer_token = "abc123" + self.use_proto_plus = True self.client_id = "client_id_123456789" self.client_secret = "client_secret_987654321" self.refresh_token = "refresh" @@ -64,15 +68,28 @@ def setUp(self): self.linked_customer_id = "0987654321" self.version = latest_version self.http_proxy = "https://localhost:8000" + # The below fields are defaults that include required keys. + # They are merged with other keys in individual tests, and isolated + # here so that new required keys don't need to be added to each test. + self.default_config = { + "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, + } + self.default_env_var_config = { + "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, + "GOOGLE_ADS_USE_PROTO_PLUS": str(self.use_proto_plus), + } def test_get_client_kwargs_login_customer_id(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "login_customer_id": self.login_customer_id, - "linked_customer_id": self.linked_customer_id, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "login_customer_id": self.login_customer_id, + "linked_customer_id": self.linked_customer_id, + }, } mock_credentials_instance = mock.Mock() @@ -87,6 +104,7 @@ def test_get_client_kwargs_login_customer_id(self): { "credentials": mock_credentials_instance, "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "endpoint": None, "login_customer_id": self.login_customer_id, "logging_config": None, @@ -97,11 +115,13 @@ def test_get_client_kwargs_login_customer_id(self): def test_get_client_kwargs_login_customer_id_as_None(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "login_customer_id": None, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "login_customer_id": None, + }, } mock_credentials_instance = mock.Mock() @@ -116,6 +136,7 @@ def test_get_client_kwargs_login_customer_id_as_None(self): { "credentials": mock_credentials_instance, "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "endpoint": None, "login_customer_id": None, "logging_config": None, @@ -126,11 +147,13 @@ def test_get_client_kwargs_login_customer_id_as_None(self): def test_get_client_kwargs_linked_customer_id(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "linked_customer_id": self.linked_customer_id, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "linked_customer_id": self.linked_customer_id, + }, } mock_credentials_instance = mock.Mock() @@ -145,6 +168,7 @@ def test_get_client_kwargs_linked_customer_id(self): { "credentials": mock_credentials_instance, "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "endpoint": None, "login_customer_id": None, "logging_config": None, @@ -155,11 +179,13 @@ def test_get_client_kwargs_linked_customer_id(self): def test_get_client_kwargs_linked_customer_id_as_none(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "linked_customer_id": None, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "linked_customer_id": None, + }, } mock_credentials_instance = mock.Mock() @@ -174,6 +200,7 @@ def test_get_client_kwargs_linked_customer_id_as_none(self): { "credentials": mock_credentials_instance, "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "endpoint": None, "linked_customer_id": None, "logging_config": None, @@ -184,11 +211,13 @@ def test_get_client_kwargs_linked_customer_id_as_none(self): def test_get_client_kwargs(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "http_proxy": self.http_proxy, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "http_proxy": self.http_proxy, + }, } mock_credentials_instance = mock.Mock() @@ -203,6 +232,7 @@ def test_get_client_kwargs(self): { "credentials": mock_credentials_instance, "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "endpoint": None, "login_customer_id": None, "logging_config": None, @@ -214,11 +244,13 @@ def test_get_client_kwargs(self): def test_get_client_kwargs_custom_endpoint(self): endpoint = "alt.endpoint.com" config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "endpoint": endpoint, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "endpoint": endpoint, + }, } mock_credentials_instance = mock.Mock() @@ -232,6 +264,7 @@ def test_get_client_kwargs_custom_endpoint(self): result, { "credentials": mock_credentials_instance, + "use_proto_plus": self.use_proto_plus, "developer_token": self.developer_token, "endpoint": endpoint, "login_customer_id": None, @@ -243,6 +276,14 @@ def test_get_client_kwargs_custom_endpoint(self): def test_load_from_env(self): mock_credentials_instance = mock.Mock() + config = { + **self.default_env_var_config, + **{ + "GOOGLE_ADS_CLIENT_ID": self.client_id, + "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, + "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, + }, + } with mock.patch.object( Client.GoogleAdsClient, "__init__", return_value=None @@ -251,19 +292,14 @@ def test_load_from_env(self): "get_installed_app_credentials", return_value=mock_credentials_instance, ) as mock_credentials, mock.patch.dict( - os.environ, - { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_CLIENT_ID": self.client_id, - "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, - "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, - }, + os.environ, config ) as mock_os_environ: Client.GoogleAdsClient.load_from_env() mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -274,6 +310,14 @@ def test_load_from_env(self): def test_load_from_env_versioned(self): mock_credentials_instance = mock.Mock() + config = { + **self.default_env_var_config, + **{ + "GOOGLE_ADS_CLIENT_ID": self.client_id, + "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, + "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, + }, + } with mock.patch.object( Client.GoogleAdsClient, "__init__", return_value=None @@ -282,19 +326,14 @@ def test_load_from_env_versioned(self): "get_installed_app_credentials", return_value=mock_credentials_instance, ) as mock_credentials, mock.patch.dict( - os.environ, - { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_CLIENT_ID": self.client_id, - "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, - "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, - }, + os.environ, config ) as mock_os_environ: Client.GoogleAdsClient.load_from_env(version="v4") mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -305,10 +344,12 @@ def test_load_from_env_versioned(self): def test_load_from_dict(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } mock_credentials_instance = mock.Mock() @@ -324,6 +365,7 @@ def test_load_from_dict(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -334,10 +376,12 @@ def test_load_from_dict(self): def test_load_from_dict_versioned(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } mock_credentials_instance = mock.Mock() @@ -353,6 +397,7 @@ def test_load_from_dict_versioned(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -363,10 +408,12 @@ def test_load_from_dict_versioned(self): def test_load_from_string(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } mock_credentials_instance = mock.Mock() @@ -382,6 +429,7 @@ def test_load_from_string(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -392,10 +440,12 @@ def test_load_from_string(self): def test_load_from_string_versioned(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } mock_credentials_instance = mock.Mock() @@ -413,6 +463,7 @@ def test_load_from_string_versioned(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -423,10 +474,12 @@ def test_load_from_string_versioned(self): def test_load_from_storage(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -450,6 +503,7 @@ def test_load_from_storage(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -460,10 +514,12 @@ def test_load_from_storage(self): def test_load_from_storage_versioned(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -487,6 +543,7 @@ def test_load_from_storage_versioned(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -498,11 +555,13 @@ def test_load_from_storage_versioned(self): def test_load_from_storage_login_cid_int(self): login_cid = 1234567890 config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "login_customer_id": login_cid, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "login_customer_id": login_cid, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -526,6 +585,7 @@ def test_load_from_storage_login_cid_int(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=str(login_cid), logging_config=None, @@ -536,10 +596,12 @@ def test_load_from_storage_login_cid_int(self): def test_load_from_storage_custom_path(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } file_path = "test/google-ads.yaml" @@ -557,6 +619,7 @@ def test_load_from_storage_custom_path(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -590,9 +653,11 @@ def test_load_from_storage_required_config_missing(self): def test_load_from_storage_service_account_config(self): config = { - "developer_token": self.developer_token, - "json_key_file_path": self.json_key_file_path, - "impersonated_email": self.impersonated_email, + **self.default_config, + **{ + "json_key_file_path": self.json_key_file_path, + "impersonated_email": self.impersonated_email, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -615,6 +680,7 @@ def test_load_from_storage_service_account_config(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -625,8 +691,10 @@ def test_load_from_storage_service_account_config(self): def test_load_from_storage_service_account_no_impersonated_email(self): config = { - "developer_token": self.developer_token, - "json_key_file_path": self.json_key_file_path, + **self.default_config, + **{ + "json_key_file_path": self.json_key_file_path, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -741,6 +809,18 @@ def test_get_type_invalid_version(self): version="bad_version", ) + def test_get_type_proto_plus_proto(self): + """Returns a proto.Message instance when use_proto_plus is true.""" + client = self._create_test_client(use_proto_plus=True) + message = client.get_type("Campaign") + self.assertIsInstance(message, Message) + + def test_get_type_protobuf_proto(self): + """Returns a protobuf instance when use_proto_plus is false.""" + client = self._create_test_client(use_proto_plus=False) + message = client.get_type("Campaign") + self.assertIsInstance(message, ProtobufMessageType) + def test_init_no_logging_config(self): """Should call logging.config.dictConfig if logging config exists.""" with mock.patch( @@ -779,12 +859,12 @@ def test_init_with_logging_config(self): def test_client_dot_enums_hasattr(self): """Ensures hasattr works as expected with real Enum.""" - client = self._create_test_client() + client = self._create_test_client(use_proto_plus=True) self.assertTrue(hasattr(client.enums, "CampaignStatusEnum")) def test_client_dot_enums_only_enums(self): """Ensures non-Enum name raises AttributeError.""" - client = self._create_test_client() + client = self._create_test_client(use_proto_plus=True) self.assertRaises(AttributeError, getattr, client.enums, "Campaign") def test_client_dot_enums_property(self): @@ -797,7 +877,7 @@ def test_client_dot_enums_property(self): access the inner Enum object. """ for ver in valid_versions: - client = self._create_test_client(version=ver) + client = self._create_test_client(version=ver, use_proto_plus=True) self.assertTrue( hasattr(client, "enums"), "GoogleAdsService in " @@ -814,8 +894,22 @@ def test_client_dot_enums_property(self): getattr(client.enums, name), ProtoEnumMeta ) - def test_client_copy_from_both_wrapped(self): - """client.copy_from works with two wrapped proto messages.""" + def test_client_dot_enums_use_proto_plus(self): + """Should return a protobuf proto if use_proto_plus is set to true.""" + client = self._create_test_client(use_proto_plus=True) + enum = client.enums.CampaignStatusEnum + self.assertTrue(hasattr(enum, "PAUSED")) + self.assertIsInstance(enum, ProtoEnumMeta) + + def test_client_dot_enums_protobuf_protos(self): + """Should return protobuf protos if use_proto_plus is set to false.""" + client = self._create_test_client(use_proto_plus=False) + enum = client.enums.CampaignStatusEnum + self.assertTrue(hasattr(enum, "PAUSED")) + self.assertIsInstance(enum, ProtobufMessageType) + + def test_client_copy_from_both_proto_plus(self): + """client.copy_from works with two proto_plus proto messages.""" client = self._create_test_client() destination = client.get_type("Campaign", version=latest_version) origin = client.get_type("Campaign", version=latest_version) @@ -826,89 +920,93 @@ def test_client_copy_from_both_wrapped(self): self.assertEqual(destination.name, "Test") self.assertIsNot(destination, origin) - def test_client_copy_from_both_native(self): - """client.copy_from works with two native proto messages.""" - client = self._create_test_client() + def test_client_copy_from_both_protobuf(self): + """client.copy_from works with two protobuf proto messages.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("Campaign", version=latest_version) - native_dest = type(destination).pb(destination) + protobuf_dest = type(destination).pb(destination) origin = client.get_type("Campaign", version=latest_version) - native_orig = type(origin).pb(origin) + protobuf_orig = type(origin).pb(origin) origin.name = "Test" - client.copy_from(native_dest, native_orig) + client.copy_from(protobuf_dest, protobuf_orig) self.assertEqual(destination.name, "Test") self.assertIsNot(destination, origin) - def test_client_copy_from_native_origin(self): - """client.copy_from works with a wrapped dest and a native origin.""" - client = self._create_test_client() + def test_client_copy_from_protobuf_origin(self): + """client.copy_from works with a proto_plus dest and a protobuf origin.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("Campaign", version=latest_version) origin = client.get_type("Campaign", version=latest_version) - native_orig = type(origin).pb(origin) + protobuf_orig = type(origin).pb(origin) origin.name = "Test" - client.copy_from(destination, native_orig) + client.copy_from(destination, protobuf_orig) self.assertEqual(destination.name, "Test") self.assertIsNot(destination, origin) - def test_client_copy_from_native_destination(self): - """client.copy_from works with a native dest and a wrapped origin.""" - client = self._create_test_client() + def test_client_copy_from_protobuf_destination(self): + """client.copy_from works with a protobuf dest and a proto_plus origin.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("Campaign", version=latest_version) - native_dest = type(destination).pb(destination) + protobuf_dest = type(destination).pb(destination) origin = client.get_type("Campaign", version=latest_version) origin.name = "Test" - client.copy_from(native_dest, origin) + client.copy_from(protobuf_dest, origin) self.assertEqual(destination.name, "Test") self.assertIsNot(destination, origin) - def test_client_copy_from_different_types_wrapped(self): - """TypeError is raised with different types of wrapped messasges.""" - client = self._create_test_client() + def test_client_copy_from_different_types_proto_plus(self): + """TypeError is raised with different types of proto_plus messasges.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("AdGroup", version=latest_version) origin = client.get_type("Campaign", version=latest_version) origin.name = "Test" self.assertRaises(TypeError, client.copy_from, destination, origin) - def test_client_copy_from_different_types_native(self): - """TypeError is raised with different types of native messasges.""" - client = self._create_test_client() + def test_client_copy_from_different_types_protobuf(self): + """TypeError is raised with different types of protobuf messasges.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("AdGroup", version=latest_version) - native_dest = type(destination).pb(destination) + protobuf_dest = type(destination).pb(destination) origin = client.get_type("Campaign", version=latest_version) - native_orig = type(origin).pb(origin) + protobuf_orig = type(origin).pb(origin) origin.name = "Test" - self.assertRaises(TypeError, client.copy_from, native_dest, native_orig) + self.assertRaises( + TypeError, client.copy_from, protobuf_dest, protobuf_orig + ) - def test_client_copy_from_different_types_native_origin(self): - """TypeError is raised with different types and native origin.""" - client = self._create_test_client() + def test_client_copy_from_different_types_protobuf_origin(self): + """TypeError is raised with different types and protobuf origin.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("AdGroup", version=latest_version) origin = client.get_type("Campaign", version=latest_version) - native_orig = type(origin).pb(origin) + protobuf_orig = type(origin).pb(origin) origin.name = "Test" - self.assertRaises(TypeError, client.copy_from, destination, native_orig) + self.assertRaises( + TypeError, client.copy_from, destination, protobuf_orig + ) - def test_client_copy_from_different_types_native_destination(self): - """TypeError is raised with different types and native destination.""" - client = self._create_test_client() + def test_client_copy_from_different_types_protobuf_destination(self): + """TypeError is raised with different types and protobuf destination.""" + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("AdGroup", version=latest_version) - native_dest = type(destination).pb(destination) + protobuf_dest = type(destination).pb(destination) origin = client.get_type("Campaign", version=latest_version) origin.name = "Test" - self.assertRaises(TypeError, client.copy_from, native_dest, origin) + self.assertRaises(TypeError, client.copy_from, protobuf_dest, origin) def test_client_copy_from_non_proto_message(self): """ValueError is raised if an object other than a protobuf is given""" - client = self._create_test_client() + client = self._create_test_client(use_proto_plus=True) destination = client.get_type("AdGroup", version=latest_version) origin = {"name": "Test"} @@ -916,7 +1014,10 @@ def test_client_copy_from_non_proto_message(self): def test_client_is_picklable(self): client = Client.GoogleAdsClient( - {}, self.developer_token, endpoint=None, version=None, + {}, + self.developer_token, + endpoint=None, + version=None, ) try: @@ -935,6 +1036,16 @@ def test_http_proxy(self): def test_load_http_proxy_from_env(self): mock_credentials_instance = mock.Mock() + config = { + **self.default_env_var_config, + **{ + "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, + "GOOGLE_ADS_CLIENT_ID": self.client_id, + "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, + "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, + "GOOGLE_ADS_HTTP_PROXY": self.http_proxy, + }, + } with mock.patch.object( Client.GoogleAdsClient, "__init__", return_value=None @@ -943,20 +1054,14 @@ def test_load_http_proxy_from_env(self): "get_installed_app_credentials", return_value=mock_credentials_instance, ) as mock_credentials, mock.patch.dict( - os.environ, - { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_CLIENT_ID": self.client_id, - "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, - "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, - "GOOGLE_ADS_HTTP_PROXY": self.http_proxy, - }, + os.environ, config ) as mock_os_environ: Client.GoogleAdsClient.load_from_env() mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -967,11 +1072,13 @@ def test_load_http_proxy_from_env(self): def test_load_http_proxy_from_dict(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "http_proxy": self.http_proxy, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "http_proxy": self.http_proxy, + }, } mock_credentials_instance = mock.Mock() @@ -987,6 +1094,7 @@ def test_load_http_proxy_from_dict(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -997,11 +1105,13 @@ def test_load_http_proxy_from_dict(self): def test_load_http_proxy_from_string(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "http_proxy": self.http_proxy, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "http_proxy": self.http_proxy, + }, } mock_credentials_instance = mock.Mock() @@ -1017,6 +1127,7 @@ def test_load_http_proxy_from_string(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, @@ -1025,13 +1136,15 @@ def test_load_http_proxy_from_string(self): http_proxy=self.http_proxy, ) - def test_load_from_storage(self): + def test_load_http_proxy_from_storage(self): config = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - "http_proxy": self.http_proxy, + **self.default_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + "http_proxy": self.http_proxy, + }, } file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") @@ -1055,6 +1168,7 @@ def test_load_from_storage(self): mock_client_init.assert_called_once_with( credentials=mock_credentials_instance, developer_token=self.developer_token, + use_proto_plus=self.use_proto_plus, endpoint=None, login_customer_id=None, logging_config=None, diff --git a/tests/config_test.py b/tests/config_test.py index dfd4c5b6d..8b937caa3 100644 --- a/tests/config_test.py +++ b/tests/config_test.py @@ -36,38 +36,54 @@ def setUp(self): self.endpoint = "www.testendpoint.com" self.configuration_file_path = "/usr/test/path/google-ads.yaml" self.impersonated_email = "impersonated@account.com" + self.use_proto_plus = False + # The below fields are defaults that include required keys. + # They are merged with other keys in individual tests, and isolated + # here so that new required keys don't need to be added to each test. + self.default_dict_config = { + "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, + } + self.default_env_var_config = { + "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, + "GOOGLE_ADS_USE_PROTO_PLUS": self.use_proto_plus, + } - def test_load_from_yaml_file_logging(self): - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") + def _create_mock_yaml( + self, + additional_configs, + file_path=os.path.join(os.path.expanduser("~"), "google-ads.yaml"), + ): + merged = {**self.default_dict_config, **additional_configs} self.fs.create_file( - file_path, - contents=yaml.safe_dump( - { - "developer_token": self.developer_token, - "logging": { - "version": 1, - "disable_existing_loggers": False, - "formatters": { - "default_fmt": { - "format": "[%(asctime)s - %(levelname)s]", - "datefmt": "%Y-%m-%d %H:%M:%S", - } - }, - "handlers": { - "default_handler": { - "class": "logging.StreamHandler", - "formatter": "default_fmt", - } - }, - "loggers": { - "": { - "handlers": ["default_handler"], - "level": "DEBUG", - } - }, + file_path, contents=yaml.safe_dump(merged), + ) + + def test_load_from_yaml_file_logging(self): + """Should load logging config from yaml if provided.""" + self._create_mock_yaml( + { + "developer_token": self.developer_token, + "logging": { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "default_fmt": { + "format": "[%(asctime)s - %(levelname)s]", + "datefmt": "%Y-%m-%d %H:%M:%S", + } }, - } - ), + "handlers": { + "default_handler": { + "class": "logging.StreamHandler", + "formatter": "default_fmt", + } + }, + "loggers": { + "": {"handlers": ["default_handler"], "level": "DEBUG",} + }, + }, + } ) result = config.load_from_yaml_file() @@ -76,38 +92,30 @@ def test_load_from_yaml_file_logging(self): self.assertIsInstance(result["logging"], dict) def test_load_from_yaml_file_logging_invalid_json(self): - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") - self.fs.create_file( - file_path, - contents=yaml.safe_dump( - {"developer_token": self.developer_token, "logging": "not JSON"} - ), - ) - + """Should raise ValueError if logging config is not valid JSON.""" + self._create_mock_yaml({"logging": "not JSON"}) self.assertRaises(ValueError, config.load_from_yaml_file) def test_load_from_yaml_file(self): - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") - self.fs.create_file( - file_path, - contents=yaml.safe_dump( - { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - } - ), + """Should load config from a yaml file in the root directory.""" + self._create_mock_yaml( + { + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + } ) result = config.load_from_yaml_file() self.assertEqual(result["developer_token"], self.developer_token) + self.assertEqual(result["use_proto_plus"], self.use_proto_plus) self.assertEqual(result["client_id"], self.client_id) self.assertEqual(result["client_secret"], self.client_secret) self.assertEqual(result["refresh_token"], self.refresh_token) - def test_load_from_yaml_file_missing_required_key(self): + def test_load_from_yaml_file_missing_developer_token(self): + """Should raise ValueError if developer_token key is missing.""" file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") # save a YAML file without a required developer_token key self.fs.create_file( @@ -117,192 +125,187 @@ def test_load_from_yaml_file_missing_required_key(self): "client_id": self.client_id, "client_secret": self.client_secret, "refresh_token": self.refresh_token, + "use_proto_plus": self.use_proto_plus, } ), ) self.assertRaises(ValueError, config.load_from_yaml_file) - def test_load_from_yaml_file_with_path(self): - custom_path = os.path.expanduser("/test/custom/path") - file_path = os.path.join(custom_path, "google-ads.yaml") + def test_load_from_yaml_file_missing_use_proto_plus_key(self): + """Should raise ValueError if use_proto_plus key is missing.""" + file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") + # save a YAML file without a required use_proto_plus key self.fs.create_file( file_path, contents=yaml.safe_dump( { - "developer_token": self.developer_token, "client_id": self.client_id, "client_secret": self.client_secret, "refresh_token": self.refresh_token, + "developer_token": self.developer_token, } ), ) + self.assertRaises(ValueError, config.load_from_yaml_file) + + def test_load_from_yaml_file_with_path(self): + """Should load yaml file from a given path passed in directly.""" + custom_path = os.path.expanduser("/test/custom/path") + file_path = os.path.join(custom_path, "google-ads.yaml") + self._create_mock_yaml( + { + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, + file_path=file_path, + ) + result = config.load_from_yaml_file(path=file_path) self.assertEqual(result["developer_token"], self.developer_token) + self.assertEqual(result["use_proto_plus"], self.use_proto_plus) self.assertEqual(result["client_id"], self.client_id) self.assertEqual(result["client_secret"], self.client_secret) self.assertEqual(result["refresh_token"], self.refresh_token) def test_load_from_yaml_file_from_env_var(self): - """Should load from env var path if defined.""" + """Should load yaml file from env var path if defined.""" env_var_path = os.path.expanduser("/test/from/env/var") file_path = os.path.join(env_var_path, "google-ads.yaml") - mock_dev_token = "from env var path" - self.fs.create_file( - file_path, - contents=yaml.safe_dump({"developer_token": mock_dev_token}), - ) + self._create_mock_yaml({}, file_path=file_path) environ = {"GOOGLE_ADS_CONFIGURATION_FILE_PATH": file_path} with mock.patch("os.environ", environ): result = config.load_from_yaml_file() - self.assertEqual(result["developer_token"], mock_dev_token) + self.assertEqual(result["developer_token"], self.developer_token) + self.assertEqual(result["use_proto_plus"], self.use_proto_plus) def test_load_from_yaml_file_with_path_and_env_var(self): - """Should load from given path if both are defined.""" - given_path = os.path.expanduser("/test/given/path") - env_var_path = os.path.expanduser("/test/from/env/var") - file_path = os.path.join(given_path, "google-ads.yaml") - mock_dev_token = "from env var path" - self.fs.create_file( - file_path, - contents=yaml.safe_dump({"developer_token": mock_dev_token}), + """Should load yaml file from passed-in path if both are defined.""" + env_var_path = os.path.join( + os.path.expanduser("/test/from/env/var"), "google-ads.yaml" + ) + passed_in_path = os.path.join( + os.path.expanduser("/test/given/path"), "google-ads.yaml" + ) + # Create yaml file in location defined by path passed to method + self._create_mock_yaml( + {"location": "passed in"}, file_path=passed_in_path ) + # Create yaml file in location defined by environment variable + self._create_mock_yaml({"location": "env var"}, file_path=env_var_path) - environ = {"GOOGLE_ADS_CONFIGURATION_FILE_PATH": file_path} + environ = {"GOOGLE_ADS_CONFIGURATION_FILE_PATH": env_var_path} with mock.patch("os.environ", environ): - result = config.load_from_yaml_file(path=file_path) - self.assertEqual(result["developer_token"], mock_dev_token) + # Load config and check that it came from path passed to method + result = config.load_from_yaml_file(path=passed_in_path) + self.assertEqual(result["location"], "passed in") - def test_load_from_yaml_file_login_cid_int(self): - login_cid_int = 1234567890 - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") - self.fs.create_file( - file_path, - contents=yaml.safe_dump( - { - "login_customer_id": login_cid_int, - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, - } - ), - ) + def test_load_from_yaml_file_login_cid_number(self): + """Should load login_customer_id key if value is defined as a number.""" + login_cid_num = int(self.login_customer_id) + self._create_mock_yaml({"login_customer_id": login_cid_num}) result = config.load_from_yaml_file() - self.assertEqual(result["developer_token"], self.developer_token) - self.assertEqual(result["client_id"], self.client_id) - self.assertEqual(result["client_secret"], self.client_secret) - self.assertEqual(result["refresh_token"], self.refresh_token) + self.assertEqual(result["login_customer_id"], self.login_customer_id) def test_load_from_yaml_file_linked_cid(self): - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") - self.fs.create_file( - file_path, - contents=yaml.safe_dump( - { - "linked_customer_id": self.linked_customer_id, - "developer_token": self.developer_token, - } - ), - ) + """Should load liked_customer_id config from yaml.""" + self._create_mock_yaml({"linked_customer_id": self.linked_customer_id}) result = config.load_from_yaml_file() - self.assertEqual(result["developer_token"], self.developer_token) self.assertEqual(result["linked_customer_id"], self.linked_customer_id) def test_load_from_yaml_file_secondary_service_account_keys(self): """Should convert secondary keys to primary keys. + This test should be removed once the secondary service account keys are deprecated. """ - file_path = os.path.join(os.path.expanduser("~"), "google-ads.yaml") - self.fs.create_file( - file_path, - contents=yaml.safe_dump( - { - "developer_token": self.developer_token, - "path_to_private_key_file": self.json_key_file_path, - "delegated_account": self.impersonated_email, - } - ), + self._create_mock_yaml( + { + "path_to_private_key_file": self.json_key_file_path, + "delegated_account": self.impersonated_email, + } ) result = config.load_from_yaml_file() + self.assertEqual(result["json_key_file_path"], self.json_key_file_path) self.assertEqual(result["impersonated_email"], self.impersonated_email) def test_parse_yaml_document_to_dict(self): - yaml_doc = ( - "client_id: {}\n" - "client_secret: {}\n" - "developer_token: {}\n" - "refresh_token: {}\n".format( - self.client_id, - self.client_secret, - self.developer_token, - self.refresh_token, - ) - ) + """Should parse configuration from a yaml string""" + yaml_doc = f""" + client_id: {self.client_id}\n + client_secret: {self.client_secret}\n + developer_token: {self.developer_token}\n + use_proto_plus: {self.use_proto_plus}\n + refresh_token: {self.refresh_token}\n + """ result = config.parse_yaml_document_to_dict(yaml_doc) self.assertEqual(result["developer_token"], self.developer_token) + self.assertEqual(result["use_proto_plus"], self.use_proto_plus) self.assertEqual(result["client_id"], self.client_id) self.assertEqual(result["client_secret"], self.client_secret) self.assertEqual(result["refresh_token"], self.refresh_token) def test_parse_yaml_document_to_dict_missing_required_key(self): + """Should raise ValueError if yaml string is missing a required key.""" # YAML document is missing the required developer_token key - yaml_doc = ( - "client_id: {}\n" - "client_secret: {}\n" - "refresh_token: {}\n".format( - self.client_id, - self.client_secret, - self.developer_token, - self.refresh_token, - ) - ) + yaml_doc = f""" + client_id: {self.client_id}\n + client_secret: {self.client_secret}\n + use_proto_plus: {self.use_proto_plus}\n + refresh_token: {self.refresh_token}\n + """ self.assertRaises( ValueError, config.parse_yaml_document_to_dict, yaml_doc ) def test_load_from_dict(self): + """Can load config from a dict.""" config_data = { - "developer_token": self.developer_token, - "client_id": self.client_id, - "client_secret": self.client_secret, - "refresh_token": self.refresh_token, + **self.default_dict_config, + **{ + "client_id": self.client_id, + "client_secret": self.client_secret, + "refresh_token": self.refresh_token, + }, } self.assertEqual(config.load_from_dict(config_data), config_data) def test_load_from_dict_logging(self): + """Should load logging config from dict.""" config_data = { - "developer_token": self.developer_token, - "logging": { - "version": 1, - "disable_existing_loggers": False, - "formatters": { - "default_fmt": { - "format": "[%(asctime)s - %(levelname)s]", - "datefmt": "%Y-%m-%d %H:%M:%S", - } - }, - "handlers": { - "default_handler": { - "class": "logging.StreamHandler", - "formatter": "default_fmt", - } - }, - "loggers": { - "": {"handlers": ["default_handler"], "level": "DEBUG",} + **self.default_dict_config, + **{ + "logging": { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "default_fmt": { + "format": "[%(asctime)s - %(levelname)s]", + "datefmt": "%Y-%m-%d %H:%M:%S", + } + }, + "handlers": { + "default_handler": { + "class": "logging.StreamHandler", + "formatter": "default_fmt", + } + }, + "loggers": { + "": {"handlers": ["default_handler"], "level": "DEBUG",} + }, }, }, } @@ -311,9 +314,11 @@ def test_load_from_dict_logging(self): def test_load_from_dict_secondary_service_account_keys(self): """Should convert secondary keys to primary keys.""" config_data = { - "developer_token": self.developer_token, - "path_to_private_key_file": self.json_key_file_path, - "delegated_account": self.impersonated_email, + **self.default_dict_config, + **{ + "path_to_private_key_file": self.json_key_file_path, + "delegated_account": self.impersonated_email, + }, } result = config.load_from_dict(config_data) @@ -321,24 +326,28 @@ def test_load_from_dict_secondary_service_account_keys(self): self.assertEqual(result["impersonated_email"], self.impersonated_email) def test_load_from_dict_error(self): + """Should raise ValueError if invalid dict is given.""" config_data = 111 self.assertRaises(ValueError, config.load_from_dict, config_data) @mock.patch.object(config, "_logger", mock.Mock()) @mock.patch("logging.config.dictConfig") def test_load_from_env(self, config_spy): + """Should load config from environment variables.""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_CLIENT_ID": self.client_id, - "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, - "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, - "GOOGLE_ADS_LOGGING": '{"test": true}', - "GOOGLE_ADS_ENDPOINT": self.endpoint, - "GOOGLE_ADS_LOGIN_CUSTOMER_ID": self.login_customer_id, - "GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id, - "GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id, - "GOOGLE_ADS_JSON_KEY_FILE_PATH": self.json_key_file_path, - "GOOGLE_ADS_IMPERSONATED_EMAIL": self.impersonated_email, + **self.default_env_var_config, + **{ + "GOOGLE_ADS_CLIENT_ID": self.client_id, + "GOOGLE_ADS_CLIENT_SECRET": self.client_secret, + "GOOGLE_ADS_REFRESH_TOKEN": self.refresh_token, + "GOOGLE_ADS_LOGGING": '{"test": true}', + "GOOGLE_ADS_ENDPOINT": self.endpoint, + "GOOGLE_ADS_LOGIN_CUSTOMER_ID": self.login_customer_id, + "GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id, + "GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id, + "GOOGLE_ADS_JSON_KEY_FILE_PATH": self.json_key_file_path, + "GOOGLE_ADS_IMPERSONATED_EMAIL": self.impersonated_email, + }, } with mock.patch("os.environ", environ): @@ -347,6 +356,7 @@ def test_load_from_env(self, config_spy): result, { "developer_token": self.developer_token, + "use_proto_plus": self.use_proto_plus, "client_id": self.client_id, "client_secret": self.client_secret, "refresh_token": self.refresh_token, @@ -362,6 +372,7 @@ def test_load_from_env(self, config_spy): @mock.patch.object(config, "_logger", mock.Mock()) def test_load_from_env_missing_required_key(self): + """Should raise ValueError if missing required env var..""" # environ is missing required developer_token key environ = { "GOOGLE_ADS_CLIENT_ID": self.client_id, @@ -388,7 +399,7 @@ def test_load_from_env_config_file_path(self): config, "load_from_yaml_file", # Return basic config to pass validation. - return_value={"developer_token": "1234"}, + return_value=self.default_dict_config, ) as spy: config.load_from_env() spy.assert_called_once() @@ -396,45 +407,57 @@ def test_load_from_env_config_file_path(self): def test_load_from_env_linked_cid(self): """Should load linked CID from environment when specified""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id, + **self.default_env_var_config, + **{"GOOGLE_ADS_LINKED_CUSTOMER_ID": self.linked_customer_id,}, } with mock.patch("os.environ", environ): results = config.load_from_env() - self.assertEqual(results["developer_token"], self.developer_token) self.assertEqual( results["linked_customer_id"], self.linked_customer_id ) def test_load_from_env_config_file_path_added_vars(self): - """Should use config from yaml when config file path env var exists.""" - env_dev_token = "abcdefg" - yaml_dev_token = "123456" + """Should use config from yaml when config file path env var exists. + + If a configuration file path is defined via an environment variable + then the yaml file at that location will be loaded and any other + environment variable configuration will be ignored. + """ + env_dev_token = "123456" environ = { - "GOOGLE_ADS_CONFIGURATION_FILE_PATH": self.configuration_file_path, - "GOOGLE_ADS_DEVELOPER_TOKEN": env_dev_token, + **self.default_env_var_config, + **{ + "GOOGLE_ADS_CONFIGURATION_FILE_PATH": self.configuration_file_path, + "GOOGLE_ADS_DEVELOPER_TOKEN": env_dev_token, + }, } with mock.patch("os.environ", environ), mock.patch.object( + # Mock load_from_yaml_file return value so it returns + # a default dict config that passes validation config, "load_from_yaml_file", - # Return basic config to pass validation. - return_value={"developer_token": yaml_dev_token}, + return_value=self.default_dict_config, ) as spy: + # Assert that the config values were retrieved from the yaml + # file and not from environment variables. result = config.load_from_env() - self.assertEqual(result["developer_token"], yaml_dev_token) + self.assertEqual(result["developer_token"], self.developer_token) + self.assertEqual(result["use_proto_plus"], self.use_proto_plus) @mock.patch.object(config, "_logger", mock.Mock()) def test_load_from_env_redundant_file_path(self): """JSON_KEY_FILE_PATH takes precedent if both exist.""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, + **self.default_env_var_config, # The two below variables represent the same key, and this test # checks that JSON_KEY_FILE_PATH takes precedent and overwrites # the path_to_private_key_file_path key in the returned dict. - "GOOGLE_ADS_PATH_TO_PRIVATE_KEY_FILE": self.path_to_private_key_file, - "GOOGLE_ADS_JSON_KEY_FILE_PATH": self.json_key_file_path, + **{ + "GOOGLE_ADS_PATH_TO_PRIVATE_KEY_FILE": self.path_to_private_key_file, + "GOOGLE_ADS_JSON_KEY_FILE_PATH": self.json_key_file_path, + }, } with mock.patch("os.environ", environ): @@ -447,8 +470,10 @@ def test_load_from_env_redundant_file_path(self): def test_load_from_env_secondary_file_path(self): """JSON_KEY_FILE_PATH is used instead of secondary var name.""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_PATH_TO_PRIVATE_KEY_FILE": self.path_to_private_key_file, + **self.default_env_var_config, + **{ + "GOOGLE_ADS_PATH_TO_PRIVATE_KEY_FILE": self.path_to_private_key_file, + }, } with mock.patch("os.environ", environ): @@ -461,12 +486,14 @@ def test_load_from_env_secondary_file_path(self): def test_load_from_env_redundant_delegated_email(self): """IMPERSONATED_EMAIL takes precedent if both exist.""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - # The two below variables represent the same key, and this test - # checks that IMPERSONATED_EMAIL takes precedent and overwrites - # the delegate_account key in the returned dict. - "GOOGLE_ADS_DELEGATED_ACCOUNT": self.delegated_account, - "GOOGLE_ADS_IMPERSONATED_EMAIL": self.impersonated_email, + **self.default_env_var_config, + **{ + # The two below variables represent the same key, and this test + # checks that IMPERSONATED_EMAIL takes precedent and overwrites + # the delegate_account key in the returned dict. + "GOOGLE_ADS_DELEGATED_ACCOUNT": self.delegated_account, + "GOOGLE_ADS_IMPERSONATED_EMAIL": self.impersonated_email, + }, } with mock.patch("os.environ", environ): @@ -479,8 +506,8 @@ def test_load_from_env_redundant_delegated_email(self): def test_load_from_env_secondary_delegated_email(self): """IMPERSONATED_EMAIL is used instead of secondary var name.""" environ = { - "GOOGLE_ADS_DEVELOPER_TOKEN": self.developer_token, - "GOOGLE_ADS_DELEGATED_ACCOUNT": self.delegated_account, + **self.default_env_var_config, + **{"GOOGLE_ADS_DELEGATED_ACCOUNT": self.delegated_account,}, } with mock.patch("os.environ", environ): @@ -607,3 +634,17 @@ def test_parse_linked_customer_id_with_none(self): self.assertEqual( config.convert_linked_customer_id_to_str(config_data), config_data ) + + def test_disambiguate_string_bool(self): + self.assertEqual(config.disambiguate_string_bool(True), True) + + def test_disambiguate_string_bool_with_str(self): + self.assertEqual(config.disambiguate_string_bool("True"), True) + + def test_disambiguate_string_bool_raises_value_error(self): + self.assertRaises( + ValueError, config.disambiguate_string_bool, "invalid" + ) + + def test_disambiguate_string_bool_raises_type_error(self): + self.assertRaises(TypeError, config.disambiguate_string_bool, {}) diff --git a/tests/fixtures/__init__.py b/tests/fixtures/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/google/ads/googleads/v6/services/services/account_budget_proposal_service/__init__.py b/tests/fixtures/proto_plus_fixture.py similarity index 60% rename from google/ads/googleads/v6/services/services/account_budget_proposal_service/__init__.py rename to tests/fixtures/proto_plus_fixture.py index 321e81ca5..7d578dae4 100644 --- a/google/ads/googleads/v6/services/services/account_budget_proposal_service/__init__.py +++ b/tests/fixtures/proto_plus_fixture.py @@ -1,20 +1,22 @@ -# -*- coding: utf-8 -*- - -# Copyright 2020 Google LLC +# Copyright 2019 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 +# 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. -# +"""A proto-plus wrapped protobuf definition to use for testing.""" + + +import proto + -from .client import AccountBudgetProposalServiceClient +class ProtoPlusFixture(proto.Message): + """Wrapped protobuf class for testing purposes.""" -__all__ = ("AccountBudgetProposalServiceClient",) + name = proto.Field(proto.STRING, number=1) diff --git a/tests/fixtures/protobuf_fixture.proto b/tests/fixtures/protobuf_fixture.proto new file mode 100644 index 000000000..1b2b976b2 --- /dev/null +++ b/tests/fixtures/protobuf_fixture.proto @@ -0,0 +1,5 @@ +syntax = "proto3"; + +message ProtobufFixture { + string name = 1; +} diff --git a/tests/fixtures/protobuf_fixture_pb2.py b/tests/fixtures/protobuf_fixture_pb2.py new file mode 100644 index 000000000..0d5cfd608 --- /dev/null +++ b/tests/fixtures/protobuf_fixture_pb2.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# Generated by the protocol buffer compiler. DO NOT EDIT! +# source: protobuf_fixture.proto + +from google.protobuf import descriptor as _descriptor +from google.protobuf import message as _message +from google.protobuf import reflection as _reflection +from google.protobuf import symbol_database as _symbol_database + +# @@protoc_insertion_point(imports) + +_sym_db = _symbol_database.Default() + + +DESCRIPTOR = _descriptor.FileDescriptor( + name="protobuf_fixture.proto", + package="", + syntax="proto3", + serialized_options=None, + create_key=_descriptor._internal_create_key, + serialized_pb=b'\n\x16protobuf_fixture.proto"\x1f\n\x0fProtobufFixture\x12\x0c\n\x04name\x18\x01 \x01(\tb\x06proto3', +) + + +_PROTOBUFFIXTURE = _descriptor.Descriptor( + name="ProtobufFixture", + full_name="ProtobufFixture", + filename=None, + file=DESCRIPTOR, + containing_type=None, + create_key=_descriptor._internal_create_key, + fields=[ + _descriptor.FieldDescriptor( + name="name", + full_name="ProtobufFixture.name", + index=0, + number=1, + type=9, + cpp_type=9, + label=1, + has_default_value=False, + default_value=b"".decode("utf-8"), + message_type=None, + enum_type=None, + containing_type=None, + is_extension=False, + extension_scope=None, + serialized_options=None, + file=DESCRIPTOR, + create_key=_descriptor._internal_create_key, + ), + ], + extensions=[], + nested_types=[], + enum_types=[], + serialized_options=None, + is_extendable=False, + syntax="proto3", + extension_ranges=[], + oneofs=[], + serialized_start=26, + serialized_end=57, +) + +DESCRIPTOR.message_types_by_name["ProtobufFixture"] = _PROTOBUFFIXTURE +_sym_db.RegisterFileDescriptor(DESCRIPTOR) + +ProtobufFixture = _reflection.GeneratedProtocolMessageType( + "ProtobufFixture", + (_message.Message,), + { + "DESCRIPTOR": _PROTOBUFFIXTURE, + "__module__": "protobuf_fixture_pb2" + # @@protoc_insertion_point(class_scope:ProtobufFixture) + }, +) +_sym_db.RegisterMessage(ProtobufFixture) + + +# @@protoc_insertion_point(module_scope) diff --git a/tests/interceptors/exception_interceptor_test.py b/tests/interceptors/exception_interceptor_test.py index 8c8be1dc2..2dfd2bf56 100644 --- a/tests/interceptors/exception_interceptor_test.py +++ b/tests/interceptors/exception_interceptor_test.py @@ -17,11 +17,16 @@ import mock from unittest import TestCase +from google.protobuf.message import Message as ProtobufMessageType +import proto + +from fixtures.proto_plus_fixture import ProtoPlusFixture from google.ads.googleads.errors import GoogleAdsException from google.ads.googleads import client as Client from google.ads.googleads.interceptors import ExceptionInterceptor from google.ads.googleads.interceptors.exception_interceptor import ( _UnaryStreamWrapper, + _UnaryUnaryWrapper, ) latest_version = Client._DEFAULT_VERSION @@ -30,13 +35,13 @@ class ExceptionInterceptorTest(TestCase): - def _create_test_interceptor(self): + def _create_test_interceptor(self, **kwargs): """Creates and returns an ExceptionInterceptor instance Returns: An ExceptionInterceptor instance. """ - return ExceptionInterceptor(Client._DEFAULT_VERSION) + return ExceptionInterceptor(Client._DEFAULT_VERSION, **kwargs) def test_handle_grpc_failure(self): """Raises non-retryable GoogleAdsFailures as GoogleAdsExceptions.""" @@ -187,7 +192,67 @@ def mock_continuation(client_call_details, request): mock_continuation, mock_client_call_details, mock_request ) - self.assertEqual(result, mock_response) + self.assertIsInstance(result, _UnaryUnaryWrapper) + + def test_intercept_unary_unary_proto_plus_proto(self): + """Returns a proto_plus proto if use_proto_plus is True""" + + class MockResponse: + def exception(self): + return None + + def result(self): + return ProtoPlusFixture() + + mock_request = mock.Mock() + mock_client_call_details = mock.Mock() + mock_response = MockResponse() + + def mock_continuation(client_call_details, request): + del client_call_details + del request + return mock_response + + interceptor = self._create_test_interceptor(use_proto_plus=True) + + result = interceptor.intercept_unary_unary( + mock_continuation, mock_client_call_details, mock_request + ) + + # Ensure the returned value is a wrapped response object. + self.assertIsInstance(result, _UnaryUnaryWrapper) + message = result.result() + self.assertIsInstance(message, proto.Message) + + def test_intercept_unary_unary_protobuf_proto(self): + """__next__ returns a protobuf proto if use_proto_plus is False""" + + class MockResponse: + def exception(self): + return None + + def result(self): + return ProtoPlusFixture() + + mock_request = mock.Mock() + mock_client_call_details = mock.Mock() + mock_response = MockResponse() + + def mock_continuation(client_call_details, request): + del client_call_details + del request + return mock_response + + interceptor = self._create_test_interceptor(use_proto_plus=False) + + result = interceptor.intercept_unary_unary( + mock_continuation, mock_client_call_details, mock_request + ) + + # Ensure the returned value is a wrapped response object. + self.assertIsInstance(result, _UnaryUnaryWrapper) + message = result.result() + self.assertIsInstance(message, ProtobufMessageType) def test_intercept_unary_stream_response_is_successful(self): """If response.exception() is None response is returned.""" @@ -213,3 +278,67 @@ def mock_continuation(client_call_details, request): # Ensure the returned value is a wrapped response object. self.assertIsInstance(result, _UnaryStreamWrapper) + + def test_intercept_unary_stream_proto_plus_proto(self): + """__next__ returns a proto_plus proto if use_proto_plus is True""" + + class MockResponse: + def exception(self): + return None + + def __next__(self): + # Return a proto_plus proto object just as the current + # generated services do. + return ProtoPlusFixture() + + mock_request = mock.Mock() + mock_client_call_details = mock.Mock() + mock_response = MockResponse() + + def mock_continuation(client_call_details, request): + del client_call_details + del request + return mock_response + + interceptor = self._create_test_interceptor(use_proto_plus=True) + + result = interceptor.intercept_unary_stream( + mock_continuation, mock_client_call_details, mock_request + ) + + # Ensure the returned value is a wrapped response object. + self.assertIsInstance(result, _UnaryStreamWrapper) + message = next(result) + self.assertIsInstance(message, proto.Message) + + def test_intercept_unary_stream_protobuf_proto(self): + """__next__ returns a protobuf proto if use_proto_plus is False""" + + class MockResponse: + def exception(self): + return None + + def __next__(self): + # Return a proto_plus proto object just as the current + # generated services do. + return ProtoPlusFixture() + + mock_request = mock.Mock() + mock_client_call_details = mock.Mock() + mock_response = MockResponse() + + def mock_continuation(client_call_details, request): + del client_call_details + del request + return mock_response + + interceptor = self._create_test_interceptor(use_proto_plus=False) + + result = interceptor.intercept_unary_stream( + mock_continuation, mock_client_call_details, mock_request + ) + + # Ensure the returned value is a wrapped response object. + self.assertIsInstance(result, _UnaryStreamWrapper) + message = next(result) + self.assertIsInstance(message, ProtobufMessageType) diff --git a/tests/interceptors/logging_interceptor_test.py b/tests/interceptors/logging_interceptor_test.py index fab1d407d..8279a35aa 100644 --- a/tests/interceptors/logging_interceptor_test.py +++ b/tests/interceptors/logging_interceptor_test.py @@ -24,6 +24,7 @@ from google.ads.googleads import client as Client from google.ads.googleads.interceptors import LoggingInterceptor import google.ads.googleads.interceptors.logging_interceptor as interceptor_module +from google.ads.googleads import util default_version = Client._DEFAULT_VERSION @@ -512,7 +513,7 @@ def test_get_call_method_none(self): self.assertEqual(result, None) def test_parse_exception_to_str_transport_failure(self): - """ Calls _format_json_object with error obj's debug_error_string.""" + """Calls _format_json_object with error obj's debug_error_string.""" interceptor = self._create_test_interceptor() with mock.patch("logging.config.dictConfig"), mock.patch.object( @@ -742,6 +743,23 @@ def test_mask_search_google_ads_response(self): copy.results[0].customer_user_access.email_address, "REDACTED" ) + def test_mask_search_google_ads_response_protobuf(self): + """Copies and masks a SearchGoogleAdsResponse message instance.""" + response = google_ads_service.SearchGoogleAdsResponse() + row = google_ads_service.GoogleAdsRow( + customer_user_access=customer_user_access.CustomerUserAccess( + email_address="test@test.com" + ) + ) + response.results.append(row) + protobuf = util.convert_proto_plus_to_protobuf(response) + copy = interceptor_module._mask_message(protobuf, "REDACTED") + self.assertIsInstance(copy, protobuf.__class__) + self.assertIsNot(protobuf, copy) + self.assertEqual( + copy.results[0].customer_user_access.email_address, "REDACTED" + ) + def test_mask_search_google_ads_stream_response(self): """Copies and masks a SearchGoogleAdsStreamResponse message instance.""" response = google_ads_service.SearchGoogleAdsStreamResponse() diff --git a/tests/util_test.py b/tests/util_test.py index 713751477..5fa7bfe09 100644 --- a/tests/util_test.py +++ b/tests/util_test.py @@ -17,6 +17,11 @@ from importlib import import_module from unittest import TestCase +from google.protobuf.message import Message as ProtobufMessageType +import proto + +from fixtures.protobuf_fixture_pb2 import ProtobufFixture +from fixtures.proto_plus_fixture import ProtoPlusFixture from google.ads.googleads import util from google.ads.googleads import client @@ -62,3 +67,130 @@ def test_get_nested_message_field(self): ), val, ) + + +class ConvertProtoPlusToProtobufTest(TestCase): + def test_convert_proto_plus_to_protobuf(self): + """A proto_plus proto is converted to a protobuf one.""" + proto_plus = ProtoPlusFixture() + converted = util.convert_proto_plus_to_protobuf(proto_plus) + # Assert that the converted proto is an instance of the protobuf + # protobuf message class. + self.assertIsInstance(converted, ProtobufMessageType) + + def test_convert_proto_plus_to_protobuf_if_protobuf(self): + """If a protobuf proto is given then it is returned to the caller.""" + protobuf = ProtobufFixture() + converted = util.convert_proto_plus_to_protobuf(protobuf) + self.assertEqual(protobuf, converted) + + def test_proto_plus_to_protobuf_raises_type_error(self): + """Method raises TypeError if not given a proto_plus proto.""" + wrong_type = dict() + self.assertRaises( + TypeError, util.convert_proto_plus_to_protobuf, wrong_type + ) + + +class ConvertProtobufToProtoPlusTest(TestCase): + def test_convert_protobuf_to_proto_plus(self): + """A protobuf proto is converted to a proto_plus one.""" + protobuf = ProtobufFixture() + converted = util.convert_protobuf_to_proto_plus(protobuf) + # Assert that the converted proto is an instance of the Message + # wrapper class. + self.assertIsInstance(converted, proto.Message) + + def test_convert_protobuf_to_proto_plus_if_proto_plus(self): + """If a protobuf proto is given then it is returned to the caller.""" + proto_plus = ProtoPlusFixture() + converted = util.convert_protobuf_to_proto_plus(proto_plus) + self.assertEqual(proto_plus, converted) + + def test_raises_type_error(self): + """Method raises TypeError if not given a protobuf proto.""" + wrong_type = dict() + self.assertRaises( + TypeError, util.convert_protobuf_to_proto_plus, wrong_type + ) + + +class ProtoCopyFromTest(TestCase): + def test_client_copy_from_both_proto_plus(self): + """util.proto_copy_from works with two proto_plus proto messages.""" + destination = ProtoPlusFixture() + origin = ProtoPlusFixture() + origin.name = "Test" + + util.proto_copy_from(destination, origin) + + self.assertEqual(destination.name, "Test") + self.assertIsNot(destination, origin) + + def test_client_copy_from_both_protobuf(self): + """util.proto_copy_from works with two protobuf proto messages.""" + destination = ProtobufFixture() + origin = ProtobufFixture() + origin.name = "Test" + + util.proto_copy_from(destination, origin) + + self.assertEqual(destination.name, "Test") + self.assertIsNot(destination, origin) + + def test_client_copy_from_protobuf_origin(self): + """util.proto_copy_from works with a proto_plus dest and a protobuf origin.""" + destination = ProtoPlusFixture() + origin = ProtoPlusFixture() + origin = type(origin).pb(origin) + origin.name = "Test" + + util.proto_copy_from(destination, origin) + + self.assertEqual(destination.name, "Test") + self.assertIsNot(destination, origin) + + def test_client_copy_from_protobuf_destination(self): + """util.proto_copy_from works with a protobuf dest and a proto_plus origin.""" + destination = ProtoPlusFixture() + destination = type(destination).pb(destination) + origin = ProtoPlusFixture() + origin.name = "Test" + + util.proto_copy_from(destination, origin) + + self.assertEqual(destination.name, "Test") + self.assertIsNot(destination, origin) + + def test_client_copy_from_different_types_proto_plus(self): + """TypeError is raised with different types of proto_plus messasges.""" + destination = ProtobufFixture() + destination = proto.Message.wrap(destination) + origin = ProtoPlusFixture() + origin.name = "Test" + + self.assertRaises(TypeError, util.proto_copy_from, destination, origin) + + def test_client_copy_from_different_types_protobuf(self): + """TypeError is raised with different types of protobuf messasges.""" + destination = ProtoPlusFixture() + destination = type(destination).pb(destination) + origin = ProtobufFixture() + origin.name = "Test" + + self.assertRaises(TypeError, util.proto_copy_from, destination, origin) + + def test_client_copy_from_different_types_protobuf_origin(self): + """TypeError is raised with different types and protobuf origin.""" + destination = ProtoPlusFixture() + origin = ProtobufFixture() + origin.name = "Test" + + self.assertRaises(TypeError, util.proto_copy_from, destination, origin) + + def test_client_copy_from_non_proto_message(self): + """ValueError is raised if an object other than a protobuf is given""" + destination = ProtoPlusFixture() + origin = {"name": "Test"} + + self.assertRaises(ValueError, util.proto_copy_from, destination, origin)